Skip to content

Commit

Permalink
fix stamp parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbeans committed Feb 11, 2018
1 parent 82d34a4 commit 5940934
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DnsCrypt.Stamps.Tests/StampFileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public void StampReadFileTest()
{
var testFile = Path.Combine("Testfiles", "public-resolvers.md");
var stamps = StampTools.ReadStampFile(testFile);
Assert.Equal(81, stamps.Count);
Assert.Equal(85, stamps.Count);
}
}
}
14 changes: 11 additions & 3 deletions DnsCrypt.Stamps/StampTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,20 @@ public static List<Stamp> ReadStampFile(string stampFilePath, bool noLog = false
foreach (var rawStampListEntry in rawStampList)
{
var def = rawStampListEntry.Split(new[] {'\n'}, StringSplitOptions.RemoveEmptyEntries);
if (def.Length != 3) continue;
//TODO: fix this condition (may not work with every list ...)
if (def.Length > 6) continue;

Stamp stamp = null;
for (int i = 0; i<def.Length; i++)
{
if (def[i].StartsWith("sdns://"))
{
stamp = Decode(def[i].Trim());
}
}

var stamp = Decode(def[2].Trim());
if (stamp != null)
{

if (onlyDnsSec)
{
if (!stamp.Properties.DnsSec)
Expand Down
1 change: 0 additions & 1 deletion Measurement/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ private static async Task Main(string[] args)
if (stamp.Protocol == StampProtocol.DnsCrypt)
{
var measurement = await MeasurementTools.Proxy(stamp).ConfigureAwait(false);

if (!measurement.Failed)
{
measurementResults.Add(measurement);
Expand Down

0 comments on commit 5940934

Please sign in to comment.