1package 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
7type 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// Routes can be specified to create entries in the route table as the container is started
54//
55// All of destination, source, and gateway should be either IPv4 or IPv6.
56// One of the three options must be present, and omitted entries will use their
57// IP family default for the route table.  For IPv4 for example, setting the
58// gateway to 1.2.3.4 and the interface to eth0 will set up a standard
59// destination of 0.0.0.0(or *) when viewed in the route table.
60type Route struct {
61	// Sets the destination and mask, should be a CIDR.  Accepts IPv4 and IPv6
62	Destination string `json:"destination"`
63
64	// Sets the source and mask, should be a CIDR.  Accepts IPv4 and IPv6
65	Source string `json:"source"`
66
67	// Sets the gateway.  Accepts IPv4 and IPv6
68	Gateway string `json:"gateway"`
69
70	// The device to set this route up for, for example: eth0
71	InterfaceName string `json:"interface_name"`
72}
73