server

package
v0.0.0-...-f4239b7 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2017 License: Apache-2.0, Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MEATUREMENT_UPDATE = "update"
	MEATUREMENT_PEER   = "peer"
	MEATUREMENT_TABLE  = "table"
)
View Source
const (
	FSM_DYING                   = "dying"
	FSM_ADMIN_DOWN              = "admin-down"
	FSM_READ_FAILED             = "read-failed"
	FSM_WRITE_FAILED            = "write-failed"
	FSM_NOTIFICATION_SENT       = "notification-sent"
	FSM_NOTIFICATION_RECV       = "notification-received"
	FSM_HOLD_TIMER_EXPIRED      = "hold-timer-expired"
	FSM_IDLE_HOLD_TIMER_EXPIRED = "idle-hold-timer-expired"
	FSM_RESTART_TIMER_EXPIRED   = "restart-timer-expired"
	FSM_GRACEFUL_RESTART        = "graceful-restart"
	FSM_INVALID_MSG             = "invalid-msg"
	FSM_NEW_CONNECTION          = "new-connection"
	FSM_OPEN_MSG_RECEIVED       = "open-msg-received"
	FSM_OPEN_MSG_NEGOTIATED     = "open-msg-negotiated"
)
View Source
const (
	HOLDTIME_OPENSENT = 240
	HOLDTIME_IDLE     = 5
)
View Source
const (
	FLOP_THRESHOLD    = time.Second * 30
	MIN_CONNECT_RETRY = 10
)
View Source
const (
	TCP_MD5SIG = 14
)

Variables

This section is empty.

Functions

func DialTCPTimeoutWithMD5Sig

func DialTCPTimeoutWithMD5Sig(host string, port int, localAddr, key string, msec int) (*net.TCPConn, error)

func NewROAManager

func NewROAManager(as uint32) (*roaManager, error)

func NewRoaClient

func NewRoaClient(address, port string, ch chan *ROAEvent, lifetime int64) *roaClient

func SetTcpMD5SigSockopts

func SetTcpMD5SigSockopts(l *net.TCPListener, address string, key string) error

func SetTcpTTLSockopts

func SetTcpTTLSockopts(conn *net.TCPConn, ttl int) error

Types

type AdminState

type AdminState int
const (
	ADMIN_STATE_UP AdminState = iota
	ADMIN_STATE_DOWN
	ADMIN_STATE_PFX_CT
)

func (AdminState) String

func (s AdminState) String() string

type BgpServer

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

func NewBgpServer

func NewBgpServer() *BgpServer

func (*BgpServer) AddBmp

func (s *BgpServer) AddBmp(c *config.BmpServerConfig) (err error)

func (*BgpServer) AddDefinedSet

func (s *BgpServer) AddDefinedSet(a table.DefinedSet) (err error)

func (*BgpServer) AddNeighbor

func (s *BgpServer) AddNeighbor(c *config.Neighbor) (err error)

func (*BgpServer) AddPath

func (s *BgpServer) AddPath(vrfId string, pathList []*table.Path) (uuidBytes []byte, err error)

func (*BgpServer) AddPolicy

func (s *BgpServer) AddPolicy(x *table.Policy, refer bool) (err error)

func (*BgpServer) AddPolicyAssignment

func (s *BgpServer) AddPolicyAssignment(name string, dir table.PolicyDirection, policies []*config.PolicyDefinition, def table.RouteType) (err error)

func (*BgpServer) AddRpki

func (s *BgpServer) AddRpki(c *config.RpkiServerConfig) (err error)

func (*BgpServer) AddStatement

func (s *BgpServer) AddStatement(st *table.Statement) (err error)

func (*BgpServer) AddVrf

func (*BgpServer) DeleteBmp

func (s *BgpServer) DeleteBmp(c *config.BmpServerConfig) (err error)

func (*BgpServer) DeleteDefinedSet

func (s *BgpServer) DeleteDefinedSet(a table.DefinedSet, all bool) (err error)

func (*BgpServer) DeleteNeighbor

