Skip to content

Commit 9a28594

Browse files
committed
search domain discovery: add WHOIS tests
1 parent ac78eef commit 9a28594

File tree

1 file changed

+75
-2
lines changed

1 file changed

+75
-2
lines changed

hinting/dns_search_domain_fallbacks_test.go

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ func TestReverseLookupDomains(t *testing.T) {
3535
domain string
3636
}{
3737
{ip: netip.MustParseAddr("66.180.178.131"), domain: "princeton.edu"},
38-
//{ip: randIPFromCIDR("128.112.0.0/16"), domain: "princeton.edu"},
3938
{ip: randIPFromCIDR("128.112.66.0/23"), domain: "princeton.edu"},
4039
},
4140
},
@@ -66,7 +65,6 @@ func TestReverseLookupDomains(t *testing.T) {
6665
ip netip.Addr
6766
domain string
6867
}{
69-
//{ip: netip.MustParseAddr("203.250.215.48"), domain: "kreonet.net"},
7068
{ip: netip.MustParseAddr("134.75.254.11"), domain: "kreonet.net"},
7169
{ip: netip.MustParseAddr("134.75.254.12"), domain: "kreonet.net"},
7270
},
@@ -94,6 +92,81 @@ func TestReverseLookupDomains(t *testing.T) {
9492
}
9593
}
9694

95+
func TestReverseLookupWHOIS(t *testing.T) {
96+
97+
testCases := []struct {
98+
name string
99+
values []struct {
100+
ip netip.Addr
101+
domain string
102+
}
103+
}{
104+
{
105+
name: "ETHZ",
106+
values: []struct {
107+
ip netip.Addr
108+
domain string
109+
}{
110+
{ip: netip.MustParseAddr("129.132.19.216"), domain: "ethz.ch"},
111+
},
112+
},
113+
{
114+
name: "PU",
115+
values: []struct {
116+
ip netip.Addr
117+
domain string
118+
}{
119+
{ip: netip.MustParseAddr("128.112.0.11"), domain: "princeton.edu"},
120+
},
121+
},
122+
{
123+
name: "VU",
124+
values: []struct {
125+
ip netip.Addr
126+
domain string
127+
}{
128+
{ip: netip.MustParseAddr("128.143.3.126"), domain: "virginia.edu"},
129+
},
130+
},
131+
{
132+
name: "SWITCH",
133+
values: []struct {
134+
ip netip.Addr
135+
domain string
136+
}{
137+
{ip: netip.MustParseAddr("130.59.31.35"), domain: "switch.ch"},
138+
},
139+
},
140+
{
141+
name: "KREONET",
142+
values: []struct {
143+
ip netip.Addr
144+
domain string
145+
}{
146+
{ip: netip.MustParseAddr("203.250.215.48"), domain: "kreonet.net"},
147+
},
148+
},
149+
{
150+
name: "KU",
151+
values: []struct {
152+
ip netip.Addr
153+
domain string
154+
}{
155+
{ip: netip.MustParseAddr("163.152.6.1"), domain: "korea.ac.kr"},
156+
},
157+
},
158+
}
159+
for _, tc := range testCases {
160+
t.Log(tc.name)
161+
for _, v := range tc.values {
162+
t.Log(v.ip)
163+
res := reverseLookupWhois(v.ip)
164+
t.Log(res)
165+
assert.Subset(t, res, []string{v.domain}, "")
166+
}
167+
}
168+
}
169+
97170
func TestDomainsFromHostnamesDerivation(t *testing.T) {
98171
testCases := []struct {
99172
name string

0 commit comments

Comments
 (0)