1 package configs 2 3 // Network defines configuration for a container's networking stack 4 // 5 // The network configuration can be omitted from a container causing the 6 // container to be setup with the host's networking stack 7 type Network struct { 8 // Type sets the networks type, commonly veth and loopback 9 Type string `json:"type"` 10 11 // Name of the network interface 12 Name string `json:"name"` 13 14 // The bridge to use. 15 Bridge string `json:"bridge"` 16 17 // MacAddress contains the MAC address to set on the network interface 18 MacAddress string `json:"mac_address"` 19 20 // Address contains the IPv4 and mask to set on the network interface 21 Address string `json:"address"` 22 23 // Gateway sets the gateway address that is used as the default for the interface 24 Gateway string `json:"gateway"` 25 26 // IPv6Address contains the IPv6 and mask to set on the network interface 27 IPv6Address string `json:"ipv6_address"` 28 29 // IPv6Gateway sets the ipv6 gateway address that is used as the default for the interface 30 IPv6Gateway string `json:"ipv6_gateway"` 31 32 // Mtu sets the mtu value for the interface and will be mirrored on both the host and 33 // container's interfaces if a pair is created, specifically in the case of type veth 34 // Note: This does not apply to loopback interfaces. 35 Mtu int `json:"mtu"` 36 37 // TxQueueLen sets the tx_queuelen value for the interface and will be mirrored on both the host and 38 // container's interfaces if a pair is created, specifically in the case of type veth 39 // Note: This does not apply to loopback interfaces. 40 TxQueueLen int `json:"txqueuelen"` 41 42 // HostInterfaceName is a unique name of a veth pair that resides on in the host interface of the 43 // container. 44 HostInterfaceName string `json:"host_interface_name"` 45 46 // HairpinMode specifies if hairpin NAT should be enabled on the virtual interface 47 // bridge port in the case of type veth 48 // Note: This is unsupported on some systems. 49 // Note: This does not apply to loopback interfaces. 50 HairpinMode bool `json:"hairpin_mode"` 51 } 52 53 // Route defines a routing table entry. 54 // 55 // Routes can be specified to create entries in the routing table as the container 56 // is started. 57 // 58 // All of destination, source, and gateway should be either IPv4 or IPv6. 59 // One of the three options must be present, and omitted entries will use their 60 // IP family default for the route table. For IPv4 for example, setting the 61 // gateway to 1.2.3.4 and the interface to eth0 will set up a standard 62 // destination of 0.0.0.0(or *) when viewed in the route table. 63 type Route struct { 64 // Destination specifies the destination IP address and mask in the CIDR form. 65 Destination string `json:"destination"` 66 67 // Source specifies the source IP address and mask in the CIDR form. 68 Source string `json:"source"` 69 70 // Gateway specifies the gateway IP address. 71 Gateway string `json:"gateway"` 72 73 // InterfaceName specifies the device to set this route up for, for example eth0. 74 InterfaceName string `json:"interface_name"` 75 } 76