Documentation ¶
Index ¶
- Constants
- Variables
- func NewWatcher() *watcher
- type BfdApiServer
- func (a *BfdApiServer) AddPeer(ctx context.Context, req *api.AddPeerRequest) (*api.AddPeerResponse, error)
- func (a *BfdApiServer) DeletePeer(ctx context.Context, req *api.DeletePeerRequest) (*empty.Empty, error)
- func (a *BfdApiServer) DisablePeer(ctx context.Context, req *api.DisablePeerRequest) (*empty.Empty, error)
- func (a *BfdApiServer) EnablePeer(ctx context.Context, req *api.EnablePeerRequest) (*empty.Empty, error)
- func (a *BfdApiServer) GetPeerState(ctx context.Context, req *api.GetPeerStateRequest) (*api.PeerStateResponse, error)
- func (a *BfdApiServer) ListPeer(req *api.ListPeerRequest, stream api.BfdApi_ListPeerServer) error
- func (a *BfdApiServer) MonitorPeer(req *api.MonitorPeerRequest, stream api.BfdApi_MonitorPeerServer) error
- func (a *BfdApiServer) ServeApi(address string) error
- func (a *BfdApiServer) Start(ctx context.Context, req *api.StartRequest) (*empty.Empty, error)
- func (a *BfdApiServer) Stop(ctx context.Context, req *api.StopRequest) (*empty.Empty, error)
- func (a *BfdApiServer) StopApi()
- func (a *BfdApiServer) UpdatePeer(ctx context.Context, req *api.UpdatePeerRequest) (*empty.Empty, error)
- type BfdServer
- func (s *BfdServer) AddPeer(api_peer *api.Peer) (*Peer, error)
- func (s *BfdServer) DeletePeer(uuid []byte) error
- func (s *BfdServer) GetPeerByUuid(uuid []byte) (*Peer, error)
- func (s *BfdServer) ListPeer(ctx context.Context, cb func([]byte, *api.Peer) error) error
- func (s *BfdServer) Listen(address string) error
- func (s *BfdServer) MonitorPeer(ctx context.Context, uuid []byte, cb func(*api.PeerStateResponse) error) error
- func (s *BfdServer) Serve() error
- func (s *BfdServer) Shutdown()
- type BfdServerApi
- type Connection
- type Peer
- func (p *Peer) ApplyLocalState(updates []PeerStateUpdate)
- func (p *Peer) ApplyRemoteState(updates []PeerStateUpdate)
- func (p *Peer) Disable()
- func (p *Peer) Enable()
- func (p *Peer) GetAuthenticationType() bfd.AuthenticationType
- func (p *Peer) GetLocal() *PeerState
- func (p *Peer) GetRemote() *PeerState
- func (p *Peer) GetUuid() []byte
- func (p *Peer) NewPacket(poll bfd.Bool, final bfd.Bool) *bfd.ControlPacket
- func (p *Peer) NotifyWatchers(state *api.PeerStateResponse)
- func (p *Peer) Send(packet *bfd.ControlPacket) error
- func (p *Peer) SetDesiredMinTxInterval(desiredMinTx uint32)
- func (p *Peer) SetDetectMultiplier(detectMultiplier uint8)
- func (p *Peer) SetRequiredMinRxInterval(requiredMinRx uint32)
- func (p *Peer) Shutdown()
- func (p *Peer) Start()
- func (p *Peer) Watch() *watcher
- type PeerState
- func (state *PeerState) Clone(updates []PeerStateUpdate) *PeerState
- func (state *PeerState) GetDesiredMinTxInterval() uint32
- func (state *PeerState) GetDetectMultiplier() uint8
- func (state *PeerState) GetDiscriminator() uint32
- func (state *PeerState) GetRequiredMinRxInterval() uint32
- func (state *PeerState) ToApi() *api.PeerState
- type PeerStateUpdate
Constants ¶
View Source
const (
BFD_PORT = 3784
)
View Source
const (
// 20 seconds defined as micro seconds
OFFLINE_TIMEOUT = 20 * 1000 * 1000
)
Variables ¶
View Source
var ErrAddressNotChangeable = errors.New("Unable to change peer address")
View Source
var ErrInvalidAddress = errors.New("Invalid address passed")
View Source
var ErrInvalidDetectMultiplier = errors.New("Invalid detect multiplier")
View Source
var ErrInvalidDetectionMultiplierSupplied = errors.New("Invalid Detection Multiplier supplied")
View Source
var ErrInvalidIP = errors.New("Invalid IP passed")
View Source
var ErrInvalidMultiPoint = errors.New("Invalid Multipoint value")
View Source
var ErrInvalidMyDiscriminator = errors.New("Invalid MyDiscriminator value")
View Source
var ErrInvalidPacket = errors.New("Discarded Packet: Packet invalid")
View Source
var ErrInvalidPort = errors.New("Invalid port passed, should be between 1 and 65535")
View Source
var ErrInvalidTTL = errors.New("Invalid TTL received")
View Source
var ErrInvalidVersion = errors.New("Invalid Version")
View Source
var ErrInvalidYourDiscriminator = errors.New("Invalid YourDiscriminator (=0) for state")
View Source
var ErrMultiphopNotChangeable = errors.New("Unable to change multi hop")
View Source
var ErrNotImplemented = errors.New("Function not implemented")
View Source
var ErrPeerNotFound = errors.New("Unable to find peer")
View Source
var ErrSessionAdminDown = errors.New("Peer is state is admin down")
View Source
var ErrYourDiscriminatorNotFound = errors.New("Discarded Packet: YourDiscriminator not found")
Functions ¶
func NewWatcher ¶
func NewWatcher() *watcher
Types ¶
type BfdApiServer ¶
type BfdApiServer struct {
// contains filtered or unexported fields
}
func NewBfdApiServer ¶
func NewBfdApiServer(server BfdServerApi, grpc *grpc.Server) *BfdApiServer
func (*BfdApiServer) AddPeer ¶
func (a *BfdApiServer) AddPeer(ctx context.Context, req *api.AddPeerRequest) (*api.AddPeerResponse, error)
func (*BfdApiServer) DeletePeer ¶
func (a *BfdApiServer) DeletePeer(ctx context.Context, req *api.DeletePeerRequest) (*empty.Empty, error)
func (*BfdApiServer) DisablePeer ¶
func (a *BfdApiServer) DisablePeer(ctx context.Context, req *api.DisablePeerRequest) (*empty.Empty, error)
func (*BfdApiServer) EnablePeer ¶
func (a *BfdApiServer) EnablePeer(ctx context.Context, req *api.EnablePeerRequest) (*empty.Empty, error)
func (*BfdApiServer) GetPeerState ¶
func (a *BfdApiServer) GetPeerState(ctx context.Context, req *api.GetPeerStateRequest) (*api.PeerStateResponse, error)
func (*BfdApiServer) ListPeer ¶
func (a *BfdApiServer) ListPeer(req *api.ListPeerRequest, stream api.BfdApi_ListPeerServer) error
func (*BfdApiServer) MonitorPeer ¶
func (a *BfdApiServer) MonitorPeer(req *api.MonitorPeerRequest, stream api.BfdApi_MonitorPeerServer) error
func (*BfdApiServer) ServeApi ¶
func (a *BfdApiServer) ServeApi(address string) error
func (*BfdApiServer) Start ¶
func (a *BfdApiServer) Start(ctx context.Context, req *api.StartRequest) (*empty.Empty, error)
func (*BfdApiServer) Stop ¶
func (a *BfdApiServer) Stop(ctx context.Context, req *api.StopRequest) (*empty.Empty, error)
func (*BfdApiServer) StopApi ¶
func (a *BfdApiServer) StopApi()
func (*BfdApiServer) UpdatePeer ¶
func (a *BfdApiServer) UpdatePeer(ctx context.Context, req *api.UpdatePeerRequest) (*empty.Empty, error)
type BfdServer ¶
type BfdServer struct { sync.RWMutex Sessions map[uint32]*Peer // contains filtered or unexported fields }
func NewBfdServer ¶
func NewBfdServer() *BfdServer
func (*BfdServer) DeletePeer ¶
func (*BfdServer) MonitorPeer ¶
type BfdServerApi ¶
type Connection ¶
type Peer ¶
type Peer struct { sync.RWMutex Name string Address *net.UDPAddr SourcePort int // Set up interval Interval uint32 AuthType bfd.AuthenticationType // 0 = no authentication ReceivedAuthSequence uint32 XmitAuthSeq uint32 // needs to be initialized with random 32 bit value AuthSequenceKnown uint32 // reset to 0 if no packets are received in 2 * DetectionTime (Interval * Multiplier) PollActive bool IsMultiHop bool // contains filtered or unexported fields }
func (*Peer) ApplyLocalState ¶
func (p *Peer) ApplyLocalState(updates []PeerStateUpdate)
func (*Peer) ApplyRemoteState ¶
func (p *Peer) ApplyRemoteState(updates []PeerStateUpdate)
func (*Peer) GetAuthenticationType ¶
func (p *Peer) GetAuthenticationType() bfd.AuthenticationType
func (*Peer) NotifyWatchers ¶
func (p *Peer) NotifyWatchers(state *api.PeerStateResponse)
func (*Peer) SetDesiredMinTxInterval ¶
func (*Peer) SetDetectMultiplier ¶
func (*Peer) SetRequiredMinRxInterval ¶
type PeerState ¶
type PeerState struct {
// contains filtered or unexported fields
}
func (*PeerState) Clone ¶
func (state *PeerState) Clone(updates []PeerStateUpdate) *PeerState
Clone creates a copy and applies the passed state updates
func (*PeerState) GetDesiredMinTxInterval ¶
func (*PeerState) GetDetectMultiplier ¶
func (*PeerState) GetDiscriminator ¶
func (*PeerState) GetRequiredMinRxInterval ¶
type PeerStateUpdate ¶
type PeerStateUpdate func(*PeerState)
Click to show internal directories.
Click to hide internal directories.