mirror of https://github.com/docker/docs.git
Merge pull request #2523 from dgageot/2510-support-dns-names
FIX 2510 Support DNS names
This commit is contained in:
commit
92854bd31f
|
@ -2,8 +2,6 @@ package drivers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"net"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -41,10 +39,6 @@ func (d *BaseDriver) GetIP() (string, error) {
|
||||||
if d.IPAddress == "" {
|
if d.IPAddress == "" {
|
||||||
return "", errors.New("IP address is not set")
|
return "", errors.New("IP address is not set")
|
||||||
}
|
}
|
||||||
ip := net.ParseIP(d.IPAddress)
|
|
||||||
if ip == nil {
|
|
||||||
return "", fmt.Errorf("IP address is invalid: %s", d.IPAddress)
|
|
||||||
}
|
|
||||||
return d.IPAddress, nil
|
return d.IPAddress, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package drivers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
@ -18,7 +17,7 @@ func TestIP(t *testing.T) {
|
||||||
{&BaseDriver{IPAddress: "2001:4860:0:2001::68"}, "2001:4860:0:2001::68", nil},
|
{&BaseDriver{IPAddress: "2001:4860:0:2001::68"}, "2001:4860:0:2001::68", nil},
|
||||||
{&BaseDriver{IPAddress: "192.168.0.1"}, "192.168.0.1", nil},
|
{&BaseDriver{IPAddress: "192.168.0.1"}, "192.168.0.1", nil},
|
||||||
{&BaseDriver{IPAddress: "::1"}, "::1", nil},
|
{&BaseDriver{IPAddress: "::1"}, "::1", nil},
|
||||||
{&BaseDriver{IPAddress: "whatever"}, "", fmt.Errorf("IP address is invalid: %s", "whatever")},
|
{&BaseDriver{IPAddress: "hostname"}, "hostname", nil},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, c := range cases {
|
for _, c := range cases {
|
||||||
|
|
Loading…
Reference in New Issue