Documentation
¶
Index ¶
- Constants
- Variables
- func BridgeByName(name string) (*netlink.Bridge, error)
- func CGroupAddress(log *slog.Logger, pid int) ([]netip.Prefix, error)
- func CalculateGateway(pr netip.Prefix) netip.Prefix
- func CheckBridgeStatus(name string) error
- func ConfigureGW(br netlink.Link, ec *EndpointConfig) error
- func ConfigureIface(log *slog.Logger, ifName string, nc *EndpointConfig) error
- func ConfigureNetNS(log *slog.Logger, pid int, ec *EndpointConfig) error
- func MasqueradeEndpoint(ec *EndpointConfig) error
- func SetupBridge(n *BridgeConfig) (*netlink.Bridge, error)
- func SetupVeth(netns ns.NetNS, br *netlink.Bridge, ifName string, mtu int, hairpinMode bool, ...) (*current.Interface, *current.Interface, error)
- func TeardownBridge(name string) error
- type BridgeConfig
- type BridgeServices
- type EndpointConfig
- type IPPool
- func (i *IPPool) Allocate() (netip.Prefix, error)
- func (i *IPPool) Deallocate(addr netip.Prefix) error
- func (i *IPPool) Init(cidr string, allocRouter bool) error
- func (i *IPPool) MarshalBinary() ([]byte, error)
- func (i *IPPool) Router() netip.Prefix
- func (i *IPPool) UnmarshalBinary(data []byte) error
- type Route
- type ServiceManager
- type Subnet
Constants ¶
View Source
const (
// Note: use slash as separator so we can have dots in interface name (VLANs)
DisableIPv6SysctlTemplate = "net/ipv6/conf/%s/disable_ipv6"
)
Variables ¶
View Source
var ( V4all = netip.MustParsePrefix("0.0.0.0/0") V6all = netip.MustParsePrefix("::/0") )
View Source
var ErrAddressesExhausted = errors.New("no more addresses")
Functions ¶
func CheckBridgeStatus ¶
func ConfigureGW ¶
func ConfigureGW(br netlink.Link, ec *EndpointConfig) error
func ConfigureIface ¶
func ConfigureIface(log *slog.Logger, ifName string, nc *EndpointConfig) error
func ConfigureNetNS ¶
func ConfigureNetNS(log *slog.Logger, pid int, ec *EndpointConfig) error
func MasqueradeEndpoint ¶
func MasqueradeEndpoint(ec *EndpointConfig) error
func SetupBridge ¶
func SetupBridge(n *BridgeConfig) (*netlink.Bridge, error)
func TeardownBridge ¶
Types ¶
type BridgeConfig ¶
type BridgeServices ¶
type BridgeServices struct {
// contains filtered or unexported fields
}
BridgeServices holds the services running for a specific bridge
type EndpointConfig ¶
type EndpointConfig struct {
Addresses []netip.Prefix
Routes []*Route
Bridge *BridgeConfig
}
func AllocateOnBridge ¶
func AllocateOnBridge(name string, subnet *netdb.Subnet) (*EndpointConfig, error)
func SetupOnBridge ¶
func (*EndpointConfig) DeriveDefaultGateway ¶
func (e *EndpointConfig) DeriveDefaultGateway() error
type IPPool ¶
type IPPool struct {
// contains filtered or unexported fields
}
func (*IPPool) MarshalBinary ¶
func (*IPPool) UnmarshalBinary ¶
type ServiceManager ¶
type ServiceManager struct {
Log *slog.Logger
EAC *entityserver_v1alpha.EntityAccessClient
// contains filtered or unexported fields
}
ServiceManager handles network services (DNS, etc) for bridges
func NewServiceManager ¶ added in v0.3.0
func NewServiceManager(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient) *ServiceManager
NewServiceManager creates a new ServiceManager.
func (*ServiceManager) SetupDNS ¶
func (sm *ServiceManager) SetupDNS(ctx context.Context, bc *BridgeConfig) error
SetupDNS ensures a DNS server is running for the given bridge
func (*ServiceManager) ShutdownAll ¶
func (sm *ServiceManager) ShutdownAll() error
ShutdownAll stops all services on all bridges
func (*ServiceManager) ShutdownBridge ¶
func (sm *ServiceManager) ShutdownBridge(bridgeName string) error
ShutdownBridge stops all services for a given bridge
Click to show internal directories.
Click to hide internal directories.