networking

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 4 Imported by: 10

Documentation

Overview

Copyright (c) 2023 Nordix Foundation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	NSE = iota // Interface linked to a NSC (e.g. target)
	NSC        // Interface linked to a NSE (e.g. Load balancer)
)

Variables

This section is empty.

Functions

Types

type Bridge

type Bridge interface {
	Iface
	LinkInterface(intf Iface) error
	UnLinkInterface(intf Iface) error
	InterfaceIsLinked(intf Iface) bool
	FindLinkedInterfaceByIndex(index int) Iface
}

type FWMarkRoute

type FWMarkRoute interface {
	Verify() bool
	Delete() error
}

type Iface

type Iface interface {
	GetIndex() int
	GetName(options ...IfaceNameOption) string

	GetLocalPrefixes() []string
	SetLocalPrefixes(localPrefixes []string)
	AddLocalPrefix(prefix string) error
	RemoveLocalPrefix(prefix string) error

	GetNeighborPrefixes() []string
	SetNeighborPrefixes(neighborPrefixes []string)

	GetGatewayPrefixes() []string
	SetGatewayPrefixes(gateways []string)

	GetInterfaceType() InterfaceType
	SetInterfaceType(ifaceType InterfaceType)

	Equals(Iface) bool
}

type IfaceNameOption added in v1.1.1

type IfaceNameOption func(*IfaceNameOptions)

func WithNoLoad added in v1.1.1

func WithNoLoad() IfaceNameOption

WithNoLoad - WithNoLoad implements option pattern for GetName function. Tells not to load resolved interface name into the Name field of Interface struct.

func WithNoResolve added in v1.1.1

func WithNoResolve() IfaceNameOption

WithNoResolve - WithNoResolve implements option pattern for GetName function. Tells not to resolve the interface name if not known.

type IfaceNameOptions added in v1.1.1

type IfaceNameOptions struct {
	NoResolve bool
	NoLoad    bool
}

type InterfaceMonitor

type InterfaceMonitor interface {
	Subscribe(subscriber InterfaceMonitorSubscriber)
	UnSubscribe(subscriber InterfaceMonitorSubscriber)
	Close()
}

type InterfaceMonitorSubscriber

type InterfaceMonitorSubscriber interface {
	InterfaceCreated(Iface)
	InterfaceDeleted(Iface)
}

type InterfaceType

type InterfaceType int

type SourceBasedRoute

type SourceBasedRoute interface {
	Delete() error
	AddNexthop(nexthop string) error
	RemoveNexthop(nexthop string) error
}

type Utils

type Utils interface {
	NewInterface(index int) Iface
	NewBridge(name string) (Bridge, error)
	NewFWMarkRoute(ip string, fwmark int, tableID int) (FWMarkRoute, error)
	NewSourceBasedRoute(tableID int, prefix string) (SourceBasedRoute, error)

	NewInterfaceMonitor() (InterfaceMonitor, error)
	WithInterfaceMonitor(parent context.Context, monitor InterfaceMonitor) context.Context
	GetInterfaceMonitor(ctx context.Context) InterfaceMonitor

	GetIndexFromName(name string) (int, error)
}

Jump to

Keyboard shortcuts

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