func (s *BgpServer) DeleteNeighbor(c *config.Neighbor) (err error)

func (*BgpServer) DeletePath

func (s *BgpServer) DeletePath(uuid []byte, f bgp.RouteFamily, vrfId string, pathList []*table.Path) (err error)

func (*BgpServer) DeletePolicy

func (s *BgpServer) DeletePolicy(x *table.Policy, all, preserve bool) (err error)

func (*BgpServer) DeletePolicyAssignment

func (s *BgpServer) DeletePolicyAssignment(name string, dir table.PolicyDirection, policies []*config.PolicyDefinition, all bool) (err error)

func (*BgpServer) DeleteRpki

func (s *BgpServer) DeleteRpki(c *config.RpkiServerConfig) (err error)

func (*BgpServer) DeleteStatement

func (s *BgpServer) DeleteStatement(st *table.Statement, all bool) (err error)

func (*BgpServer) DeleteVrf

func (s *BgpServer) DeleteVrf(name string) (err error)

func (*BgpServer) DisableMrt

func (s *BgpServer) DisableMrt(c *config.MrtConfig) (err error)

func (*BgpServer) DisableNeighbor

func (s *BgpServer) DisableNeighbor(addr string) (err error)

func (*BgpServer) DisableRpki

func (s *BgpServer) DisableRpki(c *config.RpkiServerConfig) (err error)

func (*BgpServer) EnableMrt

func (s *BgpServer) EnableMrt(c *config.MrtConfig) (err error)

func (*BgpServer) EnableNeighbor

func (s *BgpServer) EnableNeighbor(addr string) (err error)

func (*BgpServer) EnableRpki

func (s *BgpServer) EnableRpki(c *config.RpkiServerConfig) (err error)

func (*BgpServer) GetAdjRib

func (s *BgpServer) GetAdjRib(addr string, family bgp.RouteFamily, in bool, prefixes []*table.LookupPrefix) (rib *table.Table, err error)

func (*BgpServer) GetDefinedSet

func (s *BgpServer) GetDefinedSet(typ table.DefinedType) (sets *config.DefinedSets, err error)

func (*BgpServer) GetNeighbor

func (s *BgpServer) GetNeighbor() (l []*config.Neighbor)

func (*BgpServer) GetPolicy

func (s *BgpServer) GetPolicy() (l []*config.PolicyDefinition)

func (*BgpServer) GetPolicyAssignment

func (s *BgpServer) GetPolicyAssignment(name string, dir table.PolicyDirection) (rt table.RouteType, l []*config.PolicyDefinition, err error)

func (*BgpServer) GetRib

func (s *BgpServer) GetRib(addr string, family bgp.RouteFamily, prefixes []*table.LookupPrefix) (rib *table.Table, err error)

func (*BgpServer) GetRoa

func (s *BgpServer) GetRoa(family bgp.RouteFamily) (l []*ROA, err error)

func (*BgpServer) GetRpki

func (s *BgpServer) GetRpki() (l []*config.RpkiServer, err error)

func (*BgpServer) GetServer

func (s *BgpServer) GetServer() (c *config.Global)

func (*BgpServer) GetStatement

func (s *BgpServer) GetStatement() (l []*config.Statement)

func (*BgpServer) GetVrf

func (s *BgpServer) GetVrf() (l []*table.Vrf)

func (*BgpServer) GetVrfRib

func (s *BgpServer) GetVrfRib(name string, family bgp.RouteFamily, prefixes []*table.LookupPrefix) (rib *table.Table, err error)

func (*BgpServer) Listeners

func (server *BgpServer) Listeners(addr string) []*net.TCPListener

func (*BgpServer) RSimportPaths

func (server *BgpServer) RSimportPaths(peer *Peer, pathList []*table.Path) []*table.Path

func (*BgpServer) ReplaceDefinedSet

func (s *BgpServer) ReplaceDefinedSet(a table.DefinedSet) (err error)

func (*BgpServer) ReplacePolicy

func (s *BgpServer) ReplacePolicy(x *table.Policy, refer, preserve bool) (err error)

