networkoptions

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SetContainerNetworkOptFn

type SetContainerNetworkOptFn func(options *network.NetworkingConfig)

FOR ENDPOINTS ON CONTAINER CREATION

func Endpoint

func Endpoint(name string, endpoint *endpointoptions.Endpoint) SetContainerNetworkOptFn

Adds a networking endpoint option for the networking configuration.

type SetNetworkOptions

type SetNetworkOptions func(options *network.CreateOptions)

SetNetworkOptions is a function type for configuring options when creating a Docker network.

func Attachable

func Attachable() SetNetworkOptions

Attachable sets whether the Docker network is attachable. Use this function to specify if other containers can attach to this network.

func ConfigFrom

func ConfigFrom(net fmt.Stringer) SetNetworkOptions

ConfigFrom specifies the source which provides a network's configuration

func ConfigOnly

func ConfigOnly() SetNetworkOptions

ConfigOnly sets whether the Docker network is a config-only network. Use this function to indicate if the network is only used for storing service configuration details.

func Driver

func Driver(name string) SetNetworkOptions

Driver sets the network driver to be used when creating the Docker network. Use this function to specify the network driver that will manage the network's communication.

func EnableIPV6

func EnableIPV6(enable bool) SetNetworkOptions

EnableIPV6 sets whether IPv6 support should be enabled for the Docker network. Use this function to indicate if IPv6 support should be enabled for network communication.

func IPAMConfig

func IPAMConfig(subnet, ipRange, gateway string) SetNetworkOptions

IPAMConfig adds an IPAM configuration for a subnet. This allows you to configure subnet, IP range, and gateway for the network.

Usage example:

myNetwork := network.NewConfig("my_network")
myNetwork.SetNetworkOptions(
	networkoptions.IPAMConfig("172.20.0.0/16", "172.20.10.0/24", "172.20.10.11"),
)

func IPAMDriver

func IPAMDriver(driver string) SetNetworkOptions

IPAMDriver sets the IPAM driver for the network. This configures which driver will handle IP address management.

Usage example:

myNetwork := network.NewConfig("my_network")
myNetwork.SetNetworkOptions(
	networkoptions.IPAMDriver("default"),
)

func IPAMOptions

func IPAMOptions(key, value string) SetNetworkOptions

IPAMOptions adds IPAM driver specific options. This allows you to set custom options for the IPAM driver.

Usage example:

myNetwork := network.NewConfig("my_network")
myNetwork.SetNetworkOptions(
	networkoptions.IPAMOptions("opt1", "value1"),
)

func Ingress

func Ingress() SetNetworkOptions

Ingress sets whether the Docker network is an ingress network. Use this function to indicate if the network is the ingress network used for routing externally.

func Internal

func Internal() SetNetworkOptions

Internal sets whether the Docker network is intended to be internal. Use this function to define whether the network should only be accessible within the host environment. If set to true, the network is restricted to communication within containers on the same host. If set to false (the default), the network can allow communication between containers across different hosts.

func Label

func Label(key, value string) SetNetworkOptions

Label sets labels for the Docker network during creation. Use this function to assign custom labels to the network for better organization and identification. Labels are key-value pairs that can provide metadata and context to the network.

func Labels

func Labels(labels map[string]string) SetNetworkOptions

Labels sets multiple labels at once for the network. This is a convenience function when you need to set multiple labels.

Usage example:

labels := map[string]string{
	"environment": "production",
	"project": "myapp",
}
myNetwork := network.NewConfig("my_network")
myNetwork.SetNetworkOptions(
	networkoptions.Labels(labels),
)

func Options

func Options(key, value string) SetNetworkOptions

Options sets custom options for the Docker network during creation. Use this function to provide additional key-value pairs for network configuration. These options allow you to customize specific behaviors and settings of the network.

func Scope

func Scope(scope string) SetNetworkOptions

Scope sets the scope of the Docker network. Use this function to define the network's scope, such as "local" or "global".

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL