Removing IPv4 enforcement on Endpoints

Signed-off-by: André Martins <aanm90@gmail.com>
This commit is contained in:
André Martins
2016-03-22 04:54:32 +00:00
parent 1186f4bf85
commit c1a360b1d5
9 changed files with 25 additions and 18 deletions

View File

@@ -281,6 +281,11 @@ func TestIsValidLabelValue(t *testing.T) {
func TestIsValidIP(t *testing.T) {
goodValues := []string{
"::1",
"2a00:79e0:2:0:f1c3:e797:93c1:df80",
"::",
"2001:4860:4860::8888",
"::fff:1.1.1.1",
"1.1.1.1",
"1.1.1.01",
"255.0.0.1",
@@ -288,22 +293,20 @@ func TestIsValidIP(t *testing.T) {
"0.0.0.0",
}
for _, val := range goodValues {
if !IsValidIPv4(val) {
if !IsValidIP(val) {
t.Errorf("expected true for %q", val)
}
}
badValues := []string{
"2a00:79e0:2:0:f1c3:e797:93c1:df80", // This is valid IPv6
"a",
"[2001:db8:0:1]:80",
"myhost.mydomain",
"-1.0.0.0",
"1.0.0.256",
"1.0.0.1.1",
"1.0.0.1.",
"[2001:db8:0:1]",
"a",
}
for _, val := range badValues {
if IsValidIPv4(val) {
if IsValidIP(val) {
t.Errorf("expected false for %q", val)
}
}