@@ -29,12 +29,18 @@ func TestDNSResolver(t *testing.T) {
29
29
expected scionAddr
30
30
}{
31
31
{"example.com" , assert .NoError , mustParse ("1-ff00:0:f00,[192.0.2.1]" )},
32
- {"example.net" , assert .NoError , mustParse ("1-ff00:0:ba5,[192.0.2.1]" )},
32
+ {"example.net" , assert .NoError , mustParse ("1-ff00:0:ba5,[192.0.2.38]" )},
33
+ {"example.org" , assert .Error , scionAddr {}},
34
+ {"noia.example.org" , assert .Error , scionAddr {}},
35
+ {"noip.example.org" , assert .Error , scionAddr {}},
36
+ {"trailing.example.org" , assert .Error , scionAddr {}},
37
+ {"example.edu" , assertErrHostNotFound , scionAddr {}},
38
+ {"empty.example.edu" , assertErrHostNotFound , scionAddr {}},
33
39
{"dummy4" , assertErrHostNotFound , scionAddr {}},
34
40
{"barbaz" , assertErrHostNotFound , scionAddr {}},
35
41
}
36
- var m * mockResolver
37
- resolver := & dnsResolver {res : m }
42
+ var m mockResolver
43
+ resolver := & dnsResolver {res : & m }
38
44
for _ , c := range cases {
39
45
actual , err := resolver .Resolve (context .TODO (), c .name )
40
46
if ! c .assertErr (t , err ) {
@@ -63,10 +69,28 @@ func (r *mockResolver) LookupTXT(ctx context.Context, name string) ([]string, er
63
69
"scion=1-ff00:0:f00,[192.0.2.1]" ,
64
70
},
65
71
"example.net." : {
66
- "scion=1-ff00:0:ba5,[192.0.2.1 ]" ,
72
+ "scion=1-ff00:0:ba5,[192.0.2.38 ]" ,
67
73
"BOOM_verify_3ovqPKkST76TzF2c7b13YA" ,
68
74
"v=spf1 include:_id.example.net ip4:192.0.2.38 ip4:192.0.2.197 ~all" ,
69
75
},
76
+ "example.org." : {
77
+ "scion=1-ff00:0:invalid,[192.0.2.1]" ,
78
+ },
79
+ "noip.example.org." : {
80
+ "scion=1-ff00:0:f01" ,
81
+ },
82
+ "noia.example.org." : {
83
+ "scion=192.0.2.100" ,
84
+ },
85
+ "trailing.example.org." : {
86
+ "scion=1-ff00:0:f01,[192.0.2.100] something more" ,
87
+ },
88
+ "example.edu." : {
89
+ "v=spf1 include:_id.example.org ip4:192.0.2.203 ip4:192.0.2.213 ~all" ,
90
+ },
91
+ "empty.example.edu." : {
92
+ "" ,
93
+ },
70
94
}[name ]
71
95
if ! ok {
72
96
return nil , & net.DNSError {IsNotFound : true }
0 commit comments