configitems

package
v0.0.0-...-4fbc73c Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// PhysIfTypename : typename for physical network interfaces.
	PhysIfTypename = "Physical-Interface"
	// IfHandleTypename : typename for network interface handle.
	IfHandleTypename = "Interface-Handle"
	// NetNamespaceTypename : typename for network namespaces.
	NetNamespaceTypename = "Network-Namespace"
	// BondTypename : typename for bond interface.
	BondTypename = "Bond"
	// BridgeTypename : typename for bridges.
	BridgeTypename = "Bridge"
	// BridgeTypename : typename for veths.
	VethTypename = "Veth"
	// SysctlTypename : typename for item representing kernel
	// parameters set using sysctl for a given net namespace.
	SysctlTypename = "Sysctl"
	// DhcpClientTypename : typename for DHCP/DHCPv6 client.
	DhcpClientTypename = "DHCP-Client"
	// DhcpServerTypename : typename for DHCP/DHCPv6 server.
	DhcpServerTypename = "DHCP-Server"
	// DnsServerTypename : typename for DNS server.
	DnsServerTypename = "DNS-Server"
	// RouteTypename : typename for IP route.
	RouteTypename = "Route"
	// IPRuleTypename : typename for IP rule.
	IPRuleTypename = "IP-Rule"
	// IPtablesChainTypename : typename for a single iptables chain (IPv4).
	IPtablesChainTypename = "Iptables-Chain"
	// IP6tablesChainTypename : typename for a single ip6tables chain (IPv6).
	IP6tablesChainTypename = "Ip6tables-Chain"
	// HTTPProxyTypename : typename for HTTP proxy.
	HTTPProxyTypename = "HTTP-Proxy"
	// HTTPServerTypename : typename for HTTP server.
	HTTPServerTypename = "HTTP-Server"
	// TrafficControlTypename : typename for TC rules applied to physical interface.
	TrafficControlTypename = "Traffic-Control"
)
View Source
const (
	// Symbolic name for the main network namespace (where SDN agent operates).
	MainNsName = "main"
)

Variables

This section is empty.

Functions

func RegisterItems

func RegisterItems(
	registry *reconciler.DefaultRegistry, macLookup *maclookup.MacLookup) error

RegisterItems : register all configurators implemented by this package.

Types

type Bond

type Bond struct {
	api.Bond
	// IfName : name of the Bond interface in the OS.
	IfName string
	// AggregatedPhysIfs : list of physical interfaces aggregated by this bond.
	AggregatedPhysIfs []PhysIf
}

Bond : Bond interface.

func (Bond) Dependencies

func (b Bond) Dependencies() (deps []depgraph.Dependency)

Dependencies lists all aggregated interfaces as dependencies.

func (Bond) Equal

func (b Bond) Equal(other depgraph.Item) bool

Equal is a comparison method for two equally-named Bond instances.

func (Bond) External

func (b Bond) External() bool

External returns false.

func (Bond) Label

func (b Bond) Label() string

Label

func (Bond) Name

func (b Bond) Name() string

Name

func (Bond) String

func (b Bond) String() string

String describes Bond interface.

func (Bond) Type

func (b Bond) Type() string

Type

type BondConfigurator

type BondConfigurator struct {
	MacLookup *maclookup.MacLookup
}

BondConfigurator implements Configurator interface for bond interfaces.

func (*BondConfigurator) Create

func (c *BondConfigurator) Create(ctx context.Context, item depgraph.Item) error

Create adds new Bond interface.

func (*BondConfigurator) Delete

func (c *BondConfigurator) Delete(ctx context.Context, item depgraph.Item) error

Delete removes bond interface.

func (*BondConfigurator) Modify

func (c *BondConfigurator) Modify(ctx context.Context, oldItem, newItem depgraph.Item) (err error)

Modify is able to change the set of aggregated interfaces.

func (*BondConfigurator) NeedsRecreate

