diff --git a/libnetwork/Godeps/Godeps.json b/libnetwork/Godeps/Godeps.json index e3e40f4dea..c24317664b 100644 --- a/libnetwork/Godeps/Godeps.json +++ b/libnetwork/Godeps/Godeps.json @@ -10,11 +10,6 @@ "Comment": "v0.6.4-12-g467d9d5", "Rev": "467d9d55c2d2c17248441a8fc661561161f40d5e" }, - { - "ImportPath": "github.com/docker/docker/pkg/etchosts", - "Comment": "v1.4.1-3152-g3e85803", - "Rev": "3e85803f311c3883a9b395ad046c894ea255e9be" - }, { "ImportPath": "github.com/docker/docker/pkg/homedir", "Comment": "v1.4.1-3152-g3e85803", @@ -50,11 +45,6 @@ "Comment": "v1.4.1-3152-g3e85803", "Rev": "3e85803f311c3883a9b395ad046c894ea255e9be" }, - { - "ImportPath": "github.com/docker/docker/pkg/resolvconf", - "Comment": "v1.4.1-3152-g3e85803", - "Rev": "3e85803f311c3883a9b395ad046c894ea255e9be" - }, { "ImportPath": "github.com/docker/docker/pkg/stringid", "Comment": "v1.4.1-3152-g3e85803", diff --git a/libnetwork/endpoint.go b/libnetwork/endpoint.go index e92d610dcc..85ab1e0f05 100644 --- a/libnetwork/endpoint.go +++ b/libnetwork/endpoint.go @@ -6,11 +6,11 @@ import ( "path/filepath" "github.com/Sirupsen/logrus" - "github.com/docker/docker/pkg/etchosts" - "github.com/docker/docker/pkg/resolvconf" "github.com/docker/libnetwork/driverapi" "github.com/docker/libnetwork/netutils" + "github.com/docker/libnetwork/pkg/etchosts" "github.com/docker/libnetwork/pkg/netlabel" + "github.com/docker/libnetwork/pkg/resolvconf" "github.com/docker/libnetwork/sandbox" "github.com/docker/libnetwork/types" ) @@ -412,7 +412,7 @@ func (ep *endpoint) setupDNS() error { } // replace any localhost/127.* but always discard IPv6 entries for now. - resolvConf, _ = resolvconf.FilterResolvDns(resolvConf, ep.network.enableIPv6) + resolvConf, _ = resolvconf.FilterResolvDNS(resolvConf, ep.network.enableIPv6) return ioutil.WriteFile(ep.container.config.resolvConfPath, resolvConf, 0644) } diff --git a/libnetwork/Godeps/_workspace/src/github.com/docker/docker/pkg/etchosts/etchosts.go b/libnetwork/pkg/etchosts/etchosts.go similarity index 94% rename from libnetwork/Godeps/_workspace/src/github.com/docker/docker/pkg/etchosts/etchosts.go rename to libnetwork/pkg/etchosts/etchosts.go index bef4a480cb..88e6b63e70 100644 --- a/libnetwork/Godeps/_workspace/src/github.com/docker/docker/pkg/etchosts/etchosts.go +++ b/libnetwork/pkg/etchosts/etchosts.go @@ -8,13 +8,13 @@ import ( "regexp" ) -// Structure for a single host record +// Record Structure for a single host record type Record struct { Hosts string IP string } -// Writes record to file and returns bytes written or error +// WriteTo writes record to file and returns bytes written or error func (r Record) WriteTo(w io.Writer) (int64, error) { n, err := fmt.Fprintf(w, "%s\t%s\n", r.IP, r.Hosts) return int64(n), err diff --git a/libnetwork/Godeps/_workspace/src/github.com/docker/docker/pkg/etchosts/etchosts_test.go b/libnetwork/pkg/etchosts/etchosts_test.go similarity index 100% rename from libnetwork/Godeps/_workspace/src/github.com/docker/docker/pkg/etchosts/etchosts_test.go rename to libnetwork/pkg/etchosts/etchosts_test.go diff --git a/libnetwork/Godeps/_workspace/src/github.com/docker/docker/pkg/resolvconf/README.md b/libnetwork/pkg/resolvconf/README.md similarity index 100% rename from libnetwork/Godeps/_workspace/src/github.com/docker/docker/pkg/resolvconf/README.md rename to libnetwork/pkg/resolvconf/README.md diff --git a/libnetwork/Godeps/_workspace/src/github.com/docker/docker/pkg/resolvconf/resolvconf.go b/libnetwork/pkg/resolvconf/resolvconf.go similarity index 98% rename from libnetwork/Godeps/_workspace/src/github.com/docker/docker/pkg/resolvconf/resolvconf.go rename to libnetwork/pkg/resolvconf/resolvconf.go index 5707b16b7f..d491fddad2 100644 --- a/libnetwork/Godeps/_workspace/src/github.com/docker/docker/pkg/resolvconf/resolvconf.go +++ b/libnetwork/pkg/resolvconf/resolvconf.go @@ -81,7 +81,7 @@ func GetLastModified() ([]byte, string) { return lastModified.contents, lastModified.sha256 } -// FilterResolvDns cleans up the config in resolvConf. It has two main jobs: +// FilterResolvDNS cleans up the config in resolvConf. It has two main jobs: // 1. It looks for localhost (127.*|::1) entries in the provided // resolv.conf, removing local nameserver entries, and, if the resulting // cleaned config has no defined nameservers left, adds default DNS entries @@ -89,7 +89,7 @@ func GetLastModified() ([]byte, string) { // code will remove all IPv6 nameservers if it is not enabled for containers // // It returns a boolean to notify the caller if changes were made at all -func FilterResolvDns(resolvConf []byte, ipv6Enabled bool) ([]byte, bool) { +func FilterResolvDNS(resolvConf []byte, ipv6Enabled bool) ([]byte, bool) { changed := false cleanedResolvConf := localhostNSRegexp.ReplaceAll(resolvConf, []byte{}) // if IPv6 is not enabled, also clean out any IPv6 address nameserver diff --git a/libnetwork/Godeps/_workspace/src/github.com/docker/docker/pkg/resolvconf/resolvconf_test.go b/libnetwork/pkg/resolvconf/resolvconf_test.go similarity index 91% rename from libnetwork/Godeps/_workspace/src/github.com/docker/docker/pkg/resolvconf/resolvconf_test.go rename to libnetwork/pkg/resolvconf/resolvconf_test.go index b0647e7833..dfb0a053f9 100644 --- a/libnetwork/Godeps/_workspace/src/github.com/docker/docker/pkg/resolvconf/resolvconf_test.go +++ b/libnetwork/pkg/resolvconf/resolvconf_test.go @@ -160,42 +160,42 @@ func TestBuildWithZeroLengthDomainSearch(t *testing.T) { func TestFilterResolvDns(t *testing.T) { ns0 := "nameserver 10.16.60.14\nnameserver 10.16.60.21\n" - if result, _ := FilterResolvDns([]byte(ns0), false); result != nil { + if result, _ := FilterResolvDNS([]byte(ns0), false); result != nil { if ns0 != string(result) { t.Fatalf("Failed No Localhost: expected \n<%s> got \n<%s>", ns0, string(result)) } } ns1 := "nameserver 10.16.60.14\nnameserver 10.16.60.21\nnameserver 127.0.0.1\n" - if result, _ := FilterResolvDns([]byte(ns1), false); result != nil { + if result, _ := FilterResolvDNS([]byte(ns1), false); result != nil { if ns0 != string(result) { t.Fatalf("Failed Localhost: expected \n<%s> got \n<%s>", ns0, string(result)) } } ns1 = "nameserver 10.16.60.14\nnameserver 127.0.0.1\nnameserver 10.16.60.21\n" - if result, _ := FilterResolvDns([]byte(ns1), false); result != nil { + if result, _ := FilterResolvDNS([]byte(ns1), false); result != nil { if ns0 != string(result) { t.Fatalf("Failed Localhost: expected \n<%s> got \n<%s>", ns0, string(result)) } } ns1 = "nameserver 127.0.1.1\nnameserver 10.16.60.14\nnameserver 10.16.60.21\n" - if result, _ := FilterResolvDns([]byte(ns1), false); result != nil { + if result, _ := FilterResolvDNS([]byte(ns1), false); result != nil { if ns0 != string(result) { t.Fatalf("Failed Localhost: expected \n<%s> got \n<%s>", ns0, string(result)) } } ns1 = "nameserver ::1\nnameserver 10.16.60.14\nnameserver 127.0.2.1\nnameserver 10.16.60.21\n" - if result, _ := FilterResolvDns([]byte(ns1), false); result != nil { + if result, _ := FilterResolvDNS([]byte(ns1), false); result != nil { if ns0 != string(result) { t.Fatalf("Failed Localhost: expected \n<%s> got \n<%s>", ns0, string(result)) } } ns1 = "nameserver 10.16.60.14\nnameserver ::1\nnameserver 10.16.60.21\nnameserver ::1" - if result, _ := FilterResolvDns([]byte(ns1), false); result != nil { + if result, _ := FilterResolvDNS([]byte(ns1), false); result != nil { if ns0 != string(result) { t.Fatalf("Failed Localhost: expected \n<%s> got \n<%s>", ns0, string(result)) } @@ -203,7 +203,7 @@ func TestFilterResolvDns(t *testing.T) { // with IPv6 disabled (false param), the IPv6 nameserver should be removed ns1 = "nameserver 10.16.60.14\nnameserver 2002:dead:beef::1\nnameserver 10.16.60.21\nnameserver ::1" - if result, _ := FilterResolvDns([]byte(ns1), false); result != nil { + if result, _ := FilterResolvDNS([]byte(ns1), false); result != nil { if ns0 != string(result) { t.Fatalf("Failed Localhost+IPv6 off: expected \n<%s> got \n<%s>", ns0, string(result)) } @@ -212,7 +212,7 @@ func TestFilterResolvDns(t *testing.T) { // with IPv6 enabled, the IPv6 nameserver should be preserved ns0 = "nameserver 10.16.60.14\nnameserver 2002:dead:beef::1\nnameserver 10.16.60.21\n" ns1 = "nameserver 10.16.60.14\nnameserver 2002:dead:beef::1\nnameserver 10.16.60.21\nnameserver ::1" - if result, _ := FilterResolvDns([]byte(ns1), true); result != nil { + if result, _ := FilterResolvDNS([]byte(ns1), true); result != nil { if ns0 != string(result) { t.Fatalf("Failed Localhost+IPv6 on: expected \n<%s> got \n<%s>", ns0, string(result)) } @@ -221,7 +221,7 @@ func TestFilterResolvDns(t *testing.T) { // with IPv6 enabled, and no non-localhost servers, Google defaults (both IPv4+IPv6) should be added ns0 = "\nnameserver 8.8.8.8\nnameserver 8.8.4.4\nnameserver 2001:4860:4860::8888\nnameserver 2001:4860:4860::8844" ns1 = "nameserver 127.0.0.1\nnameserver ::1\nnameserver 127.0.2.1" - if result, _ := FilterResolvDns([]byte(ns1), true); result != nil { + if result, _ := FilterResolvDNS([]byte(ns1), true); result != nil { if ns0 != string(result) { t.Fatalf("Failed no Localhost+IPv6 enabled: expected \n<%s> got \n<%s>", ns0, string(result)) } @@ -230,7 +230,7 @@ func TestFilterResolvDns(t *testing.T) { // with IPv6 disabled, and no non-localhost servers, Google defaults (only IPv4) should be added ns0 = "\nnameserver 8.8.8.8\nnameserver 8.8.4.4" ns1 = "nameserver 127.0.0.1\nnameserver ::1\nnameserver 127.0.2.1" - if result, _ := FilterResolvDns([]byte(ns1), false); result != nil { + if result, _ := FilterResolvDNS([]byte(ns1), false); result != nil { if ns0 != string(result) { t.Fatalf("Failed no Localhost+IPv6 enabled: expected \n<%s> got \n<%s>", ns0, string(result)) }