device

package
v0.0.3-pre4.0...-0ec3cfc Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IfOperUnknown        = 0
	IfOperNotPresent     = 1
	IfOperDown           = 2
	IfOperLowerLayerDown = 3
	IfOperTesting        = 4
	IfOperDormant        = 5
	IfOperUp             = 6
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	DeviceUpdate(*Device)
}

Client represents a client of the device server

type Device

type Device struct {
	Name         string
	Index        uint64
	MTU          uint16
	HardwareAddr net.HardwareAddr
	Flags        net.Flags
	OperState    uint8
	Addrs        []*bnet.Prefix
	// contains filtered or unexported fields
}

Device represents a network device

type MockServer

type MockServer struct {
	Called            bool
	UnsubscribeCalled bool
	C                 Client
	Name              string
	UnsubscribeName   string
}

func (*MockServer) Subscribe

func (ms *MockServer) Subscribe(c Client, n string)

func (*MockServer) Unsubscribe

func (ms *MockServer) Unsubscribe(c Client, n string)

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server represents a device server

func New

func New() (*Server, error)

New creates a new device server

func (*Server) Start

func (ds *Server) Start() error

Start starts the device server

func (*Server) Stop

func (ds *Server) Stop()

Stop stops the device server

func (*Server) Subscribe

func (ds *Server) Subscribe(client Client, devName string)

Subscribe allows a client to subscribe for status updates on interface `devName`

func (*Server) Unsubscribe

func (ds *Server) Unsubscribe(client Client, devName string)

Unsubscribe unsubscribes a client

type Updater

type Updater interface {
	Subscribe(Client, string)
	Unsubscribe(Client, string)
}

Updater is a device updater interface

Jump to

Keyboard shortcuts

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