func (*BgpServer) ReplacePolicyAssignment

func (s *BgpServer) ReplacePolicyAssignment(name string, dir table.PolicyDirection, policies []*config.PolicyDefinition, def table.RouteType) (err error)

func (*BgpServer) ReplaceStatement

func (s *BgpServer) ReplaceStatement(st *table.Statement) (err error)

func (*BgpServer) ResetNeighbor

func (s *BgpServer) ResetNeighbor(addr string) (err error)

func (*BgpServer) ResetRpki

func (s *BgpServer) ResetRpki(c *config.RpkiServerConfig) (err error)

func (*BgpServer) Serve

func (server *BgpServer) Serve()

func (*BgpServer) Shutdown

func (s *BgpServer) Shutdown()

func (*BgpServer) ShutdownNeighbor

func (s *BgpServer) ShutdownNeighbor(addr string) (err error)

func (*BgpServer) SoftReset

func (s *BgpServer) SoftReset(addr string, family bgp.RouteFamily) (err error)

func (*BgpServer) SoftResetIn

func (s *BgpServer) SoftResetIn(addr string, family bgp.RouteFamily) (err error)

func (*BgpServer) SoftResetOut

func (s *BgpServer) SoftResetOut(addr string, family bgp.RouteFamily) (err error)

func (*BgpServer) SoftResetRpki

func (s *BgpServer) SoftResetRpki(c *config.RpkiServerConfig) (err error)

func (*BgpServer) Start

func (s *BgpServer) Start(c *config.Global) (err error)

func (*BgpServer) StartCollector

func (s *BgpServer) StartCollector(c *config.CollectorConfig) (err error)

func (*BgpServer) StartZebraClient

func (s *BgpServer) StartZebraClient(c *config.ZebraConfig) (err error)

func (*BgpServer) Stop

func (s *BgpServer) Stop() (err error)

func (*BgpServer) UpdateNeighbor

func (s *BgpServer) UpdateNeighbor(c *config.Neighbor) (policyUpdated bool, err error)

func (*BgpServer) UpdatePolicy

func (s *BgpServer) UpdatePolicy(policy config.RoutingPolicy) (err error)

func (*BgpServer) ValidateRib

func (s *BgpServer) ValidateRib(prefix string) (err error)

func (*BgpServer) Watch

func (s *BgpServer) Watch(opts ...WatchOption) (w *Watcher)

type Collector

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

func NewCollector

func NewCollector(s *BgpServer, url, dbName string, interval uint64) (*Collector, error)

type FSM

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

func NewFSM

func NewFSM(gConf *config.Global, pConf *config.Neighbor, policy *table.RoutingPolicy) *FSM

func (*FSM) LocalHostPort

func (fsm *FSM) LocalHostPort() (string, uint16)

func (*FSM) RemoteHostPort

func (fsm *FSM) RemoteHostPort() (string, uint16)

func (*FSM) StateChange

func (fsm *FSM) StateChange(nextState bgp.FSMState)

type FSMHandler

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

func NewFSMHandler

func NewFSMHandler(fsm *FSM, incoming *channels.InfiniteChannel, stateCh chan *FsmMsg, outgoing *channels.InfiniteChannel) *FSMHandler

type FsmMsg

type FsmMsg struct {
	MsgType  FsmMsgType
	MsgSrc   string
	MsgData  interface{}
	PathList []*table.Path

	Version uint
	// contains filtered or unexported fields
}

type FsmMsgType

type FsmMsgType int
const (
	FSM_MSG_STATE_CHANGE FsmMsgType
	FSM_MSG_BGP_MESSAGE
	FSM_MSG_ROUTE_REFRESH
)

type FsmOutgoingMsg

type FsmOutgoingMsg struct {
	Paths        []*table.Path
	Notification *bgp.BGPMessage
	StayIdle     bool
}

type FsmStateReason

type FsmStateReason string

type Peer

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

func NewPeer

func NewPeer(g *config.Global, conf *config.Neighbor, loc *table.TableManager, policy *table.RoutingPolicy) *Peer

