bfd

package
v0.0.0-...-5d09e29 Latest Latest
Warning

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

Go to latest
Published: May 15, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MINIMUM_SIZE = 24
	MAXIMUM_SIZE = MINIMUM_SIZE + 28 // 24 bfd packet min size + 28 auth header max size
)

Variables

View Source
var ErrInvalidAuthenticationType = errors.New("AuthenticationType is invalid")
View Source
var ErrInvalidPacketLength = errors.New("Invalid packet length")
View Source
var ErrPasswordInvalidLength = errors.New("Password needs to be between 1 and 16")

Functions

This section is empty.

Types

type AuthenticationHeader

type AuthenticationHeader interface {
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler

	IsValid(key []byte, packet []byte) bool
	GetAuthenticationType() AuthenticationType
}

type AuthenticationType

type AuthenticationType int8
const (
	Reserved            AuthenticationType = 0
	SimplePassword      AuthenticationType = 1
	KeyedMD5            AuthenticationType = 2
	MeticulousKeyedMD5  AuthenticationType = 3
	KeyedSHA1           AuthenticationType = 4
	MeticulousKeyedSHA1 AuthenticationType = 5
)

func (AuthenticationType) String

func (a AuthenticationType) String() string

type Bool

type Bool int8
const (
	No  Bool = 0
	Yes Bool = 1
)

type ControlPacket

type ControlPacket struct {
	Version                 int8 // version 1 by default
	DiagnosticCode          DiagnosticCode
	State                   SessionState
	Poll                    Bool // requests a Final bit packet
	Final                   Bool // required in response to poll
	ControlPlaneIndependent Bool //
	Demand                  Bool // stop sending control packets (we know we are up)
	Multipoint              Bool // needs to be zero
	DetectMultiplier        uint8
	MyDiscriminator         uint32
	YourDiscriminator       uint32
	DesiredMinTxInterval    uint32
	RequiredMinRxInterval   uint32
	RequiredMinEchoInterval uint32

	AuthenticationHeader AuthenticationHeader
}

func (*ControlPacket) GetAuthenticationType

func (c *ControlPacket) GetAuthenticationType() AuthenticationType

func (*ControlPacket) MarshalBinary

func (c *ControlPacket) MarshalBinary() ([]byte, error)

func (*ControlPacket) UnmarshalBinary

func (c *ControlPacket) UnmarshalBinary(buf []byte) error

type DiagnosticCode

type DiagnosticCode int8
const (
	NoDiagnostic                DiagnosticCode = 0
	ControlDetectionTimeExpired DiagnosticCode = 1
	EchoFunctionFailed          DiagnosticCode = 2
	NeighborSignaledSessionDown DiagnosticCode = 3
	ForwardingPlaneReset        DiagnosticCode = 4
	PathDown                    DiagnosticCode = 5
	ConcatenatedPathDown        DiagnosticCode = 6
	AdministrativelyDown        DiagnosticCode = 7
	ReverseConcatenatedPathDown DiagnosticCode = 8
)

func (DiagnosticCode) String

func (d DiagnosticCode) String() string

type KeyedMD5Header

type KeyedMD5Header struct {
	AuthType AuthenticationType
	// Length int8 = inferred
	AuthKeyId      int8
	SequenceNumber int32
	AuthKey        []byte // 16 bytes long
}

type KeyedSHA1Header

type KeyedSHA1Header struct {
	AuthType AuthenticationType
	// Length int8 = inferred
	AuthKeyId      int8
	SequenceNumber int32
	AuthKey        []byte // 20 bytes long
}

type SessionState

type SessionState int8
const (
	AdminDown SessionState = 0
	Down      SessionState = 1
	Init      SessionState = 2
	Up        SessionState = 3
)

func (SessionState) String

func (s SessionState) String() string

type SimplePasswordHeader

type SimplePasswordHeader struct {
	AuthKeyId int8
	Password  string // between 1 and 16 characters
}

func (*SimplePasswordHeader) GetAuthenticationType

func (s *SimplePasswordHeader) GetAuthenticationType() AuthenticationType

func (*SimplePasswordHeader) IsValid

func (s *SimplePasswordHeader) IsValid(key []byte, packet []byte) bool

func (*SimplePasswordHeader) MarshalBinary

func (s *SimplePasswordHeader) MarshalBinary() ([]byte, error)

func (*SimplePasswordHeader) UnmarshalBinary

func (s *SimplePasswordHeader) UnmarshalBinary(buf []byte) error

Jump to

Keyboard shortcuts

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