{host: "foo.*.example.com"},
{host: "exa_mple.com", validInput: true, validPattern: true},
{host: "foo,bar"},
- {host: "project-dev:us-central1:main", validInput: true, validPattern: true},
+ {host: "project-dev:us-central1:main"},
}
for _, tt := range tests {
if got := validHostnamePattern(tt.host); got != tt.validPattern {
{"*.com", "example.com", true},
{"*.com", "example.com.", true},
{"foo:bar", "foo:bar", true},
- {"*.foo:bar", "xxx.foo:bar", true},
+ {"*.foo:bar", "xxx.foo:bar", false},
+ {"*.2.3.4", "1.2.3.4", false},
+ {"*.2.3.4", "[1.2.3.4]", false},
+ {"*:4860:4860::8888", "2001:4860:4860::8888", false},
+ {"*:4860:4860::8888", "[2001:4860:4860::8888]", false},
+ {"2001:4860:4860::8888", "2001:4860:4860::8888", false},
+ {"2001:4860:4860::8888", "[2001:4860:4860::8888]", false},
+ {"[2001:4860:4860::8888]", "2001:4860:4860::8888", false},
+ {"[2001:4860:4860::8888]", "[2001:4860:4860::8888]", false},
}
func TestMatchHostnames(t *testing.T) {