func (*Peer) DropAll

func (peer *Peer) DropAll(rfList []bgp.RouteFamily)

func (*Peer) ID

func (peer *Peer) ID() string

func (*Peer) PassConn

func (peer *Peer) PassConn(conn *net.TCPConn)

func (*Peer) StaleAll

func (peer *Peer) StaleAll(rfList []bgp.RouteFamily)

func (*Peer) TableID

func (peer *Peer) TableID() string

func (*Peer) ToConfig

func (peer *Peer) ToConfig() *config.Neighbor

type ROA

type ROA struct {
	Family int
	Prefix *ipPrefix
	MaxLen uint8
	AS     uint32
	Src    string
}

func NewROA

func NewROA(family int, prefixByte []byte, prefixLen uint8, maxLen uint8, as uint32, src string) *ROA

func (*ROA) Equal

func (r *ROA) Equal(roa *ROA) bool

type ROAEvent

type ROAEvent struct {
	EventType ROAEventType
	Src       string
	Data      []byte
	// contains filtered or unexported fields
}

type ROAEventType

type ROAEventType uint8
const (
	CONNECTED ROAEventType = iota
	DISCONNECTED
	RTR
	LIFETIMEOUT
)

type TCPListener

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

func NewTCPListener

func NewTCPListener(address string, port uint32, ch chan *net.TCPConn) (*TCPListener, error)

avoid mapped IPv6 address

func (*TCPListener) Close

func (l *TCPListener) Close() error

type WatchEvent

type WatchEvent interface {
}

type WatchEventAdjIn

type WatchEventAdjIn struct {
	PathList []*table.Path
}

type WatchEventBestPath

type WatchEventBestPath struct {
	PathList      []*table.Path
	MultiPathList [][]*table.Path
}

type WatchEventPeerState

type WatchEventPeerState struct {
	PeerAS       uint32
	LocalAS      uint32
	PeerAddress  net.IP
	LocalAddress net.IP
	PeerPort     uint16
	LocalPort    uint16
	PeerID       net.IP
	SentOpen     *bgp.BGPMessage
	RecvOpen     *bgp.BGPMessage
	State        bgp.FSMState
	AdminState   AdminState
	Timestamp    time.Time
}

type WatchEventTable

type WatchEventTable struct {
	RouterId string
	PathList map[string][]*table.Path
	Neighbor []*config.Neighbor
}

type WatchEventType

type WatchEventType string
const (
	WATCH_EVENT_TYPE_BEST_PATH   WatchEventType = "bestpath"
	WATCH_EVENT_TYPE_PRE_UPDATE  WatchEventType = "preupdate"
	WATCH_EVENT_TYPE_POST_UPDATE WatchEventType = "postupdate"
	WATCH_EVENT_TYPE_PEER_STATE  WatchEventType = "peerstate"
	WATCH_EVENT_TYPE_TABLE       WatchEventType = "table"
)

type WatchEventUpdate

type WatchEventUpdate struct {
	Message      *bgp.BGPMessage
	PeerAS       uint32
	LocalAS      uint32
	PeerAddress  net.IP
	LocalAddress net.IP
	PeerID       net.IP
	FourBytesAs  bool
	Timestamp    time.Time
	Payload      []byte
	PostPolicy   bool
	PathList     []*table.Path
}

type WatchOption

type WatchOption func(*watchOptions)

func WatchBestPath

func WatchBestPath() WatchOption

func WatchPeerState

func WatchPeerState(current bool) WatchOption

func WatchPostUpdate

func WatchPostUpdate(current bool) WatchOption

func WatchTableName

func WatchTableName(name string) WatchOption

func WatchUpdate

func WatchUpdate(current bool) WatchOption

type Watcher

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

func (*Watcher) Event

func (w *Watcher) Event() <-chan WatchEvent

func (*Watcher) Generate

func (w *Watcher) Generate(t WatchEventType) (err error)

func (*Watcher) Stop

func (w *Watcher) Stop()

Jump to

Keyboard shortcuts

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