config

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommunityToString added in v0.12.0

func CommunityToString(c uint32) string

func DiscardFRROnly added in v0.12.0

func DiscardFRROnly(c *configFile) error

DiscardFRROnly returns an error if the current configFile contains any options that are available only in the FRR implementation.

func DiscardNativeOnly added in v0.12.0

func DiscardNativeOnly(c *configFile) error

DiscardNativeOnly returns an error if the current configFile contains any options that are available only in the native implementation.

func DontValidate added in v0.12.0

func DontValidate(c *configFile) error

DontValidate is a Validate function that always returns success.

func ParseCIDR added in v0.11.0

func ParseCIDR(cidr string) ([]*net.IPNet, error)

func ParseCommunity added in v0.12.0

func ParseCommunity(c string) (uint32, error)

Types

type BFDProfile added in v0.12.0

type BFDProfile struct {
	Name             string
	ReceiveInterval  *uint32
	TransmitInterval *uint32
	DetectMultiplier *uint32
	EchoInterval     *uint32
	EchoMode         bool
	PassiveMode      bool
	MinimumTTL       *uint32
}

BFDProfile describes a BFD profile to be applied to a set of peers.

type BGPAdvertisement added in v0.3.0

type BGPAdvertisement struct {
	// Roll up the IP address into a CIDR prefix of this
	// length. Optional, defaults to 32 (i.e. no aggregation) if not
	// specified.
	AggregationLength int
	// Optional, defaults to 128 (i.e. no aggregation) if not
	// specified.
	AggregationLengthV6 int
	// Value of the LOCAL_PREF BGP path attribute. Used only when
	// advertising to IBGP peers (i.e. Peer.MyASN == Peer.ASN).
	LocalPref uint32
	// Value of the COMMUNITIES path attribute.
	Communities map[uint32]bool
}

BGPAdvertisement describes one translation from an IP address to a BGP advertisement.

type Config

type Config struct {
	// Routers that MetalLB should peer with.
	Peers []*Peer
	// Address pools from which to allocate load balancer IPs.
	Pools map[string]*Pool
	// BFD profiles that can be used by peers.
	BFDProfiles map[string]*BFDProfile
}

Config is a parsed MetalLB configuration.

func Parse

func Parse(bs []byte, validate Validate) (*Config, error)

Parse loads and validates a Config from bs.

type Peer

type Peer struct {
	// AS number to use for the local end of the session.
	MyASN uint32
	// AS number to expect from the remote end of the session.
	ASN uint32
	// Address to dial when establishing the session.
	Addr net.IP
	// Source address to use when establishing the session.
	SrcAddr net.IP
	// Port to dial when establishing the session.
	Port uint16
	// Requested BGP hold time, per RFC4271.
	HoldTime time.Duration
	// Requested BGP keepalive time, per RFC4271.
	KeepaliveTime time.Duration
	// BGP router ID to advertise to the peer
	RouterID net.IP
	// Only connect to this peer on nodes that match one of these
	// selectors.
	NodeSelectors []labels.Selector
	// Authentication password for routers enforcing TCP MD5 authenticated sessions
	Password string
	// The optional BFD profile to be used for this BGP session
	BFDProfile string
	// Optional ebgp peer is multi-hops away.
	EBGPMultiHop bool
}

Peer is the configuration of a BGP peering session.

type Pool

type Pool struct {
	// Protocol for this pool.
	Protocol Proto
	// The addresses that are part of this pool, expressed as CIDR
	// prefixes. config.Parse guarantees that these are
	// non-overlapping, both within and between pools.
	CIDR []*net.IPNet
	// Some buggy consumer devices mistakenly drop IPv4 traffic for IP
	// addresses ending in .0 or .255, due to poor implementations of
	// smurf protection. This setting marks such addresses as
	// unusable, for maximum compatibility with ancient parts of the
	// internet.
	AvoidBuggyIPs bool
	// If false, prevents IP addresses to be automatically assigned
	// from this pool.
	AutoAssign bool
	// When an IP is allocated from this pool, how should it be
	// translated into BGP announcements?
	BGPAdvertisements []*BGPAdvertisement
}

Pool is the configuration of an IP address pool.

type Proto added in v0.3.0

type Proto string

Proto holds the protocol we are speaking.

const (
	BGP    Proto = "bgp"
	Layer2 Proto = "layer2"
)

MetalLB supported protocols.

type Validate added in v0.12.0

type Validate func(*configFile) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