Documentation
¶
Index ¶
- type Endpoint
- type SetEndpointSettingsFn
- func Aliases(aliases ...string) SetEndpointSettingsFn
- func DriverOpt(key, value string) SetEndpointSettingsFn
- func EndpointID(id string) SetEndpointSettingsFn
- func IPAMConfig(ipv4 string, ipv6 string, linkLocalIPs []string) SetEndpointSettingsFn
- func IPv4Address(addr string) SetEndpointSettingsFn
- func IPv4Gateway(gateway string) SetEndpointSettingsFn
- func IPv4PrefixLen(prefixLen int) SetEndpointSettingsFn
- func IPv6Address(addr string) SetEndpointSettingsFn
- func IPv6Gateway(gateway string) SetEndpointSettingsFn
- func IPv6PrefixLen(prefixLen int) SetEndpointSettingsFn
- func Links(links ...string) SetEndpointSettingsFn
- func MacAddress(mac string) SetEndpointSettingsFn
- func NetworkID(id string) SetEndpointSettingsFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶
type Endpoint struct {
Settings *network.EndpointSettings
}
Endpoint represents a network endpoint configuration
func (*Endpoint) SetEndpointSetting ¶
func (ew *Endpoint) SetEndpointSetting(setEpSFns ...SetEndpointSettingsFn)
SetEndpointSetting applies the provided endpoint settings
type SetEndpointSettingsFn ¶
type SetEndpointSettingsFn func(settings *network.EndpointSettings)
func Aliases ¶
func Aliases(aliases ...string) SetEndpointSettingsFn
Aliases adds DNS aliases for the endpoint. Aliases allow the container to be discovered using additional names.
Usage example:
endpoint := endpointoptions.NewEndpoint()
endpoint.SetEndpointSetting(
endpointoptions.Aliases("web", "api"),
)
func DriverOpt ¶
func DriverOpt(key, value string) SetEndpointSettingsFn
DriverOpt adds a driver-specific option to the endpoint settings.
Usage example:
endpoint := endpointoptions.NewEndpoint()
endpoint.SetEndpointSetting(
endpointoptions.DriverOpt("com.docker.network.driver.mtu", "1500"),
)
func EndpointID ¶
func EndpointID(id string) SetEndpointSettingsFn
EndpointID sets the ID for this endpoint.
Usage example:
endpoint := endpointoptions.NewEndpoint()
endpoint.SetEndpointSetting(
endpointoptions.EndpointID("e2309rj203j"),
)
func IPAMConfig ¶
func IPAMConfig(ipv4 string, ipv6 string, linkLocalIPs []string) SetEndpointSettingsFn
IPAMConfig sets the IPAM configuration for this endpoint. This allows you to specify static IP addresses for the endpoint.
Usage example:
endpoint := endpointoptions.NewEndpoint()
endpoint.SetEndpointSetting(
endpointoptions.IPAMConfig(
"172.20.0.2", // IPv4 Address
"2001:db8::2", // IPv6 Address
[]string{"fe80::1", "fe80::2"}, // Link-local IPs
),
)
func IPv4Address ¶
func IPv4Address(addr string) SetEndpointSettingsFn
IPv4Address sets the IPv4 address for the endpoint.
Usage example:
endpoint := endpointoptions.NewEndpoint()
endpoint.SetEndpointSetting(
endpointoptions.IPv4Address("172.20.0.2"),
)
func IPv4Gateway ¶
func IPv4Gateway(gateway string) SetEndpointSettingsFn
IPv4Gateway sets the IPv4 gateway for the endpoint.
Usage example:
endpoint := endpointoptions.NewEndpoint()
endpoint.SetEndpointSetting(
endpointoptions.IPv4Gateway("172.20.0.1"),
)
func IPv4PrefixLen ¶
func IPv4PrefixLen(prefixLen int) SetEndpointSettingsFn
IPv4PrefixLen sets the IPv4 subnet prefix length for the endpoint.
Usage example:
endpoint := endpointoptions.NewEndpoint() endpoint.SetEndpointSetting( endpointoptions.IPv4PrefixLen(24), // for a /24 subnet )
func IPv6Address ¶
func IPv6Address(addr string) SetEndpointSettingsFn
IPv6Address sets the IPv6 address for the endpoint.
Usage example:
endpoint := endpointoptions.NewEndpoint()
endpoint.SetEndpointSetting(
endpointoptions.IPv6Address("2001:db8::2"),
)
func IPv6Gateway ¶
func IPv6Gateway(gateway string) SetEndpointSettingsFn
IPv6Gateway sets the IPv6 gateway for the endpoint.
Usage example:
endpoint := endpointoptions.NewEndpoint()
endpoint.SetEndpointSetting(
endpointoptions.IPv6Gateway("2001:db8::1"),
)
func IPv6PrefixLen ¶
func IPv6PrefixLen(prefixLen int) SetEndpointSettingsFn
IPv6PrefixLen sets the IPv6 subnet prefix length for the endpoint.
Usage example:
endpoint := endpointoptions.NewEndpoint() endpoint.SetEndpointSetting( endpointoptions.IPv6PrefixLen(64), // for a /64 subnet )
func Links ¶
func Links(links ...string) SetEndpointSettingsFn
Links adds container links to the endpoint. Links allow containers to discover and securely communicate with each other.
Usage example:
endpoint := endpointoptions.NewEndpoint()
endpoint.SetEndpointSetting(
endpointoptions.Links("redis:cache", "postgres:db"),
)
func MacAddress ¶
func MacAddress(mac string) SetEndpointSettingsFn
MacAddress sets the MAC address for the endpoint.
Usage example:
endpoint := endpointoptions.NewEndpoint()
endpoint.SetEndpointSetting(
endpointoptions.MacAddress("02:42:ac:11:00:02"),
)
func NetworkID ¶
func NetworkID(id string) SetEndpointSettingsFn
NetworkID sets the ID of the network this endpoint belongs to.
Usage example:
endpoint := endpointoptions.NewEndpoint()
endpoint.SetEndpointSetting(
endpointoptions.NetworkID("n1230984jf02jf"),
)