Signed-off-by: Daniel Nephin <dnephin@gmail.com>
| ... | ... |
@@ -7,8 +7,8 @@ import ( |
| 7 | 7 |
"text/tabwriter" |
| 8 | 8 |
|
| 9 | 9 |
"github.com/docker/docker/api/types" |
| 10 |
+ "github.com/docker/docker/api/types/network" |
|
| 10 | 11 |
Cli "github.com/docker/docker/cli" |
| 11 |
- "github.com/docker/docker/daemon/network" |
|
| 12 | 12 |
"github.com/docker/docker/opts" |
| 13 | 13 |
flag "github.com/docker/docker/pkg/mflag" |
| 14 | 14 |
"github.com/docker/docker/pkg/stringid" |
| ... | ... |
@@ -10,8 +10,8 @@ import ( |
| 10 | 10 |
"github.com/Sirupsen/logrus" |
| 11 | 11 |
"github.com/docker/docker/api/server/httputils" |
| 12 | 12 |
"github.com/docker/docker/api/types" |
| 13 |
+ "github.com/docker/docker/api/types/network" |
|
| 13 | 14 |
"github.com/docker/docker/daemon" |
| 14 |
- "github.com/docker/docker/daemon/network" |
|
| 15 | 15 |
"github.com/docker/docker/pkg/parsers/filters" |
| 16 | 16 |
"github.com/docker/docker/runconfig" |
| 17 | 17 |
"github.com/docker/libnetwork" |
| 18 | 18 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,33 @@ |
| 0 |
+package network |
|
| 1 |
+ |
|
| 2 |
+// Address represents an IP address |
|
| 3 |
+type Address struct {
|
|
| 4 |
+ Addr string |
|
| 5 |
+ PrefixLen int |
|
| 6 |
+} |
|
| 7 |
+ |
|
| 8 |
+// IPAM represents IP Address Management |
|
| 9 |
+type IPAM struct {
|
|
| 10 |
+ Driver string |
|
| 11 |
+ Config []IPAMConfig |
|
| 12 |
+} |
|
| 13 |
+ |
|
| 14 |
+// IPAMConfig represents IPAM configurations |
|
| 15 |
+type IPAMConfig struct {
|
|
| 16 |
+ Subnet string `json:",omitempty"` |
|
| 17 |
+ IPRange string `json:",omitempty"` |
|
| 18 |
+ Gateway string `json:",omitempty"` |
|
| 19 |
+ AuxAddress map[string]string `json:"AuxiliaryAddresses,omitempty"` |
|
| 20 |
+} |
|
| 21 |
+ |
|
| 22 |
+// EndpointSettings stores the network endpoint details |
|
| 23 |
+type EndpointSettings struct {
|
|
| 24 |
+ EndpointID string |
|
| 25 |
+ Gateway string |
|
| 26 |
+ IPAddress string |
|
| 27 |
+ IPPrefixLen int |
|
| 28 |
+ IPv6Gateway string |
|
| 29 |
+ GlobalIPv6Address string |
|
| 30 |
+ GlobalIPv6PrefixLen int |
|
| 31 |
+ MacAddress string |
|
| 32 |
+} |
| ... | ... |
@@ -13,8 +13,8 @@ import ( |
| 13 | 13 |
"syscall" |
| 14 | 14 |
|
| 15 | 15 |
"github.com/Sirupsen/logrus" |
| 16 |
+ "github.com/docker/docker/api/types/network" |
|
| 16 | 17 |
"github.com/docker/docker/daemon/execdriver" |
| 17 |
- "github.com/docker/docker/daemon/network" |
|
| 18 | 18 |
derr "github.com/docker/docker/errors" |
| 19 | 19 |
"github.com/docker/docker/pkg/chrootarchive" |
| 20 | 20 |
"github.com/docker/docker/pkg/nat" |
| ... | ... |
@@ -13,6 +13,7 @@ import ( |
| 13 | 13 |
"time" |
| 14 | 14 |
|
| 15 | 15 |
"github.com/Sirupsen/logrus" |
| 16 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
| 16 | 17 |
"github.com/docker/docker/container" |
| 17 | 18 |
"github.com/docker/docker/daemon/execdriver" |
| 18 | 19 |
"github.com/docker/docker/daemon/links" |
| ... | ... |
@@ -440,7 +441,7 @@ func (daemon *Daemon) buildSandboxOptions(container *container.Container, n libn |
| 440 | 440 |
|
| 441 | 441 |
func (daemon *Daemon) updateNetworkSettings(container *container.Container, n libnetwork.Network) error {
|
| 442 | 442 |
if container.NetworkSettings == nil {
|
| 443 |
- container.NetworkSettings = &network.Settings{Networks: make(map[string]*network.EndpointSettings)}
|
|
| 443 |
+ container.NetworkSettings = &network.Settings{Networks: make(map[string]*networktypes.EndpointSettings)}
|
|
| 444 | 444 |
} |
| 445 | 445 |
|
| 446 | 446 |
if !container.HostConfig.NetworkMode.IsHost() && runconfig.NetworkMode(n.Type()).IsHost() {
|
| ... | ... |
@@ -466,7 +467,7 @@ func (daemon *Daemon) updateNetworkSettings(container *container.Container, n li |
| 466 | 466 |
return runconfig.ErrConflictNoNetwork |
| 467 | 467 |
} |
| 468 | 468 |
} |
| 469 |
- container.NetworkSettings.Networks[n.Name()] = new(network.EndpointSettings) |
|
| 469 |
+ container.NetworkSettings.Networks[n.Name()] = new(networktypes.EndpointSettings) |
|
| 470 | 470 |
|
| 471 | 471 |
return nil |
| 472 | 472 |
} |
| ... | ... |
@@ -550,8 +551,8 @@ func (daemon *Daemon) allocateNetwork(container *container.Container) error {
|
| 550 | 550 |
} |
| 551 | 551 |
networkName = n.Name() |
| 552 | 552 |
} |
| 553 |
- container.NetworkSettings.Networks = make(map[string]*network.EndpointSettings) |
|
| 554 |
- container.NetworkSettings.Networks[networkName] = new(network.EndpointSettings) |
|
| 553 |
+ container.NetworkSettings.Networks = make(map[string]*networktypes.EndpointSettings) |
|
| 554 |
+ container.NetworkSettings.Networks[networkName] = new(networktypes.EndpointSettings) |
|
| 555 | 555 |
updateSettings = true |
| 556 | 556 |
} |
| 557 | 557 |
|
| ... | ... |
@@ -812,7 +813,7 @@ func (daemon *Daemon) releaseNetwork(container *container.Container) {
|
| 812 | 812 |
sid := container.NetworkSettings.SandboxID |
| 813 | 813 |
networks := container.NetworkSettings.Networks |
| 814 | 814 |
for n := range networks {
|
| 815 |
- networks[n] = &network.EndpointSettings{}
|
|
| 815 |
+ networks[n] = &networktypes.EndpointSettings{}
|
|
| 816 | 816 |
} |
| 817 | 817 |
|
| 818 | 818 |
container.NetworkSettings = &network.Settings{Networks: networks}
|
| ... | ... |
@@ -5,6 +5,7 @@ import ( |
| 5 | 5 |
"time" |
| 6 | 6 |
|
| 7 | 7 |
"github.com/docker/docker/api/types" |
| 8 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
| 8 | 9 |
"github.com/docker/docker/api/types/versions/v1p20" |
| 9 | 10 |
"github.com/docker/docker/container" |
| 10 | 11 |
"github.com/docker/docker/daemon/exec" |
| ... | ... |
@@ -223,7 +224,7 @@ func (daemon *Daemon) getBackwardsCompatibleNetworkSettings(settings *network.Se |
| 223 | 223 |
|
| 224 | 224 |
// getDefaultNetworkSettings creates the deprecated structure that holds the information |
| 225 | 225 |
// about the bridge network for a container. |
| 226 |
-func (daemon *Daemon) getDefaultNetworkSettings(networks map[string]*network.EndpointSettings) types.DefaultNetworkSettings {
|
|
| 226 |
+func (daemon *Daemon) getDefaultNetworkSettings(networks map[string]*networktypes.EndpointSettings) types.DefaultNetworkSettings {
|
|
| 227 | 227 |
var settings types.DefaultNetworkSettings |
| 228 | 228 |
|
| 229 | 229 |
if defaultNetwork, ok := networks["bridge"]; ok {
|
| ... | ... |
@@ -1,26 +1,9 @@ |
| 1 | 1 |
package network |
| 2 | 2 |
|
| 3 |
-import "github.com/docker/docker/pkg/nat" |
|
| 4 |
- |
|
| 5 |
-// Address represents an IP address |
|
| 6 |
-type Address struct {
|
|
| 7 |
- Addr string |
|
| 8 |
- PrefixLen int |
|
| 9 |
-} |
|
| 10 |
- |
|
| 11 |
-// IPAM represents IP Address Management |
|
| 12 |
-type IPAM struct {
|
|
| 13 |
- Driver string |
|
| 14 |
- Config []IPAMConfig |
|
| 15 |
-} |
|
| 16 |
- |
|
| 17 |
-// IPAMConfig represents IPAM configurations |
|
| 18 |
-type IPAMConfig struct {
|
|
| 19 |
- Subnet string `json:",omitempty"` |
|
| 20 |
- IPRange string `json:",omitempty"` |
|
| 21 |
- Gateway string `json:",omitempty"` |
|
| 22 |
- AuxAddress map[string]string `json:"AuxiliaryAddresses,omitempty"` |
|
| 23 |
-} |
|
| 3 |
+import ( |
|
| 4 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
| 5 |
+ "github.com/docker/docker/pkg/nat" |
|
| 6 |
+) |
|
| 24 | 7 |
|
| 25 | 8 |
// Settings stores configuration details about the daemon network config |
| 26 | 9 |
// TODO Windows. Many of these fields can be factored out., |
| ... | ... |
@@ -30,22 +13,10 @@ type Settings struct {
|
| 30 | 30 |
HairpinMode bool |
| 31 | 31 |
LinkLocalIPv6Address string |
| 32 | 32 |
LinkLocalIPv6PrefixLen int |
| 33 |
- Networks map[string]*EndpointSettings |
|
| 33 |
+ Networks map[string]*networktypes.EndpointSettings |
|
| 34 | 34 |
Ports nat.PortMap |
| 35 | 35 |
SandboxKey string |
| 36 |
- SecondaryIPAddresses []Address |
|
| 37 |
- SecondaryIPv6Addresses []Address |
|
| 36 |
+ SecondaryIPAddresses []networktypes.Address |
|
| 37 |
+ SecondaryIPv6Addresses []networktypes.Address |
|
| 38 | 38 |
IsAnonymousEndpoint bool |
| 39 | 39 |
} |
| 40 |
- |
|
| 41 |
-// EndpointSettings stores the network endpoint details |
|
| 42 |
-type EndpointSettings struct {
|
|
| 43 |
- EndpointID string |
|
| 44 |
- Gateway string |
|
| 45 |
- IPAddress string |
|
| 46 |
- IPPrefixLen int |
|
| 47 |
- IPv6Gateway string |
|
| 48 |
- GlobalIPv6Address string |
|
| 49 |
- GlobalIPv6PrefixLen int |
|
| 50 |
- MacAddress string |
|
| 51 |
-} |
| ... | ... |
@@ -9,7 +9,7 @@ import ( |
| 9 | 9 |
"strings" |
| 10 | 10 |
|
| 11 | 11 |
"github.com/docker/docker/api/types" |
| 12 |
- "github.com/docker/docker/daemon/network" |
|
| 12 |
+ "github.com/docker/docker/api/types/network" |
|
| 13 | 13 |
"github.com/docker/docker/pkg/integration/checker" |
| 14 | 14 |
"github.com/docker/docker/pkg/parsers/filters" |
| 15 | 15 |
"github.com/go-check/check" |