Documentation ¶
Index ¶
- func Connect(networkName string, cinfo *container.ContainerInfo) error
- func CreateNetwork(driver, subnet, name string) error
- func DeleteNetwork(networkName string) error
- func Disconnect(networkName string, cinfo *container.ContainerInfo) error
- func Init() error
- func ListNetwork()
- type BridgeNetworkDriver
- func (d *BridgeNetworkDriver) Connect(network *Network, endpoint *Endpoint) error
- func (d *BridgeNetworkDriver) Create(subnet string, name string) (*Network, error)
- func (d *BridgeNetworkDriver) Delete(network Network) error
- func (d *BridgeNetworkDriver) Disconnect(network Network, endpoint *Endpoint) error
- func (d *BridgeNetworkDriver) Name() string
- type Endpoint
- type IPAM
- type Network
- type NetworkDriver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
func Connect(networkName string, cinfo *container.ContainerInfo) error
连接容器到之前创建的网络 mydocker run net testnet -p 8080:80 xxxx
func Disconnect ¶
func Disconnect(networkName string, cinfo *container.ContainerInfo) error
Types ¶
type BridgeNetworkDriver ¶
type BridgeNetworkDriver struct { }
func (*BridgeNetworkDriver) Connect ¶
func (d *BridgeNetworkDriver) Connect(network *Network, endpoint *Endpoint) error
连接一个网络和网络端点
func (*BridgeNetworkDriver) Create ¶
func (d *BridgeNetworkDriver) Create(subnet string, name string) (*Network, error)
func (*BridgeNetworkDriver) Delete ¶
func (d *BridgeNetworkDriver) Delete(network Network) error
func (*BridgeNetworkDriver) Disconnect ¶
func (d *BridgeNetworkDriver) Disconnect(network Network, endpoint *Endpoint) error
func (*BridgeNetworkDriver) Name ¶
func (d *BridgeNetworkDriver) Name() string
type Endpoint ¶
type Endpoint struct { ID string `json:"id"` Device netlink.Veth `json:"dev"` IPAddress net.IP `json:"ip"` MacAddress net.HardwareAddr `json:"mac"` Network *Network PortMapping []string }
网络端点 包括连接到网络的一些信息, 比如地址Veth设备,端口映射,连接的容器和网络等信息 网络端点信息传输需要靠网络功能的两个组件配合完成,这两个组件分别为网络驱动(NetworkDriver)和IPAM
type IPAM ¶
type IPAM struct { // 分配文件存放位置 SubnetAllocatorPath string // 网段的位图算法的数组map, key是网段,value是分配的位图数组(记录的是分配的ip信息 Subnets *map[string]string }
type NetworkDriver ¶
type NetworkDriver interface { // 驱动名 Name() string // 创建网络 Create(subnet string, name string) (*Network, error) // 删除网络 Delete(network Network) error // 连接容器网络端点到网络 Connect(network *Network, endpoint *Endpoint) error // 从网络上一处容器网络端点 Disconnect(network Network, endpoint *Endpoint) error }
网络驱动
Click to show internal directories.
Click to hide internal directories.