Add testing, cleanup, rework suffix tree to use nameservers. Parse nameservers from yaml.

This commit is contained in:
Tyler
2021-04-15 01:04:58 -04:00
parent b6efd0df0c
commit d8079551c9
10 changed files with 177 additions and 125 deletions

View File

@ -9,23 +9,23 @@ import (
func TestHostDomainAndIP(t *testing.T) {
Convey("Test Host File Domain and IP regex", t, func() {
Convey("1.1.1.1 should be IP and not domain", func() {
So(isIP("1.1.1.1"), ShouldEqual, true)
So(isDomain("1.1.1.1"), ShouldEqual, false)
So(IsIP("1.1.1.1"), ShouldEqual, true)
So(IsDomain("1.1.1.1"), ShouldEqual, false)
})
Convey("2001:470:20::2 should be IP and not domain", func() {
So(isIP("2001:470:20::2"), ShouldEqual, true)
So(isDomain("2001:470:20::2"), ShouldEqual, false)
So(IsIP("2001:470:20::2"), ShouldEqual, true)
So(IsDomain("2001:470:20::2"), ShouldEqual, false)
})
Convey("`host` should not be domain and not IP", func() {
So(isDomain("host"), ShouldEqual, false)
So(isIP("host"), ShouldEqual, false)
So(IsDomain("host"), ShouldEqual, false)
So(IsIP("host"), ShouldEqual, false)
})
Convey("`123.test` should be domain and not IP", func() {
So(isDomain("123.test"), ShouldEqual, true)
So(isIP("123.test"), ShouldEqual, false)
So(IsDomain("123.test"), ShouldEqual, true)
So(IsIP("123.test"), ShouldEqual, false)
})
})