Documentation
¶
Index ¶
- Constants
- Variables
- func GetInterfaceIP(name string) (string, error)
- func GetInterfaceName(address string) (string, error)
- func InterfaceExists(name string) (bool, error)
- type APIInterface
- type APIInterfaceYaml
- type APIYaml
- type AuditLogging
- type AuditLoggingYaml
- type Config
- type ConfigYAML
- type DB
- type DBYaml
- type Interfaces
- type InterfacesYaml
- type Logging
- type LoggingYaml
- type N2Interface
- type N2InterfaceYaml
- type N3Interface
- type N3InterfaceYaml
- type N6Interface
- type N6InterfaceYaml
- type SystemLogging
- type SystemLoggingYaml
- type TLS
- type TLSYaml
- type Telemetry
- type TelemetryYaml
- type UPFYaml
- type VlanConfig
- type XDP
- type XDPYaml
Constants ¶
View Source
const ( AttachModeNative = "native" AttachModeGeneric = "generic" )
View Source
const ( LoggingSystemOutputStdout = "stdout" LoggingSystemOutputFile = "file" )
View Source
const (
UpfNodeID = "0.0.0.0"
)
Variables ¶
View Source
var CheckInterfaceExistsFunc = func(name string) (bool, error) { networkInterface, err := net.InterfaceByName(name) if err != nil { return false, err } if networkInterface == nil { return false, nil } return true, nil }
View Source
var GetInterfaceIPFunc = func(name string) (string, error) { iface, err := net.InterfaceByName(name) if err != nil { return "", err } addresses, err := iface.Addrs() if err != nil { return "", err } for _, addr := range addresses { if ip, _, err := net.ParseCIDR(addr.String()); err == nil { if ip.To4() != nil { return ip.String(), nil } } } return "", errors.New("no valid IPv4 address found") }
View Source
var GetInterfaceNameFunc = func(address string) (string, error) { if address == "" { return "", errors.New("address is empty") } interfaces, err := net.Interfaces() if err != nil { return "", fmt.Errorf("cannot list network interfaces: %w", err) } for _, iface := range interfaces { addresses, err := iface.Addrs() if err != nil { return "", err } for _, addr := range addresses { if ip, _, err := net.ParseCIDR(addr.String()); err == nil { if ip.String() == address { return iface.Name, nil } } } } return "", nil }
View Source
var GetVLANConfigForInterfaceFunc = func(name string) (*VlanConfig, error) { link, err := netlink.LinkByName(name) if err != nil { return nil, err } if link.Type() == "vlan" { vlanLink := link.(*netlink.Vlan) parentLink, err := netlink.LinkByIndex(vlanLink.ParentIndex) if err != nil { return nil, err } config := VlanConfig{MasterInterface: parentLink.Attrs().Name, VlanId: vlanLink.VlanId} return &config, nil } return nil, nil }
Functions ¶
func GetInterfaceIP ¶ added in v0.0.7
func GetInterfaceName ¶ added in v0.4.1
func InterfaceExists ¶ added in v0.0.7
Types ¶
type APIInterface ¶
type APIInterfaceYaml ¶
type AuditLogging ¶ added in v0.0.8
type AuditLoggingYaml ¶ added in v0.0.8
type Config ¶
type Config struct {
Logging Logging
DB DB
Interfaces Interfaces
XDP XDP
Telemetry Telemetry
}
type ConfigYAML ¶
type ConfigYAML struct {
Logging LoggingYaml `yaml:"logging"`
DB DBYaml `yaml:"db"`
Interfaces InterfacesYaml `yaml:"interfaces"`
XDP XDPYaml `yaml:"xdp"`
Telemetry TelemetryYaml `yaml:"telemetry"`
}
type Interfaces ¶
type Interfaces struct {
N2 N2Interface
N3 N3Interface
N6 N6Interface
API APIInterface
}
type InterfacesYaml ¶
type InterfacesYaml struct {
N2 N2InterfaceYaml `yaml:"n2"`
N3 N3InterfaceYaml `yaml:"n3"`
N6 N6InterfaceYaml `yaml:"n6"`
API APIInterfaceYaml `yaml:"api"`
}
type Logging ¶ added in v0.0.8
type Logging struct {
SystemLogging SystemLogging
AuditLogging AuditLogging
}
type LoggingYaml ¶ added in v0.0.8
type LoggingYaml struct {
SystemLogging SystemLoggingYaml `yaml:"system"`
AuditLogging AuditLoggingYaml `yaml:"audit"`
}
type N2Interface ¶ added in v0.0.5
type N2InterfaceYaml ¶ added in v0.0.5
type N3Interface ¶
type N3Interface struct {
Name string
Address string
VlanConfig *VlanConfig
}
type N3InterfaceYaml ¶
type N6Interface ¶
type N6Interface struct {
Name string
VlanConfig *VlanConfig
}
type N6InterfaceYaml ¶
type N6InterfaceYaml struct {
Name string `yaml:"name"`
}
type SystemLogging ¶ added in v0.0.8
type SystemLoggingYaml ¶ added in v0.0.8
type TelemetryYaml ¶ added in v0.0.18
type VlanConfig ¶ added in v0.4.2
Click to show internal directories.
Click to hide internal directories.