Documentation ¶
Index ¶
- Constants
- func AddBridgeHCNNetwork(ctx context.Context, i *Network) (err error)
- func AddBridgeHNSNetwork(ctx context.Context, i *Network) (err error)
- func AddHCNEndpoint(ctx context.Context, i *Endpoint, netns, networkID string, ...) error
- func AddHCNHostEndpoint(ctx context.Context, i *Endpoint, netns, networkID string, ...) error
- func AddHCNNetwork(ctx context.Context, i *Network, decorates ...HCNNetworkDecorator) error
- func AddHNSEndpoint(ctx context.Context, i *Endpoint, netns, networkID, containerID string, ...) error
- func AddHNSHostEndpoint(ctx context.Context, i *Endpoint, netns, networkID, containerID string, ...) error
- func AddHNSNetwork(ctx context.Context, i *Network, decorates ...HNSNetworkDecorator) error
- func AddTransparentHCNNetwork(ctx context.Context, i *Network) (err error)
- func AddTransparentHNSNetwork(ctx context.Context, i *Network) (err error)
- func AddTunnelHCNNetwork(ctx context.Context, i *Network) (err error)
- func AddTunnelHNSNetwork(ctx context.Context, i *Network) (err error)
- func DeleteHCNEndpoint(ctx context.Context, i *Endpoint, netns string) (string, error)
- func DeleteHCNNetwork(ctx context.Context, i *Network) error
- func DeleteHCNNetworkIfEmpty(ctx context.Context, i *Network) error
- func DeleteHNSEndpoint(ctx context.Context, i *Endpoint, netns, containerID string) (string, error)
- func DeleteHNSNetwork(ctx context.Context, i *Network) error
- func DeleteHNSNetworkIfEmpty(ctx context.Context, i *Network) error
- func FromCommaList(s string) []string
- func GetDefaultBridgeNetworkGateway(subnet *net.IPNet) net.IP
- func GetDefaultNetworkGateway(subnet *net.IPNet) net.IP
- func GetHCNEndpointAvailableProtocolEnum(p string) (uint32, error)
- func GetHCNHostDefaultNamespace() (*hcn.HostComputeNamespace, error)
- func GetHCNNetworkByName(ctx context.Context, name string) (*hcn.HostComputeNetwork, error)
- func GetHCNNetworkIDByName(ctx context.Context, name string) (string, error)
- func GetHNSEndpointSandboxContainerID(netns string, containerID string) string
- func GetHNSNetworkByName(ctx context.Context, name string) (*hcsshim.HNSNetwork, error)
- func GetHNSNetworkIDByName(ctx context.Context, name string) (string, error)
- func IsDsrSupported() bool
- func IsHCNEndpointCorrupted(ep *hcn.HostComputeEndpoint, network string, addr net.IP) bool
- func IsHCNNetworkCorrupted(nw *hcn.HostComputeNetwork, nwAdapterName string, nwAdapterMac string, ...) bool
- func IsHCNSupported(netns string) bool
- func IsHNSEndpointCorrupted(ep *hcsshim.HNSEndpoint, network string, addr net.IP) bool
- func IsHNSEndpointSandbox(netns string) bool
- func IsHNSNetworkCorrupted(nw *hcsshim.HNSNetwork, nwAdapterName string, nwAdapterMac string, ...) bool
- func ParseHCNNetworkManagementIP(nw *hcn.HostComputeNetwork) net.IP
- func ParseHNSNetworkManagementIP(nw *hcsshim.HNSNetwork) net.IP
- func ToCommaList(elems []string) string
- type APIVersion
- type Endpoint
- type HCNEndpointDecorator
- func ApplyHCNEndpointEncapsulatedRoutePolicy(destinationIPNets ...*net.IPNet) HCNEndpointDecorator
- func ApplyHCNEndpointLoopbackDsrPolicy() HCNEndpointDecorator
- func ApplyHCNEndpointOutboundNatPolicy(exceptionIPNets ...*net.IPNet) HCNEndpointDecorator
- func ApplyHCNEndpointPortMappingPolicy(protocol string, containerPort int, hostPort int, hostIP string) HCNEndpointDecorator
- type HCNNetworkDecorator
- type HNSEndpointDecorator
- func ApplyHNSEndpointEncapsulatedRoutePolicy(destinationIPNets ...*net.IPNet) HNSEndpointDecorator
- func ApplyHNSEndpointLoopbackDsrPolicy() HNSEndpointDecorator
- func ApplyHNSEndpointOutboundNatPolicy(exceptionIPNets ...*net.IPNet) HNSEndpointDecorator
- func ApplyHNSEndpointPortMappingPolicy(protocol string, containerPort int, hostPort int, hostIP string) HNSEndpointDecorator
- type HNSNetworkDecorator
- type Network
Constants ¶
const TypeOfBridgeNetwork = "L2Bridge"
const TypeOfTransparentNetwork = "Transparent"
const TypeOfTunnelNetwork = "L2Tunnel"
Variables ¶
This section is empty.
Functions ¶
func AddBridgeHCNNetwork ¶
AddBridgeHCNNetwork parses the given Network to a target HNS v2(HCN api) bridge network object, and brings it up.
func AddBridgeHNSNetwork ¶
AddBridgeHNSNetwork parses the given Network to a target HNS v1 bridge network object, and brings it up.
func AddHCNEndpoint ¶
func AddHCNEndpoint(ctx context.Context, i *Endpoint, netns, networkID string, decorates ...HCNEndpointDecorator) error
AddHCNEndpoint parses the given Endpoint to a target HNS v2(HCN api) endpoint object, and adds it to given netns, or returns error.
func AddHCNHostEndpoint ¶
func AddHCNHostEndpoint(ctx context.Context, i *Endpoint, netns, networkID string, decorates ...HCNEndpointDecorator) error
AddHCNHostEndpoint parses the given Endpoint to a target HNS v2(HCN api) endpoint object, and adds it to given nets, or returns error.
func AddHCNNetwork ¶
func AddHCNNetwork(ctx context.Context, i *Network, decorates ...HCNNetworkDecorator) error
AddHCNNetwork parses the given Network to a target HNS v2(HCN api) network object, and brings it up.
func AddHNSEndpoint ¶
func AddHNSEndpoint(ctx context.Context, i *Endpoint, netns, networkID, containerID string, decorates ...HNSEndpointDecorator) error
AddHNSEndpoint parses the given Endpoint to a target HNS v1 endpoint object, and adds it to given netns, or returns error.
func AddHNSHostEndpoint ¶
func AddHNSHostEndpoint(ctx context.Context, i *Endpoint, netns, networkID, containerID string, decorates ...HNSEndpointDecorator) error
AddHNSHostEndpoint parses the given Endpoint to a target HNS v1 endpoint object, and adds it to given netns, or returns error.
func AddHNSNetwork ¶
func AddHNSNetwork(ctx context.Context, i *Network, decorates ...HNSNetworkDecorator) error
AddHNSNetwork parses the given Network to a target HNS v1 network object, and brings it up.
func AddTransparentHCNNetwork ¶
AddTransparentHCNNetwork parses the given Network to a target HNS v2(HCN api) transparent network object, and brings it up.
func AddTransparentHNSNetwork ¶
AddTransparentHNSNetwork parses the given Network to a target HNS v1 transparent network object, and brings it up.
func AddTunnelHCNNetwork ¶
AddTunnelHCNNetwork parses the given Network to a target HNS v2(HCN api) bridge network object, and brings it up.
func AddTunnelHNSNetwork ¶
AddTunnelHNSNetwork parses the given Network to a target HNS v1 bridge network object, and brings it up.
func DeleteHCNEndpoint ¶
DeleteHCNEndpoint deletes the target HNS v2(HCN api) endpoint object related to the given Endpoint, and returns the related HNS v2(HCN api) network ID.
func DeleteHCNNetwork ¶
DeleteHCNNetwork deletes the target HNS v2(HCN api) network object related to the given Network.
func DeleteHCNNetworkIfEmpty ¶
DeleteHCNNetworkIfEmpty deletes the target HNS v2(HCN api) network object related to the given Network if no attaching endpoints.
func DeleteHNSEndpoint ¶
DeleteHNSEndpoint deletes the target HNS v1 endpoint object related to the given Endpoint, and returns the related HNS v1 network ID.
func DeleteHNSNetwork ¶
DeleteHNSNetwork deletes the target HNS v1 network object related to the given Network.
func DeleteHNSNetworkIfEmpty ¶
DeleteHNSNetworkIfEmpty deletes the target HNS v1 network object related to the given Network if no attaching endpoints.
func FromCommaList ¶
func GetDefaultBridgeNetworkGateway ¶
GetDefaultBridgeNetworkGateway returns the default gateway address of the given bridge subnet.
func GetDefaultNetworkGateway ¶
GetDefaultNetworkGateway returns the default gateway address of the given subnet.
func GetHCNHostDefaultNamespace ¶
func GetHCNHostDefaultNamespace() (*hcn.HostComputeNamespace, error)
func GetHCNNetworkByName ¶
GetHCNNetworkByName returns the HNS v2(HCN api) network object by the given name.
func GetHCNNetworkIDByName ¶
GetHCNNetworkIDByName returns the HNS v2(HCN api) network ID by the given name.
func GetHNSNetworkByName ¶
GetHNSNetworkByName returns the HNS v1 network obj by the given name.
func GetHNSNetworkIDByName ¶
GetHNSNetworkIDByName returns the HNS v1 network ID with given name.
func IsDsrSupported ¶
func IsDsrSupported() bool
func IsHCNEndpointCorrupted ¶
func IsHCNNetworkCorrupted ¶
func IsHCNSupported ¶
func IsHNSEndpointCorrupted ¶
func IsHNSEndpointSandbox ¶
func IsHNSNetworkCorrupted ¶
func ParseHCNNetworkManagementIP ¶
func ParseHCNNetworkManagementIP(nw *hcn.HostComputeNetwork) net.IP
func ParseHNSNetworkManagementIP ¶
func ParseHNSNetworkManagementIP(nw *hcsshim.HNSNetwork) net.IP
func ToCommaList ¶
Types ¶
type APIVersion ¶
type APIVersion string
const ( HNS APIVersion = "v1" HNS_V2 APIVersion = "v2" HCN = HNS_V2 )
type Endpoint ¶
type Endpoint struct { // Name specifies the name of the endpoint. Name string // Address specifies the IP address of the endpoint, included IP mask. Address net.IPNet // MAC specifies the MAC address of the endpoint, // it's optional. MAC string // DNS specifies the DNS configuration of the endpoint. DNS types.DNS // MTU specifies the size of MTU in network, // it's optional, default is `1500`. MTU int // Gateway specifies the IP address of the next hop for the endpoint. Gateway net.IP // ID specifies the id of the endpoint, // it's observed at creation. ID string }
Endpoint describes the information of an HNS v1/v2(HCN api) endpoint object.
type HCNEndpointDecorator ¶
type HCNEndpointDecorator func(*hcn.HostComputeEndpoint) error
HCNEndpointDecorator is a function to decorate the given HNS v2(HCN api) endpoint object before creating.
func ApplyHCNEndpointEncapsulatedRoutePolicy ¶
func ApplyHCNEndpointEncapsulatedRoutePolicy(destinationIPNets ...*net.IPNet) HCNEndpointDecorator
ApplyHCNEndpointEncapsulatedRoutePolicy applies the destination encapsulated route policy to the creating HNS v2(HCN api) endpoint object.
func ApplyHCNEndpointLoopbackDsrPolicy ¶
func ApplyHCNEndpointLoopbackDsrPolicy() HCNEndpointDecorator
ApplyHCNEndpointLoopbackDsrPolicy applies the loopback DSR policy to the creating HNS v2(HCN api) endpoint object.
func ApplyHCNEndpointOutboundNatPolicy ¶
func ApplyHCNEndpointOutboundNatPolicy(exceptionIPNets ...*net.IPNet) HCNEndpointDecorator
ApplyHCNEndpointOutboundNatPolicy applies the outbound NAT policy to the creating HNS v2(HCN api) endpoint object.
func ApplyHCNEndpointPortMappingPolicy ¶
func ApplyHCNEndpointPortMappingPolicy(protocol string, containerPort int, hostPort int, hostIP string) HCNEndpointDecorator
ApplyHCNEndpointPortMappingPolicy applies the port mapping policy to the creating HNS v2(HCN api) endpoint object.
type HCNNetworkDecorator ¶
type HCNNetworkDecorator func(*hcn.HostComputeNetwork) error
HCNNetworkDecorator is a function to decorate the given HNS v2(HCN api) network object before creating.
type HNSEndpointDecorator ¶
type HNSEndpointDecorator func(*hcsshim.HNSEndpoint) error
HNSEndpointDecorator is a function to decorate the given HNS v1 endpoint object before creating.
func ApplyHNSEndpointEncapsulatedRoutePolicy ¶
func ApplyHNSEndpointEncapsulatedRoutePolicy(destinationIPNets ...*net.IPNet) HNSEndpointDecorator
ApplyHNSEndpointEncapsulatedRoutePolicy applies the destination encapsulated route policy to the creating HNS v1 endpoint object.
func ApplyHNSEndpointLoopbackDsrPolicy ¶
func ApplyHNSEndpointLoopbackDsrPolicy() HNSEndpointDecorator
ApplyHNSEndpointLoopbackDsrPolicy applies the loopback DSR policy to the creating HNS v1 endpoint object.
func ApplyHNSEndpointOutboundNatPolicy ¶
func ApplyHNSEndpointOutboundNatPolicy(exceptionIPNets ...*net.IPNet) HNSEndpointDecorator
ApplyHNSEndpointOutboundNatPolicy applies the outbound NAT policy to the creating HNS v1 endpoint object.
func ApplyHNSEndpointPortMappingPolicy ¶
func ApplyHNSEndpointPortMappingPolicy(protocol string, containerPort int, hostPort int, hostIP string) HNSEndpointDecorator
ApplyHNSEndpointPortMappingPolicy applies the port mapping policy to the creating HNS v1 endpoint object.
type HNSNetworkDecorator ¶
type HNSNetworkDecorator func(*hcsshim.HNSNetwork) error
HNSNetworkDecorator is a function to decorate the given HNS v1 network object before creating.
type Network ¶
type Network struct { // Type specifies the type of the network. Type string // Name specifies the name of the network. Name string // AdapterName specifies the physical adapter name of the network. AdapterName string // AdapterMAC specifies the physical adapter MAC of the network. AdapterMAC string // Subnet specifies the allocated IP range of the network. Subnet net.IPNet // DNS specifies the DNS configuration of the network. DNS types.DNS // MTU specifies the size of MTU in network, // it's optional, default is `1500`. MTU int // Gateway specifies the IP address of the next hop for the network, // it's optional, default is the first index IP of the subnet. Gateway net.IP // ID specifies the id of the network, // it's observed at creation. ID string // contains filtered or unexported fields }
func (*Network) Format ¶
func (nw *Network) Format(version APIVersion) string