speaker

package
v0.0.0-...-2275388 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SartDefaultEndpointPort uint32 = 5000
)

Variables

View Source
var (
	PeerStateIdle        = PeerState("Idle")
	PeerStateConnect     = PeerState("Connect")
	PeerStateActive      = PeerState("Active")
	PeerStateOpenSent    = PeerState("OpenSent")
	PeerStateOpenConfirm = PeerState("OpenConfirm")
	PeerStateEstablished = PeerState("Established")
)

Functions

func ClearMockSpeakerStore

func ClearMockSpeakerStore()

Types

type Mock

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

func (*Mock) AddPath

func (s *Mock) AddPath(ctx context.Context, path PathInfo) error

func (*Mock) AddPeer

func (s *Mock) AddPeer(ctx context.Context, peer PeerInfo) error

func (*Mock) DeletePath

func (s *Mock) DeletePath(ctx context.Context, path PathInfo) error

func (*Mock) DeletePeer

func (s *Mock) DeletePeer(ctx context.Context, peer string) error

func (*Mock) GetInfo

func (s *Mock) GetInfo(ctx context.Context) (*SpeakerInfo, error)

func (*Mock) GetPeer

func (s *Mock) GetPeer(ctx context.Context, peer string) (*PeerInfo, error)

func (*Mock) HealthCheck

func (s *Mock) HealthCheck(ctx context.Context) error

func (*Mock) SetInfo

func (s *Mock) SetInfo(ctx context.Context, info SpeakerInfo) error

type PathInfo

type PathInfo struct {
	Prefix    string
	Protocol  string
	Origin    string
	LocalPref uint32
}

func GetMockSpeakerPath

func GetMockSpeakerPath(speakerKey, pathKey string) (*PathInfo, error)

type PeerInfo

type PeerInfo struct {
	LocalAsn      uint32
	LocalRouterId string
	PeerAsn       uint32
	PeerRouterId  string
	Protocol      string
	State         PeerState
	Uptime        time.Time
}

func GetMockSpeakerPeer

func GetMockSpeakerPeer(speakerKey, peerKey string) (*PeerInfo, error)

type PeerState

type PeerState string

type Speaker

type Speaker interface {
	HealthCheck(context.Context) error
	GetInfo(context.Context) (*SpeakerInfo, error)
	SetInfo(context.Context, SpeakerInfo) error
	GetPeer(context.Context, string) (*PeerInfo, error)
	AddPeer(context.Context, PeerInfo) error
	DeletePeer(context.Context, string) error
	AddPath(context.Context, PathInfo) error
	DeletePath(context.Context, PathInfo) error
}

func New

func New(typ SpeakerType, endpointAddr string, endpointPort uint32) Speaker

type SpeakerInfo

type SpeakerInfo struct {
	Asn      uint32
	RouterId string
}

type SpeakerType

type SpeakerType string
var (
	SpeakerTypeUnknown SpeakerType = SpeakerType("unknown")
	SpeakerTypeSart    SpeakerType = SpeakerType("sart")
	SpeakerTypeMock    SpeakerType = SpeakerType("mock")
)

func ParseSpeakerType

func ParseSpeakerType(t string) (SpeakerType, error)

Jump to

Keyboard shortcuts

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