1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-21 11:57:02 +00:00

Add notes for the new lead maintainer of the open-source iris project and align with @get-ion/ion by @hiveminded

Former-commit-id: da4f38eb9034daa49446df3ee529423b98f9b331
This commit is contained in:
kataras
2017-07-10 18:32:42 +03:00
parent 2d4c2779a7
commit 9f85b74fc9
344 changed files with 4842 additions and 5174 deletions

43
core/netutil/addr_test.go Normal file
View File

@@ -0,0 +1,43 @@
package netutil
import (
"testing"
)
func TestIsLoopbackHost(t *testing.T) {
tests := []struct {
host string
valid bool
}{
{"subdomain.127.0.0.1:8080", true},
{"subdomain.127.0.0.1", true},
{"subdomain.localhost:8080", true},
{"subdomain.localhost", true},
{"subdomain.127.0000.0000.1:8080", true},
{"subdomain.127.0000.0000.1", true},
{"subdomain.127.255.255.254:8080", true},
{"subdomain.127.255.255.254", true},
{"subdomain.0000:0:0000::01.1:8080", false},
{"subdomain.0000:0:0000::01", false},
{"subdomain.0000:0:0000::01.1:8080", false},
{"subdomain.0000:0:0000::01", false},
{"subdomain.0000:0000:0000:0000:0000:0000:0000:0001:8080", true},
{"subdomain.0000:0000:0000:0000:0000:0000:0000:0001", false},
{"subdomain.example:8080", false},
{"subdomain.example", false},
{"subdomain.example.com:8080", false},
{"subdomain.example.com", false},
{"subdomain.com", false},
{"subdomain", false},
{".subdomain", false},
{"127.0.0.1.com", false},
}
for i, tt := range tests {
if expected, got := tt.valid, IsLoopbackHost(tt.host); expected != got {
t.Fatalf("[%d] expected %t but got %t for %s", i, expected, got, tt.host)
}
}
}