func (c *BondConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate returns true if Bond attributes have changed. The set of aggregated interfaces can be changed without recreating Bond.

type Bridge

type Bridge struct {
	// IfName : name of the Bridge in the OS.
	IfName string
	// LogicalLabel : label used within the network model.
	LogicalLabel string
	// PhysIfs : physical interfaces to put under the bridge.
	PhysIfs []PhysIf
	// BondIfs : *interface names* of bonds to put under the bridge.
	BondIfs []string
	// VLANs : list of VLANs used with this bridge.
	// If empty then this bridge is used without VLAN filtering.
	VLANs []uint16
}

Bridge : Linux bridge.

func (Bridge) Dependencies

func (b Bridge) Dependencies() (deps []depgraph.Dependency)

Dependencies lists all bridged interfaces as dependencies.

func (Bridge) Equal

func (b Bridge) Equal(other depgraph.Item) bool

Equal is a comparison method for two equally-named Bridge instances.

func (Bridge) External

func (b Bridge) External() bool

External returns false.

func (Bridge) Label

func (b Bridge) Label() string

Label

func (Bridge) Name

func (b Bridge) Name() string

Name

func (Bridge) String

func (b Bridge) String() string

String describes Bridge.

func (Bridge) Type

func (b Bridge) Type() string

Type

type BridgeConfigurator

type BridgeConfigurator struct {
	MacLookup *maclookup.MacLookup
}

BridgeConfigurator implements Configurator interface for bond interfaces.

func (*BridgeConfigurator) Create

func (c *BridgeConfigurator) Create(ctx context.Context, item depgraph.Item) error

Create adds new Bridge.

func (*BridgeConfigurator) Delete

func (c *BridgeConfigurator) Delete(ctx context.Context, item depgraph.Item) error

Delete removes bridge.

func (*BridgeConfigurator) Modify

func (c *BridgeConfigurator) Modify(ctx context.Context, oldItem, newItem depgraph.Item) (err error)

Modify is able to change the set of bridged interfaces.

func (*BridgeConfigurator) NeedsRecreate

func (c *BridgeConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate returns false. The set of bridged interfaces can be changed without recreating bridge.

type DhcpClient

type DhcpClient struct {
	// PhysIf : physical interface to associate the client with.
	PhysIf PhysIf
	// LogFile : where to put dhcpcd logs.
	LogFile string
}

DhcpClient : DHCP client (this one: https://wiki.archlinux.org/title/dhcpcd). Can be only used with physical network interface (not with virtual interfaces like VETH).

func (DhcpClient) Dependencies

func (c DhcpClient) Dependencies() (deps []depgraph.Dependency)

Dependencies lists the IfHandle as the only dependency of the DHCP client.

func (DhcpClient) Equal

func (c DhcpClient) Equal(other depgraph.Item) bool

Equal is a comparison method for two equally-named DhcpClient instances.

func (DhcpClient) External

func (c DhcpClient) External() bool

External returns false.

func (DhcpClient) Label

func (c DhcpClient) Label() string

Label

func (DhcpClient) Name

func (c DhcpClient) Name() string

Name

func (DhcpClient) String

func (c DhcpClient) String() string

String describes the DHCP client config.

func (DhcpClient) Type

func (c DhcpClient) Type() string

Type

type DhcpClientConfigurator

type DhcpClientConfigurator struct {
	MacLookup *maclookup.MacLookup
}

DhcpClientConfigurator implements Configurator interface for DhcpClient.

func (*DhcpClientConfigurator) Create

Create starts dhcpcd.

func (*DhcpClientConfigurator) Delete

Delete stops dhcpcd.

func (*DhcpClientConfigurator) Modify

func (c *DhcpClientConfigurator) Modify(ctx context.Context, oldItem, newItem depgraph.Item) (err error)

Modify is not implemented.

func (*DhcpClientConfigurator) NeedsRecreate

func (c *DhcpClientConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate always returns true - Modify is not implemented.

type DhcpServer

type DhcpServer struct {
	// ServerName : logical name for the DHCP server.
	ServerName string
	// NetNamespace : network namespace where the server should be running.
	NetNamespace string
	// VethName : logical name of the veth pair on which the server operates.
	// (other types of interfaces are currently not supported)
	VethName string
	// VethPeerIfName : interface name of that side of the veth pair on which
	// the server should listen. It should be inside NetNamespace.
	VethPeerIfName string
	// Subnet : network address + netmask (IPv4 or IPv6).
	Subnet *net.IPNet
	// IPRange : a range of IP addresses to allocate from.
	// Not applicable for IPv6 (SLAAC is used instead).
	IPRange IPRange
	// StaticEntries : list of MAC->IP entries statically configured for the DHCP server.
	StaticEntries []MACToIP
	// GatewayIP : address of the default gateway to advertise (DHCP option 3).
	GatewayIP net.IP
	// DomainName : name of the domain assigned to the network.
	// It is propagated to clients using the DHCP option 15 (24 in DHCPv6).
	DomainName string
	// DNSServers : list of IP addresses of DNS servers to announce via DHCP option 6.
	DNSServers []net.IP
	// NTP server to announce via DHCP option 42 (56 in DHCPv6).
	// Optional argument, leave empty to disable.
	NTPServer string
	// WPAD : URL with a location of a PAC file, announced using the Web Proxy Auto-Discovery
	// Protocol (WPAD) and DHCP.
	// The client will learn the PAC file location using the DHCP option 252.
	// Optional argument, leave empty to disable.
	WPAD string
}

DhcpServer : DHCP server.

func (DhcpServer) Dependencies

func (s DhcpServer) Dependencies() (deps []depgraph.Dependency)

Dependencies lists the veth and network namespace as dependencies.

func (DhcpServer) Equal

func (s DhcpServer) Equal(other depgraph.Item) bool

Equal is a comparison method for two equally-named DhcpServer instances.

func (DhcpServer) External

func (s DhcpServer) External() bool

External returns false.

func (DhcpServer) Label

func (s DhcpServer) Label() string

Label

func (DhcpServer) Name

func (s DhcpServer) Name() string

Name

func (DhcpServer) String

func (s DhcpServer) String() string

String describes the DHCP server config.

func (DhcpServer) Type

func (s DhcpServer) Type() string

Type

type DhcpServerConfigurator

type DhcpServerConfigurator struct{}

DhcpServerConfigurator implements Configurator interface for DhcpServer.

func (*DhcpServerConfigurator) Create

Create starts dnsmasq (in DHCP-only mode).

func (*DhcpServerConfigurator) Delete

Delete stops dnsmasq.

func (*DhcpServerConfigurator) Modify

func (c *DhcpServerConfigurator) Modify(ctx context.Context, oldItem, newItem depgraph.Item) (err error)

Modify is not implemented.

func (*DhcpServerConfigurator) NeedsRecreate

func (c *DhcpServerConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate always returns true - Modify is not implemented.

type DnsEntry

type DnsEntry struct {
	FQDN string
	IP   net.IP
}

DnsEntry : Mapping between FQDN and an IP address.

type DnsServer

type DnsServer struct {
	// ServerName : logical name for the DNS server.
	ServerName string
	// NetNamespace : network namespace where the server should be running.
	NetNamespace string
	// VethName : logical name of the veth pair on which the server operates.
	// (other types of interfaces are currently not supported)
	VethName string
	// VethPeerIfName : interface name of that side of the veth pair on which
	// the server should listen. It should be inside NetNamespace.
	VethPeerIfName string
	// StaticEntries : list of FQDN->IP entries statically configured for the server.
	StaticEntries []DnsEntry
	// UpstreamServers : list of IP addresses of public DNS servers to forward
	// requests to (unless there is a static entry).
	UpstreamServers []net.IP
}

DnsServer : DNS server.

func (DnsServer) Dependencies

func (s DnsServer) Dependencies() (deps []depgraph.Dependency)

Dependencies lists the veth and network namespace as dependencies.

func (DnsServer) Equal

func (s DnsServer) Equal(other depgraph.Item) bool

Equal is a comparison method for two equally-named DnsServer instances.

func (DnsServer) External

func (s DnsServer) External() bool

External returns false.

func (DnsServer) Label

func (s DnsServer) Label() string

Label

func (DnsServer) Name

func (s DnsServer) Name() string

Name

func (DnsServer) String

func (s DnsServer) String() string

String describes the DNS server.

func (DnsServer) Type

func (s DnsServer) Type() string

Type

type DnsServerConfigurator

type DnsServerConfigurator struct{}

DnsServerConfigurator implements Configurator interface for DnsServer.

func (*DnsServerConfigurator) Create

func (c *DnsServerConfigurator) Create(ctx context.Context, item depgraph.Item) error

Create starts dnsmasq (in DNS-only mode).

func (*DnsServerConfigurator) Delete

func (c *DnsServerConfigurator) Delete(ctx context.Context, item depgraph.Item) error

Delete stops dnsmasq.

func (*DnsServerConfigurator) Modify

func (c *DnsServerConfigurator) Modify(ctx context.Context, oldItem, newItem depgraph.Item) (err error)

Modify is not implemented.

func (*DnsServerConfigurator) NeedsRecreate

func (c *DnsServerConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate always returns true - Modify is not implemented.

type HttpProxy

type HttpProxy struct {
	sdnapi.Proxy
	// ProxyName : logical name for the HTTP proxy.
	ProxyName string
	// NetNamespace : network namespace where the server should be running.
	NetNamespace string
	// VethName : logical name of the veth pair on which the proxy operates.
	// (other types of interfaces are currently not supported)
	// Can be empty (if the proxy is not associated with any particular interface).
	VethName string
	// ListenIP : IP address on which the proxy should listen.
	// Can be empty to listen on all available interfaces instead of just
	// the interface with the given host address
	ListenIP net.IP
	// Hostname : domain name of the proxy.
	Hostname string
	// HTTPPort : specify on which port+protocol to listen for requests
	// to proxy HTTP traffic.
	// Zero port number can be used to disable HTTP proxying.
	HTTPPort sdnapi.ProxyPort
	// HTTPSPorts : specify on which port(s)+protocol(s) to listen
	// for requests to proxy HTTPS traffic.
	// Empty list can be used to disable HTTPS proxying.
	HTTPSPorts []sdnapi.ProxyPort
	// Transparent : enable for transparent proxy (not known to the client).
	Transparent bool
	// Users : define for username/password authentication, leave empty otherwise.
	Users []sdnapi.UserCredentials
}

HttpProxy : HTTP(S) proxy

func (HttpProxy) Dependencies

func (p HttpProxy) Dependencies() (deps []depgraph.Dependency)

Dependencies lists the (optional) veth and network namespace as dependencies.

func (HttpProxy) Equal

func (p HttpProxy) Equal(other depgraph.Item) bool

Equal is a comparison method for two equally-named HttpProxy instances.

func (HttpProxy) External

func (p HttpProxy) External() bool

External returns false.

func (HttpProxy) Label

func (p HttpProxy) Label() string

Label

func (HttpProxy) Name

func (p HttpProxy) Name() string

Name

func (HttpProxy) String

func (p HttpProxy) String() string

String describes the HTTP proxy.

func (HttpProxy) Type

func (p HttpProxy) Type() string

Type

type HttpProxyConfigurator

type HttpProxyConfigurator struct{}

HttpProxyConfigurator implements Configurator interface for HttpProxy.

func (*HttpProxyConfigurator) Create

func (c *HttpProxyConfigurator) Create(ctx context.Context, item depgraph.Item) error

Create starts goproxy (see sdn/cmd/goproxy).

func (*HttpProxyConfigurator) Delete

func (c *HttpProxyConfigurator) Delete(ctx context.Context, item depgraph.Item) error

Delete stops goproxy.

func (*HttpProxyConfigurator) Modify

func (c *HttpProxyConfigurator) Modify(ctx context.Context, oldItem, newItem depgraph.Item) (err error)

Modify is not implemented.

func (*HttpProxyConfigurator) NeedsRecreate

func (c *HttpProxyConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate always returns true - Modify is not implemented.

type HttpServer

type HttpServer struct {
	// ServerName : logical name for the HTTP server.
	ServerName string
	// NetNamespace : network namespace where the server should be running.
	NetNamespace string
	// VethName : logical name of the veth pair on which the server operates.
	// (other types of interfaces are currently not supported)
	// Can be empty (if the server is not associated with any particular interface).
	VethName string
	// ListenIP : IP address on which the server should listen.
	// Can be empty to listen on all available interfaces instead of just
	// the interface with the given host address
	ListenIP net.IP
	// HTTPPort : port to listen for HTTP requests.
	// Zero value can be used to disable HTTP.
	HTTPPort uint16
	// HTTPSPort : port to listen for HTTPS requests.
	// Zero value can be used to disable HTTPS.
	HTTPSPort uint16
	// CertPEM : Server certificate in the PEM format. Required for HTTPS.
	CertPEM string
	// KeyPEM : Server key in the PEM format. Required for HTTPS.
	KeyPEM string
	// Maps URL Path to a content to be returned inside the HTTP(s) response body.
	Paths map[string]sdnapi.HTTPContent
}

HttpServer : HTTP server

func (HttpServer) Dependencies

func (s HttpServer) Dependencies() (deps []depgraph.Dependency)

Dependencies lists the (optional) veth and network namespace as dependencies.

func (HttpServer) Equal

func (s HttpServer) Equal(other depgraph.Item) bool

Equal is a comparison method for two equally-named HttpServer instances.

func (HttpServer) External

func (s HttpServer) External() bool

External returns false.

func (HttpServer) Label

func (s HttpServer) Label() string

Label

func (HttpServer) Name

func (s HttpServer) Name() string

Name

func (HttpServer) String

func (s HttpServer) String() string

String describes the HTTP server.

func (HttpServer) Type

func (s HttpServer) Type() string

Type

type HttpServerConfigurator

type HttpServerConfigurator struct{}

HttpServerConfigurator implements Configurator interface for HttpServer.

func (*HttpServerConfigurator) Create

Create starts httpsrv (see sdn/cmd/httpsrv).

func (*HttpServerConfigurator) Delete

Delete stops httpsrv.

func (*HttpServerConfigurator) Modify

func (c *HttpServerConfigurator) Modify(ctx context.Context, oldItem, newItem depgraph.Item) (err error)

Modify is not implemented.

func (*HttpServerConfigurator) NeedsRecreate

func (c *HttpServerConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate always returns true - Modify is not implemented.

type IPRange

type IPRange struct {
	// FromIP : start of the range (includes the address itself).
	FromIP net.IP
	// ToIP : end of the range (includes the address itself).
	ToIP net.IP
}

IPRange : a range of IP addresses.

type IPRule

type IPRule struct {
	SrcNet   *net.IPNet
	DstNet   *net.IPNet
	Table    int
	Priority int
}

IPRule : IP rule used to select routing table for a given traffic.

func (IPRule) Dependencies

func (r IPRule) Dependencies() (deps []depgraph.Dependency)

Dependencies return nil (no dependencies).

func (IPRule) Equal

func (r IPRule) Equal(other depgraph.Item) bool

Equal is a comparison method for two equally-named IP-rule instances.

func (IPRule) External

func (r IPRule) External() bool

External returns false.

func (IPRule) Label

func (r IPRule) Label() string

Label

func (IPRule) Name

func (r IPRule) Name() string

Name

func (IPRule) String

func (r IPRule) String() string

String describes IP rule.

func (IPRule) Type

func (r IPRule) Type() string

Type

type IPRuleConfigurator

type IPRuleConfigurator struct{}

IPRuleConfigurator implements Configurator interface for IP Rules.

func (*IPRuleConfigurator) Create

func (c *IPRuleConfigurator) Create(ctx context.Context, item depgraph.Item) error

Create adds IP rule.

func (*IPRuleConfigurator) Delete

func (c *IPRuleConfigurator) Delete(ctx context.Context, item depgraph.Item) error

Delete removes IP rule.

func (*IPRuleConfigurator) Modify

func (c *IPRuleConfigurator) Modify(_ context.Context, _, _ depgraph.Item) (err error)

Modify is not implemented.

func (*IPRuleConfigurator) NeedsRecreate

func (c *IPRuleConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate returns true - Modify is not implemented.

type IfHandle

type IfHandle struct {
	// PhysIf : physical interface associated with this handle.
	PhysIf PhysIf
	// Usage : How is the physical network interface being used.
	Usage IfUsage
	// ParentLL : Logical label of the parent bridge or bond if the physical interface
	// is bridged or aggregated, respectively.
	// Leave empty for L3 interfaces.
	ParentLL string
	// AdminUP : enable to put the physical interface administratively UP.
	AdminUP bool
	// MTU : Maximum transmission unit.
	MTU uint16
}

IfHandle : an item representing *exclusive* allocation and use of a physical interface.

func (IfHandle) Dependencies

func (h IfHandle) Dependencies() (deps []depgraph.Dependency)

Dependencies returns the physical interface as the only dependency.

func (IfHandle) Equal

func (h IfHandle) Equal(other depgraph.Item) bool

Equal is a comparison method for two equally-named IfHandle instances.

func (IfHandle) External

func (h IfHandle) External() bool

External returns false.

func (IfHandle) Label

func (h IfHandle) Label() string

Label

func (IfHandle) Name

func (h IfHandle) Name() string

Name

func (IfHandle) String

func (h IfHandle) String() string

String describes the handle.

func (IfHandle) Type

func (h IfHandle) Type() string

Type

type IfHandleConfigurator

type IfHandleConfigurator struct {
	MacLookup *maclookup.MacLookup
}

IfHandleConfigurator implements Configurator interface for IfHandle.

func (*IfHandleConfigurator) Create

func (c *IfHandleConfigurator) Create(ctx context.Context, item depgraph.Item) error

Create sets interface admin state and MTU.

func (*IfHandleConfigurator) Delete

func (c *IfHandleConfigurator) Delete(ctx context.Context, item depgraph.Item) error

Delete sets interface DOWN.

func (*IfHandleConfigurator) Modify

func (c *IfHandleConfigurator) Modify(ctx context.Context, oldItem, newItem depgraph.Item) (err error)

Modify is able to change interface admin status and MTU.

func (*IfHandleConfigurator) NeedsRecreate

func (c *IfHandleConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate returns true if the usage of PhysIf changed. This triggers recreate which cascades up through the graph of dependencies.

type IfUsage

type IfUsage uint8

IfUsage : how a network interface is being used.

const (
	// IfUsageUnspecified : not specified how a network interface is being used.
	IfUsageUnspecified IfUsage = iota
	// IfUsageL3 : network interface is used in the L3 mode.
	IfUsageL3
	// IfUsageBridged : network interface is bridged.
	IfUsageBridged
	// IfUsageAggregated : network interface is aggregated by Bond interface.
	IfUsageAggregated
)

type IptablesChain

type IptablesChain struct {
	// NetNamespace : network namespace where the chain should be created.
	NetNamespace string
	ChainName    string
	Table        string
	ForIPv6      bool
	Rules        []IptablesRule
	// RefersChains : names of chains referred from rules.
	// We could probably extract this from IptablesRule.Args, but let's keep things
	// simple and not dive into the iptables semantics too much.
	RefersChains []string
	// RefersVeths : names of VETH interfaces referred from rules.
	RefersVeths []string
	// PreCreated : a custom chain which already exists (as empty).
	PreCreated bool
}

IptablesChain : single iptables chain.

func (IptablesChain) Dependencies

func (ch IptablesChain) Dependencies() (deps []depgraph.Dependency)

Dependencies lists all referenced chains + net namespace as dependencies.

func (IptablesChain) Equal

func (ch IptablesChain) Equal(other depgraph.Item) bool

Equal compares content of two instances of the same iptables chain.

func (IptablesChain) External

func (ch IptablesChain) External() bool

External returns false.

func (IptablesChain) Label

func (ch IptablesChain) Label() string

Label

func (IptablesChain) Name

func (ch IptablesChain) Name() string

Name

func (IptablesChain) String

func (ch IptablesChain) String() string

String describes content of iptables chain.

func (IptablesChain) Type

func (ch IptablesChain) Type() string

Type We use the same structure for both IPv4 and IPv6 iptables.

type IptablesChainConfigurator

type IptablesChainConfigurator struct{}

IptablesChainConfigurator implements Configurator interface for both iptables and ip6tables chains.

func (*IptablesChainConfigurator) Create

Create creates and populates ip(6)tables chain.

func (*IptablesChainConfigurator) Delete

Delete flushes the chain content and removes it unless it is a pre-created chain.

func (*IptablesChainConfigurator) Modify

func (c *IptablesChainConfigurator) Modify(ctx context.Context, oldItem, newItem depgraph.Item) (err error)

Modify rules by recreating them. But do not re-create the entire chain, that would recreate everything that depends on it.

func (*IptablesChainConfigurator) NeedsRecreate

func (c *IptablesChainConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate returns false - configurator is able to modify the chain content.

type IptablesRule

type IptablesRule struct {
	// Args : any arguments except for -t, -A, -D, -I, -R.
	Args []string
	// Description : optionally describe the rule.
	Description string
}

IptablesRule : single iptables rule.

type MACToIP

type MACToIP struct {
	MAC net.HardwareAddr
	IP  net.IP
}

MACToIP maps MAC address to IP address.

type MasterBridge

type MasterBridge struct {
	// IfName : interface name of the bridge to put the veth peer under.
	IfName string
	// VLAN for which this VETH is an access port.
	// Leave zero to not use with VLAN.
	VLAN uint16
}

MasterBridge : master bridge for a veth peer.

type NetNamespace

type NetNamespace struct {
	// NsName : name of the network namespace.
	NsName     string
	ResolvConf ResolvConf
}

NetNamespace : an item representing named network namespace.

func (NetNamespace) Dependencies

func (n NetNamespace) Dependencies() (deps []depgraph.Dependency)

Dependencies returns nothing.

func (NetNamespace) Equal

func (n NetNamespace) Equal(other depgraph.Item) bool

Equal compares resolv.conf entries.

func (NetNamespace) External

func (n NetNamespace) External() bool

External returns false.

func (NetNamespace) Label

func (n NetNamespace) Label() string

Label

func (NetNamespace) Name

func (n NetNamespace) Name() string

Name

func (NetNamespace) String

func (n NetNamespace) String() string

String describes the namespace.

func (NetNamespace) Type

func (n NetNamespace) Type() string

Type

type NetNamespaceConfigurator

type NetNamespaceConfigurator struct{}

NetNamespaceConfigurator implements Configurator interface for NetNamespace.

func (*NetNamespaceConfigurator) Create

Create adds network namespace.

func (*NetNamespaceConfigurator) Delete

Delete removes network namespace.

func (*NetNamespaceConfigurator) Modify

func (c *NetNamespaceConfigurator) Modify(ctx context.Context, oldItem, newItem depgraph.Item) (err error)

Modify is able to update resolv.conf content.

func (*NetNamespaceConfigurator) NeedsRecreate

func (c *NetNamespaceConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate returns false - Modify is able to handle changes (in the resolv.conf content).

type PhysIf

type PhysIf struct {
	// MAC address assigned by Eden.
	MAC net.HardwareAddr
	// LogicalLabel : label used within the network model.
	LogicalLabel string
}

PhysIf : physical network interface. External item used to represent a presence (or lack) of a NIC.

func (PhysIf) Dependencies

func (p PhysIf) Dependencies() (deps []depgraph.Dependency)

Dependencies returns nothing (external item).

func (PhysIf) Equal

func (p PhysIf) Equal(other depgraph.Item) bool

Equal is a comparison method for two PhysIf instances.

func (PhysIf) External

func (p PhysIf) External() bool

External returns true because we learn about a presence of a physical interface through netlink API.

func (PhysIf) Label

func (p PhysIf) Label() string

Label

func (PhysIf) Name

func (p PhysIf) Name() string

Name

func (PhysIf) String

func (p PhysIf) String() string

String describes the interface.

func (PhysIf) Type

func (p PhysIf) Type() string

Type

type ResolvConf

type ResolvConf struct {
	// Create resolv.conf specifically for this network namespace
	// with the DNS server entries listed below.
	// Otherwise the namespace will use the global resolv.conf.
	Create     bool
	DNSServers []net.IP
}

ResolvConf - config for resolv.conf

type Route

type Route struct {
	// NetNamespace : network namespace where the route should be created.
	NetNamespace string
	// DstNet : destination network that the route matches.
	// Mandatory argument (should not be nil).
	DstNet *net.IPNet
	// OutputIf : output interface for the routed traffic.
	// Leave undefined if the destination is unreachable.
	OutputIf RouteOutIf
	// Gw : IP address of the gateway to route the traffic via.
	// Leave undefined for unreachable or link-local destination.
	GwIP net.IP
	// Table : routing table to put the entry into.
	Table int
	// Metric : route metric (basically the "cost").
	// The higher the value, the lower the priority is.
	// Highest priority is 0, lowest is ^uint32(0).
	Metric uint32
}

Route : single route entry.

func (Route) Dependencies

func (r Route) Dependencies() (deps []depgraph.Dependency)

Dependencies lists the namespace and the output interface as dependencies. Note that we do not check if IP address(es) assigned to the output interface match with the route gateway (it would be a programming error in sdnagent/config.go if it didn't).

func (Route) Equal

func (r Route) Equal(other depgraph.Item) bool

Equal is a comparison method for two equally-named Route instances.

func (Route) External

func (r Route) External() bool

External returns false.

func (Route) Label

func (r Route) Label() string

Label

func (Route) Name

func (r Route) Name() string

Name

func (Route) String

func (r Route) String() string

String describes Route.

func (Route) Type

func (r Route) Type() string

Type

type RouteConfigurator

type RouteConfigurator struct {
	MacLookup *maclookup.MacLookup
}

RouteConfigurator implements Configurator interface for Route.

func (*RouteConfigurator) Create

func (c *RouteConfigurator) Create(ctx context.Context, item depgraph.Item) error

Create adds new route.

func (*RouteConfigurator) Delete

func (c *RouteConfigurator) Delete(ctx context.Context, item depgraph.Item) error

Delete removes route.

func (*RouteConfigurator) Modify

func (c *RouteConfigurator) Modify(ctx context.Context, oldItem, newItem depgraph.Item) (err error)

Modify is not implemented (route is recreated on change).

func (*RouteConfigurator) NeedsRecreate

func (c *RouteConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate returns true. Modify is not implemented.

type RouteOutIf

type RouteOutIf struct {
	// VethName : logical name of the veth pair used as the output device for the route.
	// Define either PhysIf or VethName + VethPeerIfName.
	VethName string
	// VethPeerIfName : interface name of that side of the veth pair which the routed
	// traffic is entering.
	VethPeerIfName string
	// PhysIf : physical interface to use as the output device.
	// Define either PhysIf or VethName + VethPeerIfName.
	PhysIf PhysIf
}

RouteOutIf : output interface for the route - either veth or physical interface.

type Sysctl

type Sysctl struct {
	// NetNamespace : network namespace name
	NetNamespace          string
	EnableIPv4Forwarding  bool
	EnableIPv6Forwarding  bool
	BridgeNfCallIptables  bool
	BridgeNfCallIp6tables bool
}

Sysctl : item representing kernel parameters set using sysctl.

func (Sysctl) Dependencies

func (f Sysctl) Dependencies() (deps []depgraph.Dependency)

Dependencies returns dependency on the network namespace.

func (Sysctl) Equal

func (f Sysctl) Equal(other depgraph.Item) bool

Equal compares sysctl settings.

func (Sysctl) External

func (f Sysctl) External() bool

External returns false.

func (Sysctl) Label

func (f Sysctl) Label() string

Label

func (Sysctl) Name

func (f Sysctl) Name() string

Name

func (Sysctl) String

func (f Sysctl) String() string

String prints sysctl settings.

func (Sysctl) Type

func (f Sysctl) Type() string

Type

type SysctlConfigurator

type SysctlConfigurator struct{}

SysctlConfigurator implements Configurator for sysctl settings.

func (*SysctlConfigurator) Create

func (c *SysctlConfigurator) Create(ctx context.Context, item depgraph.Item) error

Create applies sysctl settings.

func (*SysctlConfigurator) Delete

func (c *SysctlConfigurator) Delete(ctx context.Context, item depgraph.Item) error

Delete sets default sysctl settings.

func (*SysctlConfigurator) Modify

func (c *SysctlConfigurator) Modify(ctx context.Context, oldItem, newItem depgraph.Item) error

Modify updates sysctl settings.

func (*SysctlConfigurator) NeedsRecreate

func (c *SysctlConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate returns false - Modify is able to apply any change.

type TrafficControl

type TrafficControl struct {
	api.TrafficControl
	// PhysIf : target physical network interface for traffic control.
	PhysIf PhysIf
}

TrafficControl represents traffic control rules applied to a physical interface.

func (TrafficControl) Dependencies

func (t TrafficControl) Dependencies() (deps []depgraph.Dependency)

Dependencies lists the physical interface as the only dependency.

func (TrafficControl) Equal

func (t TrafficControl) Equal(other depgraph.Item) bool

Equal is a comparison method for two equally-named TrafficControl instances.

func (TrafficControl) External

func (t TrafficControl) External() bool

External returns false.

func (TrafficControl) Label

func (t TrafficControl) Label() string

Label is used only for the visualization purposes of the config/state depgraph.

func (TrafficControl) Name

func (t TrafficControl) Name() string

Name returns MAC address of the physical interface as the unique identifier for the TrafficControl instance.

func (TrafficControl) String

func (t TrafficControl) String() string

String describes TrafficControl instance.

func (TrafficControl) Type

func (t TrafficControl) Type() string

Type assigned to TrafficControl

type TrafficControlConfigurator

type TrafficControlConfigurator struct {
	MacLookup *maclookup.MacLookup
}

TrafficControlConfigurator implements Configurator interface for TrafficControl.

func (*TrafficControlConfigurator) Create

Create applies traffic control rules for the physical interface.

func (*TrafficControlConfigurator) Delete

Delete removes applied traffic control rules from the physical interface.

func (*TrafficControlConfigurator) Modify

func (c *TrafficControlConfigurator) Modify(_ context.Context, _, _ depgraph.Item) (err error)

Modify is not implemented.

func (*TrafficControlConfigurator) NeedsRecreate

func (c *TrafficControlConfigurator) NeedsRecreate(_, _ depgraph.Item) (recreate bool)

NeedsRecreate returns true, Modify is not implemented.

type Veth

type Veth struct {
	// VethName : logical name for the veth pair as a whole.
	VethName string
	Peer1    VethPeer
	Peer2    VethPeer
}

Veth : virtual Ethernet (two interconnected peers).

func (Veth) Dependencies

func (v Veth) Dependencies() (deps []depgraph.Dependency)

Dependencies lists namespace and potentially bridge as veth dependencies.

func (Veth) Equal

func (v Veth) Equal(other depgraph.Item) bool

Equal is a comparison method for two equally-named Veth instances.

func (Veth) External

func (v Veth) External() bool

External returns false.

func (Veth) Label

func (v Veth) Label() string

Label

func (Veth) Name

func (v Veth) Name() string

Name

func (Veth) String

func (v Veth) String() string

String describes veth.

func (Veth) Type

func (v Veth) Type() string

Type

type VethConfigurator

type VethConfigurator struct{}

VethConfigurator implements Configurator interface for veth.

func (*VethConfigurator) Create

func (c *VethConfigurator) Create(ctx context.Context, item depgraph.Item) error

Create adds new veth.

func (*VethConfigurator) Delete

func (c *VethConfigurator) Delete(ctx context.Context, item depgraph.Item) error

Delete removes veth. Should be enough to just remove one side.

func (*VethConfigurator) Modify

func (c *VethConfigurator) Modify(ctx context.Context, oldItem, newItem depgraph.Item) (err error)

Modify is not implemented (veth is recreated on change).

func (*VethConfigurator) NeedsRecreate

func (c *VethConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate returns true. Modify is not implemented.

type VethPeer

type VethPeer struct {
	// IfName : name of the veth peer.
	IfName string
	// MasterBridge : bridge to put veth peer under.
	// Leave nil to use veth peer without bridge.
	// Do not combine with non-main NetNamespace (bridges are limited to main ns)
	// and IPAddresses.
	MasterBridge *MasterBridge
	// NetNamespace : network namespace where the veth peer should be placed into.
	// Do not combine non-main namespace with MasterBridge.
	NetNamespace string
	// IPAddresses : IP addresses to assign to the veth peer.
	// The peer should be in the L3 mode, not under a bridge.
	IPAddresses []*net.IPNet
	// MTU : Maximum transmission unit.
	MTU uint16
}

VethPeer : one side of Virtual Ethernet Device.

func (VethPeer) Dependencies

func (v VethPeer) Dependencies() (deps []depgraph.Dependency)

Dependencies of a single veth side.

func (VethPeer) Equal

func (v VethPeer) Equal(v2 VethPeer) bool

Equal compares two veth peers for equality.

Jump to

Keyboard shortcuts

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