diff --git a/lib/http/network/connected.go b/lib/http/network/connected.go index 81f241a..b5a9e70 100644 --- a/lib/http/network/connected.go +++ b/lib/http/network/connected.go @@ -3,31 +3,23 @@ package network import ( "encoding/json" "floares/config" + "floares/lib/model" "log" "net/http" "time" ) type Inspect struct { - Name string `json:"Name"` - Id string `json:"Id"` - Created time.Time `json:"Created"` - Scope string `json:"Scope"` - Driver string `json:"Driver"` - EnableIPv6 bool `json:"EnableIPv6"` - IPAM struct { - Driver string `json:"Driver"` - Options struct { - Driver string `json:"driver"` - } `json:"Options"` - Config []struct { - Subnet string `json:"Subnet"` - Gateway string `json:"Gateway"` - } `json:"Config"` - } `json:"IPAM"` - Internal bool `json:"Internal"` - Attachable bool `json:"Attachable"` - Ingress bool `json:"Ingress"` + Name string `json:"Name"` + Id string `json:"Id"` + Created time.Time `json:"Created"` + Scope string `json:"Scope"` + Driver string `json:"Driver"` + EnableIPv6 bool `json:"EnableIPv6"` + IPAM model.IPAM `json:"IPAM"` + Internal bool `json:"Internal"` + Attachable bool `json:"Attachable"` + Ingress bool `json:"Ingress"` ConfigFrom struct { Network string `json:"Network"` } `json:"ConfigFrom"` @@ -55,5 +47,6 @@ func GetInspect(ns string) (net Inspect) { return } err = json.NewDecoder(res.Body).Decode(&net) + return } diff --git a/lib/model/network.go b/lib/model/network.go index 2770765..5d4406a 100644 --- a/lib/model/network.go +++ b/lib/model/network.go @@ -9,19 +9,10 @@ type NetWorkJson struct { Scope string `json:"Scope"` Driver string `json:"Driver"` EnableIPv6 bool `json:"EnableIPv6"` - IPAM struct { - Driver string `json:"Driver"` - Options struct { - Driver string `json:"driver"` - } `json:"Options"` - Config []struct { - Subnet string `json:"Subnet"` - Gateway string `json:"Gateway"` - } `json:"Config"` - } `json:"IPAM"` - Internal bool `json:"Internal"` - Attachable bool `json:"Attachable"` - Ingress bool `json:"Ingress"` + IPAM IPAM `json:"IPAM"` + Internal bool `json:"Internal"` + Attachable bool `json:"Attachable"` + Ingress bool `json:"Ingress"` ConfigFrom struct { Network string `json:"Network"` } `json:"ConfigFrom"` @@ -45,3 +36,28 @@ type Config struct { Subnet string `json:"subnet"` Gateway string `json:"gateway"` } +type IPAM struct { + Driver string `json:"Driver"` + Options struct { + Driver string `json:"driver"` + } `json:"Options"` + Config []struct { + Subnet string `json:"Subnet"` + Gateway string `json:"Gateway"` + } `json:"Config"` +} +type NetworkInspect struct { + Name string `json:"name"` + Id string `json:"id"` + Created string `json:"created"` + Driver string `json:"driver"` + + Ipam Config `json:"ipam"` + Containers +} +type NetConnect struct { + Name string `json:"name"` + Id string `json:"id"` + Ip string `json:"ip"` + Mac string `json:"mac"` +} diff --git a/tmp/runner-build b/tmp/runner-build index 118b8e5..8667e75 100755 Binary files a/tmp/runner-build and b/tmp/runner-build differ