-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathwhois_test.go
60 lines (43 loc) · 1.02 KB
/
whois_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package ripego
import (
"reflect"
"testing"
)
/*
func TestWhois(t *testing.T) {
info, err := IPLookup("178.18.196.250")
if err != nil {
t.Error(err)
}
t.Log(info.Inetnum)
t.Log(info.Netname)
t.Log(info.Person.Name)
t.Log(info.Route.Origin)
}*/
func TestNicProvider(t *testing.T) {
w := getNicProvider("1.5.5.1")
t.Log(reflect.TypeOf(w).Name())
if reflect.TypeOf(w).Name() != "apnic" {
t.Fatal("Invalid type: apnic")
}
w = getNicProvider("177.148.56.7")
t.Log(reflect.TypeOf(w).Name())
if reflect.TypeOf(w).Name() != "lacnic" {
t.Fatal("Invalid type: lacnic")
}
w = getNicProvider("51.2.25.4")
t.Log(reflect.TypeOf(w).Name())
if reflect.TypeOf(w).Name() != "ripe" {
t.Fatal("Invalid type: ripe")
}
w = getNicProvider("154.125.148.148")
t.Log(reflect.TypeOf(w).Name())
if reflect.TypeOf(w).Name() != "afrinic" {
t.Fatal("Invalid type: afrinic")
}
w = getNicProvider("184.12.95.8")
t.Log(reflect.TypeOf(w).Name())
if reflect.TypeOf(w).Name() != "arin" {
t.Fatal("Invalid type: arin")
}
}