server

package
v0.0.0-...-7dcbffe Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2017 License: 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"
	FSM_HARD_RESET              = "hard-reset"
)
View Source
const (
	HOLDTIME_OPENSENT = 240
	HOLDTIME_IDLE     = 5
)
View Source
const (
	MIN_ROTATION_INTERVAL = 60
	MIN_DUMP_INTERVAL     = 60
)
View Source
const (
	FLOP_THRESHOLD    = time.Second * 30
	MIN_CONNECT_RETRY = 10
)
View Source
const (
	TCP_MD5SIG       = 14 // TCP MD5 Signature (RFC2385)
	IPV6_MINHOPCOUNT = 73 // Generalized TTL Security Mechanism (RFC5082)
)
View Source
const (
	CONNECT_RETRY_INTERVAL = 30
)

Variables

This section is empty.

Functions

func NewROAManager

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

func NewRoaClient

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

func SetListenTcpTTLSockopt

func SetListenTcpTTLSockopt(l *net.TCPListener, ttl int) error

func SetTcpMD5SigSockopt

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

func SetTcpMinTTLSockopt

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

func SetTcpTTLSockopt

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

func ValidatePath

func ValidatePath(ownAs uint32, tree *radix.Tree, cidr string, asPath *bgp.PathAttributeAsPath) *table.Validation

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 AdminStateOperation

type AdminStateOperation struct {
	State         AdminState
	Communication []byte
}

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) error

func (*BgpServer) AddDefinedSet

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

func (*BgpServer) AddDynamicNeighbor

func (s *BgpServer) AddDynamicNeighbor(c *config.DynamicNeighbor) error

func (*BgpServer) AddNeighbor

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

func (*BgpServer) AddPath

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

func (*BgpServer) AddPeerGroup

func (s *BgpServer) AddPeerGroup(c *config.PeerGroup) error

func (*BgpServer) AddPolicy

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

func (*BgpServer) AddPolicyAssignment

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

func (*BgpServer) AddRpki

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

func (*BgpServer) AddStatement

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

func (*BgpServer) AddVrf

func (*BgpServer) DeleteBmp

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

func (*BgpServer) DeleteDefinedSet

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

func (*BgpServer) DeleteNeighbor

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

func (*BgpServer) DeletePath

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

func (*BgpServer) DeletePeerGroup

func (s *BgpServer) DeletePeerGroup(c *config.PeerGroup) error

func (*BgpServer) DeletePolicy

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

func (*BgpServer) DeletePolicyAssignment

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

func (*BgpServer) DeleteRpki

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

func (*BgpServer) DeleteStatement

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

func (*BgpServer) DeleteVrf

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

func (*BgpServer) DisableMrt

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

func (*BgpServer) DisableNeighbor

func (s *BgpServer) DisableNeighbor(addr, communication string) error

func (*BgpServer) DisableRpki

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

func (*BgpServer) EnableMrt

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

func (*BgpServer) EnableNeighbor

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

func (*BgpServer) EnableRpki

func (s *BgpServer) EnableRpki(c *config.RpkiServerConfig) 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) GetAdjRibInfo

func (s *BgpServer) GetAdjRibInfo(addr string, family bgp.RouteFamily, in bool) (info *table.TableInfo, err error)

func (*BgpServer) GetDefinedSet

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

func (*BgpServer) GetNeighbor

func (s *BgpServer) GetNeighbor(address string, getAdvertised bool) (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) GetRibInfo

func (s *BgpServer) GetRibInfo(addr string, family bgp.RouteFamily) (info *table.TableInfo, err error)

func (*BgpServer) GetRoa

func (s *BgpServer) GetRoa(family bgp.RouteFamily) (l []*table.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) error

func (*BgpServer) ReplacePolicy

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

func (*BgpServer) ReplacePolicyAssignment

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

func (*BgpServer) ReplaceStatement

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

func (*BgpServer) ResetNeighbor

func (s *BgpServer) ResetNeighbor(addr, communication string) error

func (*BgpServer) ResetRpki

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

func (*BgpServer) Serve

func (server *BgpServer) Serve()

func (*BgpServer) Shutdown

func (s *BgpServer) Shutdown()

func (*BgpServer) ShutdownNeighbor

func (s *BgpServer) ShutdownNeighbor(addr, communication string) error

func (*BgpServer) SoftReset

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

func (*BgpServer) SoftResetIn

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

func (*BgpServer) SoftResetOut

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

func (*BgpServer) SoftResetRpki

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

func (*BgpServer) Start

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

func (*BgpServer) StartCollector

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

func (*BgpServer) StartZebraClient

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

func (*BgpServer) Stop

func (s *BgpServer) Stop() error

func (*BgpServer) UpdateNeighbor

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

func (*BgpServer) UpdatePath

func (s *BgpServer) UpdatePath(vrfId string, pathList []*table.Path) error

func (*BgpServer) UpdatePeerGroup

func (s *BgpServer) UpdatePeerGroup(pg *config.PeerGroup) (needsSoftResetIn bool, err error)

func (*BgpServer) UpdatePolicy

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

func (*BgpServer) ValidateRib

func (s *BgpServer) ValidateRib(prefix string) 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(getAdvertised bool) *config.Neighbor

type PeerGroup

type PeerGroup struct {
	Conf *config.PeerGroup
	// contains filtered or unexported fields
}

func NewPeerGroup

func NewPeerGroup(c *config.PeerGroup) *PeerGroup

func (*PeerGroup) AddDynamicNeighbor

func (pg *PeerGroup) AddDynamicNeighbor(c *config.DynamicNeighbor)

func (*PeerGroup) AddMember

func (pg *PeerGroup) AddMember(c config.Neighbor)

func (*PeerGroup) DeleteMember

func (pg *PeerGroup) DeleteMember(c config.Neighbor)

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 RoaBucket

type RoaBucket struct {
	Prefix *table.IPPrefix
	// contains filtered or unexported fields
}

func (*RoaBucket) GetEntries

func (r *RoaBucket) GetEntries() []*table.ROA

type TCPDialer

type TCPDialer struct {
	net.Dialer

	// MD5 authentication password.
	AuthPassword string

	// The TTL value to set outgoing connection.
	Ttl uint8

	// The minimum TTL value for incoming packets.
	TtlMin uint8
}

func (*TCPDialer) DialTCP

func (d *TCPDialer) DialTCP(addr string, port int) (*net.TCPConn, error)

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 WatchEventMessage

type WatchEventMessage struct {
	Message      *bgp.BGPMessage
	PeerAS       uint32
	LocalAS      uint32
	PeerAddress  net.IP
	LocalAddress net.IP
	PeerID       net.IP
	FourBytesAs  bool
	Timestamp    time.Time
	IsSent       bool
}

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
	PeerInterface string
}

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"
	WATCH_EVENT_TYPE_RECV_MSG    WatchEventType = "receivedmessage"
)

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
	Neighbor     *config.Neighbor
}

type WatchOption

type WatchOption func(*watchOptions)

func WatchBestPath

func WatchBestPath(current bool) WatchOption

func WatchMessage

func WatchMessage(isSent bool) 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) 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