🚨 Remove unused isIPv6 func

pull/879/head
David Mazary 2020-10-03 13:21:26 -04:00
parent 618b753230
commit 71d3e16be4
2 changed files with 0 additions and 28 deletions

View File

@ -307,10 +307,6 @@ func isEtagStale(etag string, noneMatchBytes []byte) bool {
return !matchEtag(getString(noneMatchBytes[start:end]), etag)
}
func isIPv6(address string) bool {
return strings.Count(address, ":") >= 2
}
func parseAddr(raw string) (host, port string) {
if i := strings.LastIndex(raw, ":"); i != -1 {
return raw[:i], raw[i+1:]

View File

@ -209,30 +209,6 @@ func Benchmark_Utils_Unescape(b *testing.B) {
utils.AssertEqual(b, "/créer", unescaped)
}
func Test_Utils_IPv6(t *testing.T) {
testCases := []struct {
string
bool
}{
{"::FFFF:C0A8:1:3000", true},
{"::FFFF:C0A8:0001:3000", true},
{"0000:0000:0000:0000:0000:FFFF:C0A8:1:3000", true},
{"::FFFF:C0A8:1%1:3000", true},
{"::FFFF:192.168.0.1:3000", true},
{"[::FFFF:C0A8:1]:3000", true},
{"[::FFFF:C0A8:1%1]:3000", true},
{":3000", false},
{"127.0.0.1:3000", false},
{"127.0.0.1:", false},
{"0.0.0.0:3000", false},
{"", false},
}
for _, c := range testCases {
utils.AssertEqual(t, c.bool, isIPv6(c.string))
}
}
func Test_Utils_Parse_Address(t *testing.T) {
testCases := []struct {
addr, host, port string