kerneltest

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

package kerneltest contains fake implemetation of structs in kernel package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeInterfaces

type FakeInterfaces struct {
	Links map[string]*Iface
	// contains filtered or unexported fields
}

FakeInterfaces contains a fake implementation methods for modifying networking interfaces.

func New

func New(initialIfaces map[string]*Iface) *FakeInterfaces

New returns a new FakeInterfaces.

func (*FakeInterfaces) AddrSubscribe

func (fi *FakeInterfaces) AddrSubscribe(ch chan<- netlink.AddrUpdate, done <-chan struct{}) error

AddrSubscribe subscribes to address changes for all interfaces.

func (*FakeInterfaces) CreateTAP

func (fi *FakeInterfaces) CreateTAP(name string) (int, error)

CreateTAP creates kernel TAP interface.

func (*FakeInterfaces) DeleteIP

func (fi *FakeInterfaces) DeleteIP(name string, ip string, prefixLen int) error

DeleteIP delete an IP addresses from a network interface.

func (*FakeInterfaces) GetAll

func (fi *FakeInterfaces) GetAll() ([]net.Interface, error)

GetAll returns all interfaces.

func (*FakeInterfaces) GetByName

func (fi *FakeInterfaces) GetByName(name string) (*net.Interface, error)

GetByName returns all interfaces.

func (*FakeInterfaces) LinkSubscribe

func (fi *FakeInterfaces) LinkSubscribe(ch chan<- netlink.LinkUpdate, done <-chan struct{}) error

LinkSubscribe subscribes to link status for all interfaces.

func (*FakeInterfaces) NeighSubscribe

func (fi *FakeInterfaces) NeighSubscribe(chan<- netlink.NeighUpdate, <-chan struct{}) error

NeighSubscribe subscribes to neighbor table updates. TODO: not implemented.

func (*FakeInterfaces) ReplaceIP

func (fi *FakeInterfaces) ReplaceIP(name string, ip string, prefixLen int) error

ReplaceIP sets the IP addresses of a network interface.

func (*FakeInterfaces) SetHWAddr

func (fi *FakeInterfaces) SetHWAddr(name string, addr string) error

SetHWAddr sets the MAC address of a network interface.

func (*FakeInterfaces) SetState

func (fi *FakeInterfaces) SetState(name string, up bool) error

SetState sets a links up or down.

type Iface

type Iface struct {
	HWAddr net.HardwareAddr
	Idx    int
	IPs    map[string]struct{}
	// contains filtered or unexported fields
}

Iface is a basic representation of a network interface.

Jump to

Keyboard shortcuts

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