server

package
v0.0.3-pre8 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2022 License: Apache-2.0 Imports: 30 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// Administrative events
	ManualStart                               = 1
	ManualStop                                = 2
	AutomaticStart                            = 3
	ManualStartWithPassiveTcpEstablishment    = 4
	AutomaticStartWithPassiveTcpEstablishment = 5
	AutomaticStop                             = 8
	Cease                                     = 100
)
View Source
const (
	// BGPPORT is the port of the BGP protocol
	BGPPORT = 179
)
View Source
const (
	BGPVersion = 4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressFamilyConfig

type AddressFamilyConfig struct {
	ImportFilterChain filter.Chain
	ExportFilterChain filter.Chain
	AddPathSend       routingtable.ClientOptions
	AddPathRecv       bool
}

AddressFamilyConfig represents all configuration parameters specific for an address family

type BGPAPIServer

type BGPAPIServer struct {
	api.UnimplementedBgpServiceServer
	// contains filtered or unexported fields
}

func NewBGPAPIServer

func NewBGPAPIServer(s BGPServer) *BGPAPIServer

NewBGPAPIServer creates a new BGP API Server

func (*BGPAPIServer) DumpRIBIn

DumpRIBIn dumps the RIB in of a peer for a given AFI/SAFI

func (*BGPAPIServer) DumpRIBOut

DumpRIBOut dumps the RIB out of a peer for a given AFI/SAFI

func (*BGPAPIServer) ListSessions

type BGPServer

type BGPServer interface {
	RouterID() uint32
	Start() error
	AddPeer(PeerConfig) error
	GetPeerConfig(*bnet.IP) *PeerConfig
	DisposePeer(*bnet.IP)
	GetPeers() []*bnet.IP
	Metrics() (*metrics.BGPMetrics, error)
	GetRIBIn(peerIP *bnet.IP, afi uint16, safi uint8) *adjRIBIn.AdjRIBIn
	GetRIBOut(peerIP *bnet.IP, afi uint16, safi uint8) *adjRIBOut.AdjRIBOut
	ConnectMockPeer(peer PeerConfig, con net.Conn)
	ReplaceImportFilterChain(peer *bnet.IP, c filter.Chain) error
	ReplaceExportFilterChain(peer *bnet.IP, c filter.Chain) error
}

func NewBGPServer

func NewBGPServer(routerID uint32, addrs []string) BGPServer

NewBGPServer creates a new instance of bgpServer

type BMPServer

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

BMPServer represents a BMP server

func NewServer

func NewServer(keepalivePeriod time.Duration) *BMPServer

NewServer creates a new BMP server

func (*BMPServer) AddRouter

func (b *BMPServer) AddRouter(addr net.IP, port uint16, passive bool)

AddRouter adds a router to which we connect with BMP

func (*BMPServer) Close

func (b *BMPServer) Close() error

Close tears down all open connections

func (*BMPServer) GetRouter

func (b *BMPServer) GetRouter(name string) RouterInterface

GetRouter gets a router

func (*BMPServer) GetRouters

func (b *BMPServer) GetRouters() []RouterInterface

GetRouters gets all routers

func (*BMPServer) Listen

func (b *BMPServer) Listen(addr string) error

Listen starts a listener for routers to start the BMP connection the listener needs to be closed by calling Close() on the BMPServer

func (*BMPServer) Metrics

func (b *BMPServer) Metrics() (*metrics.BMPMetrics, error)

Metrics gets BMP server metrics

func (*BMPServer) RemoveRouter

func (b *BMPServer) RemoveRouter(addr net.IP)

RemoveRouter removes a BMP monitored router

type BMPServerInterface

type BMPServerInterface interface {
	GetRouter(rtr string) RouterInterface
	GetRouters() []RouterInterface
}

type FSM

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

FSM implements the BGP finite state machine (RFC4271)

func NewActiveFSM

func NewActiveFSM(peer *peer) *FSM

NewActiveFSM initiates a new passive FSM

func NewPassiveFSM

func NewPassiveFSM(peer *peer, con *net.TCPConn) *FSM

NewPassiveFSM initiates a new passive FSM

type PeerConfig

type PeerConfig struct {
	AuthenticationKey          string
	AdminEnabled               bool
	ReconnectInterval          time.Duration
	KeepAlive                  time.Duration
	HoldTime                   time.Duration
	LocalAddress               *bnet.IP
	PeerAddress                *bnet.IP
	TTL                        uint8
	LocalAS                    uint32
	PeerAS                     uint32
	Passive                    bool
	RouterID                   uint32
	RouteServerClient          bool
	RouteReflectorClient       bool
	RouteReflectorClusterID    uint32
	AdvertiseIPv4MultiProtocol bool
	IPv4                       *AddressFamilyConfig
	IPv6                       *AddressFamilyConfig
	VRF                        *vrf.VRF
	Description                string
}

PeerConfig defines the configuration for a BGP session

func (*PeerConfig) NeedsRestart

func (pc *PeerConfig) NeedsRestart(x *PeerConfig) bool

NeedsRestart determines if the peer needs a restart on cfg change

type Router

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

Router represents a BMP enabled route in BMP context

func (*Router) Address

func (r *Router) Address() net.IP

Address gets a routers address

func (*Router) GetVRF

func (r *Router) GetVRF(rd uint64) *vrf.VRF

GetVRF get's a VRF

func (*Router) GetVRFs

func (r *Router) GetVRFs() []*vrf.VRF

GetVRFs gets all VRFs

func (*Router) Name

func (r *Router) Name() string

Name gets a routers name

type RouterInterface

type RouterInterface interface {
	Name() string
	Address() net.IP
	GetVRF(vrfID uint64) *vrf.VRF
	GetVRFs() []*vrf.VRF
}

type TCPListener

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

TCPListener is a TCP listen wrapper

func NewTCPListener

func NewTCPListener(addr string, ch chan net.Conn) (*TCPListener, error)

NewTCPListener creates a new TCPListener

type UpdateSender

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

UpdateSender converts table changes into BGP update messages

func (*UpdateSender) AddPath

func (u *UpdateSender) AddPath(pfx *bnet.Prefix, p *route.Path) error

AddPath adds path p for pfx to toSend queue

func (*UpdateSender) AddPathInitialDump

func (u *UpdateSender) AddPathInitialDump(pfx *bnet.Prefix, p *route.Path) error

func (*UpdateSender) ClientCount

func (u *UpdateSender) ClientCount() uint64

ClientCount is here to satisfy an interface

func (*UpdateSender) Destroy

func (u *UpdateSender) Destroy()

Destroy destroys everything (with greetings to Hatebreed)

func (*UpdateSender) Dispose

func (u *UpdateSender) Dispose()

Dispose is here to fulfill an interface

func (*UpdateSender) Dump

func (u *UpdateSender) Dump() []*route.Route

Dump is here to fulfill an interface

func (*UpdateSender) RefreshRoute

func (a *UpdateSender) RefreshRoute(*net.Prefix, []*route.Path)

RefreshRoute is here to fultill an interface

func (*UpdateSender) Register

func (a *UpdateSender) Register(client routingtable.RouteTableClient)

Register registers a client for updates

func (*UpdateSender) RegisterWithOptions

func (a *UpdateSender) RegisterWithOptions(client routingtable.RouteTableClient, opt routingtable.ClientOptions)

RegisterWithOptions registers a client with options for updates

func (*UpdateSender) RemovePath

func (u *UpdateSender) RemovePath(pfx *bnet.Prefix, p *route.Path) bool

RemovePath withdraws prefix `pfx` from a peer

func (*UpdateSender) ReplaceFilterChain

func (a *UpdateSender) ReplaceFilterChain(c filter.Chain)

ReplaceFilterChain is here to fulfill an interface

func (*UpdateSender) ReplacePath

func (a *UpdateSender) ReplacePath(*net.Prefix, *route.Path, *route.Path)

ReplacePath is here to fulfill an interface

func (*UpdateSender) RouteCount

func (u *UpdateSender) RouteCount() int64

RouteCount returns the number of stored routes

func (*UpdateSender) Start

func (u *UpdateSender) Start(aggrTime time.Duration)

Start starts the update sender

func (*UpdateSender) Unregister

func (a *UpdateSender) Unregister(client routingtable.RouteTableClient)

Unregister unregisters a client

func (*UpdateSender) UpdateNewClient

func (u *UpdateSender) UpdateNewClient(client routingtable.RouteTableClient) error

UpdateNewClient does nothing

Jump to

Keyboard shortcuts

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