mirror of https://github.com/docker/docs.git
				
				
				
			FIX 2510 Support DNS names
Signed-off-by: David Gageot <david@gageot.net>
This commit is contained in:
		
							parent
							
								
									c41476ee74
								
							
						
					
					
						commit
						eeb568fd27
					
				|  | @ -2,8 +2,6 @@ package drivers | |||
| 
 | ||||
| import ( | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"net" | ||||
| 	"path/filepath" | ||||
| ) | ||||
| 
 | ||||
|  | @ -41,10 +39,6 @@ func (d *BaseDriver) GetIP() (string, error) { | |||
| 	if d.IPAddress == "" { | ||||
| 		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 | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -2,7 +2,6 @@ package drivers | |||
| 
 | ||||
| import ( | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"testing" | ||||
| 
 | ||||
| 	"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: "192.168.0.1"}, "192.168.0.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 { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue