bfd

package
v0.0.0-...-aba5cf6 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateAdminDown         State      = 0 // AdminDown
	StateDown              State      = 1 // Down
	StateInit              State      = 2 // Init
	StateUp                State      = 3 // Up
	DiagNone               Diagnostic = 0 // No Diagnostic
	DiagTimeExpired        Diagnostic = 1 // Control Detection Time Expired
	DiagEchoFailed         Diagnostic = 2 // Echo Function Failed
	DiagNeighborSignalDown Diagnostic = 3 // Neighbor Signaled Session Down
	DiagForwardPlaneReset  Diagnostic = 4 // Forwarding Plane Reset
	DiagPathDown           Diagnostic = 5 // Path Down
	DiagConcatPathDown     Diagnostic = 6 // Concatenated Path Down
	DiagAdminDown          Diagnostic = 7 // Administratively Down
	DiagRevConcatPathDown  Diagnostic = 8 // Reverse Concatenated Path Down
)

Variables

This section is empty.

Functions

func ControlPacketByteLength

func ControlPacketByteLength(data []byte) int

func GreaterUInt32

func GreaterUInt32(n ...uint32) uint32

func UniqueStringsSorted

func UniqueStringsSorted(str []string) []string

Types

type AuthType

type AuthType uint8
const (
	AuthTypeNone           AuthType = 0
	AuthTypeSimple         AuthType = 1 // Simple Password
	AuthTypeKeyedMd5       AuthType = 2 // Keyed MD5
	AuthTypeMeticulousMd5  AuthType = 3 // Meticulous Keyed MD5
	AuthTypeKeyedSha1      AuthType = 4 // Keyed SHA1
	AuthTypeMeticulousSha1 AuthType = 5 // Meticulous Keyed SHA1
)

type AuthenticationData

type AuthenticationData interface {
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
}

type AuthenticationSection

type AuthenticationSection struct {
	AuthType           AuthType
	AuthLen            uint8
	AuthenticationData *AuthenticationData
}

func (AuthenticationSection) MarshalBinary

func (authSect AuthenticationSection) MarshalBinary() (data []byte, err error)

func (*AuthenticationSection) UnmarshalBinary

func (authSect *AuthenticationSection) UnmarshalBinary(data []byte) error

type ControlPacket

type ControlPacket struct {
	Version                   uint8
	Diagnostic                Diagnostic
	State                     State
	Poll                      bool
	Final                     bool
	ControlPlaneIndependent   bool
	AuthenticationPresent     bool
	Demand                    bool
	Multipoint                bool
	DetectMult                uint8
	Length                    uint8
	MyDiscriminator           uint32
	YourDiscriminator         uint32
	DesiredMinTXInterval      uint32
	RequiredMinRXInterval     uint32
	RequiredMinEchoRXInterval uint32
	AuthenticationSection     *AuthenticationSection
}

func UnmarshalReceivedControlPacket

func UnmarshalReceivedControlPacket(data []byte) (cp *ControlPacket, err error)

func (*ControlPacket) MarshalBinary

func (cp *ControlPacket) MarshalBinary() (data []byte, err error)

func (*ControlPacket) UnmarshalBinary

func (cp *ControlPacket) UnmarshalBinary(data []byte) error

type Diagnostic

type Diagnostic uint8

type Session

type Session struct {

	// channels
	CpRxChan chan ControlPacket
	CpTxChan chan ControlPacket
	// contains filtered or unexported fields
}

func NewSession

func NewSession(conf SessionConfig, logger *zap.SugaredLogger) *Session

func (*Session) Close

func (s *Session) Close()

func (*Session) LocalDiscr

func (s *Session) LocalDiscr() uint32

func (*Session) ManipulateIntervals

func (s *Session) ManipulateIntervals(desiredMinTXInterval uint32, requiredMinRXInterval uint32) error

func (*Session) RemoteDiscr

func (s *Session) RemoteDiscr() uint32

func (*Session) SetAdminDown

func (s *Session) SetAdminDown(adminDown bool)

func (*Session) State

func (s *Session) State() State

type SessionConfig

type SessionConfig struct {
	LocalDiscr                uint32
	DesiredMinTxInterval      uint32
	RequiredMinRxInterval     uint32
	RequiredMinEchoRxInterval uint32
	DemandMode                bool
	DetectMult                uint8
	AuthType                  AuthType
	Role                      SessionRole
}

type SessionIntervalParams

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

type SessionRole

type SessionRole uint8
const (
	SessionRoleActive  SessionRole = iota
	SessionRolePassive SessionRole = iota
)

type State

type State uint8

func (State) String

func (s State) String() string

Jump to

Keyboard shortcuts

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