Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertSDListToMap(SDs []SendableData) map[string]SendableData
- func GenerateSessionId() uint16
- func IsCorrectPDUVersion(pdu PDU, version uint8) bool
- func TypeToString(t uint8) string
- type BgpsecKey
- type Client
- func (c *Client) DisableASPA()
- func (c *Client) DisableBGPsec()
- func (c *Client) Disconnect()
- func (c *Client) GetLocalAddress() net.Addr
- func (c *Client) GetRemoteAddress() net.Addr
- func (c *Client) GetVersion() uint8
- func (c *Client) Notify(sessionId uint16, serialNumber uint32)
- func (c *Client) SendCacheReset()
- func (c *Client) SendCorruptData()
- func (c *Client) SendData(sd SendableData)
- func (c *Client) SendInternalError()
- func (c *Client) SendNoDataError()
- func (c *Client) SendPDU(pdu PDU)
- func (c *Client) SendRawPDU(pdu PDU)
- func (c *Client) SendSDs(sessionId uint16, serialNumber uint32, data []SendableData)
- func (c *Client) SendWrongVersionError()
- func (c *Client) SetDisableVersionCheck(disableCheck bool)
- func (c *Client) SetIntervals(refreshInterval uint32, retryInterval uint32, expireInterval uint32)
- func (c *Client) SetVersion(newversion uint8)
- func (c *Client) Start()
- func (c *Client) String() string
- type ClientCallback
- type ClientConfiguration
- type ClientSession
- func (c *ClientSession) Disconnect()
- func (c *ClientSession) SendPDU(pdu PDU)
- func (c *ClientSession) SendRawPDU(pdu PDU)
- func (c *ClientSession) SendResetQuery()
- func (c *ClientSession) SendSerialQuery(sessionid uint16, serial uint32)
- func (c *ClientSession) Start(addr string, connType int, configTLS *tls.Config, configSSH *ssh.ClientConfig) error
- func (c *ClientSession) StartPlain(addr string) error
- func (c *ClientSession) StartRW(rd io.Reader, wr io.Writer) error
- func (c *ClientSession) StartSSH(addr string, config *ssh.ClientConfig) error
- func (c *ClientSession) StartTLS(addr string, config *tls.Config) error
- func (c *ClientSession) StartWithConn(tcpconn net.Conn) error
- func (c *ClientSession) StartWithSSH(tcpconn *net.TCPConn, session *ssh.Session) error
- type DefaultRTREventHandler
- type Logger
- type PDU
- type PDUASPA
- type PDUCacheReset
- type PDUCacheResponse
- type PDUEndOfData
- type PDUErrorReport
- type PDUIPv4Prefix
- type PDUIPv6Prefix
- type PDUResetQuery
- type PDURouterKey
- type PDUSerialNotify
- type PDUSerialQuery
- type RTRClientSessionEventHandler
- type RTREventHandler
- type RTRServerEventHandler
- type SendableData
- type SendableDataManager
- type Server
- func (s *Server) AddData(vrps []SendableData)
- func (s *Server) AddSDsDiff(diff []SendableData)
- func (s *Server) ClientConnected(c *Client)
- func (s *Server) ClientDisconnected(c *Client)
- func (s *Server) CountVRPs() int
- func (s *Server) GenerateSerial() uint32
- func (s *Server) GetClientList() []*Client
- func (s *Server) GetCurrentSDs() ([]SendableData, bool)
- func (s *Server) GetCurrentSerial(sessId uint16) (uint32, bool)
- func (s *Server) GetMaxConnections() int
- func (s *Server) GetSDsSerialDiff(serial uint32) ([]SendableData, bool)
- func (s *Server) GetSessionId() uint16
- func (s *Server) HandlePDU(c *Client, pdu PDU)
- func (s *Server) NotifyClients(serialNumber uint32)
- func (s *Server) NotifyClientsLatest()
- func (s *Server) RequestCache(c *Client)
- func (s *Server) RequestNewVersion(c *Client, sessionId uint16, serial uint32)
- func (s *Server) SendPDU(pdu PDU)
- func (s *Server) SetBaseVersion(version uint8)
- func (s *Server) SetManualSerial(v bool)
- func (s *Server) SetMaxConnections(maxconn int)
- func (s *Server) SetSerial(serial uint32)
- func (s *Server) SetSessionId(sessId uint16)
- func (s *Server) SetVersionEnforced(adapt bool)
- func (s *Server) Start(bind string) error
- func (s *Server) StartSSH(bind string, config *ssh.ServerConfig) error
- func (s *Server) StartTLS(bind string, config *tls.Config) error
- type ServerConfiguration
- type VAP
- type VRP
Constants ¶
View Source
const ( PROTOCOL_VERSION_0 = 0 PROTOCOL_VERSION_1 = 1 PROTOCOL_VERSION_2 = 2 PDU_ID_SERIAL_NOTIFY = 0 PDU_ID_SERIAL_QUERY = 1 PDU_ID_RESET_QUERY = 2 PDU_ID_CACHE_RESPONSE = 3 PDU_ID_IPV4_PREFIX = 4 PDU_ID_IPV6_PREFIX = 6 PDU_ID_END_OF_DATA = 7 PDU_ID_CACHE_RESET = 8 PDU_ID_ROUTER_KEY = 9 PDU_ID_ERROR_REPORT = 10 PDU_ID_ASPA = 11 FLAG_ADDED = 1 FLAG_REMOVED = 0 PDU_ERROR_CORRUPTDATA = 0 PDU_ERROR_INTERNALERR = 1 PDU_ERROR_NODATA = 2 PDU_ERROR_INVALIDREQUEST = 3 PDU_ERROR_BADPROTOVERSION = 4 PDU_ERROR_BADPDUTYPE = 5 PDU_ERROR_WITHDRAWUNKNOWN = 6 PDU_ERROR_DUPANNOUNCE = 7 AFI_IPv4 = uint8(0) AFI_IPv6 = uint8(1) TYPE_UNKNOWN = iota TYPE_PLAIN TYPE_TLS TYPE_SSH )
Variables ¶
View Source
var DisableASPA = flag.Bool("disable.aspa", false, "Disable sending out ASPA objects")
View Source
var DisableBGPSec = flag.Bool("disable.bgpsec", false, "Disable sending out BGPSEC Router Keys")
Functions ¶
func ConvertSDListToMap ¶ added in v0.5.0
func ConvertSDListToMap(SDs []SendableData) map[string]SendableData
func GenerateSessionId ¶
func GenerateSessionId() uint16
func IsCorrectPDUVersion ¶
func TypeToString ¶
Types ¶
type BgpsecKey ¶ added in v0.5.0
func (*BgpsecKey) Copy ¶ added in v0.5.0
func (brk *BgpsecKey) Copy() SendableData
func (*BgpsecKey) Equals ¶ added in v0.5.0
func (r1 *BgpsecKey) Equals(r2 SendableData) bool
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func ClientFromConn ¶
func ClientFromConn(tcpconn net.Conn, handler RTRServerEventHandler, simpleHandler RTREventHandler) *Client
func ClientFromConnSSH ¶
func ClientFromConnSSH(tcpconn net.Conn, channel ssh.Channel, handler RTRServerEventHandler, simpleHandler RTREventHandler) *Client
func (*Client) DisableASPA ¶ added in v0.5.0
func (c *Client) DisableASPA()
func (*Client) DisableBGPsec ¶ added in v0.5.0
func (c *Client) DisableBGPsec()
func (*Client) Disconnect ¶
func (c *Client) Disconnect()
func (*Client) GetLocalAddress ¶
func (*Client) GetRemoteAddress ¶
func (*Client) GetVersion ¶
func (*Client) SendCacheReset ¶
func (c *Client) SendCacheReset()
func (*Client) SendCorruptData ¶ added in v0.5.0
func (c *Client) SendCorruptData()
func (*Client) SendData ¶ added in v0.5.0
func (c *Client) SendData(sd SendableData)
Converts a SendableData to a PDU and sends it to the client
func (*Client) SendInternalError ¶
func (c *Client) SendInternalError()
func (*Client) SendNoDataError ¶
func (c *Client) SendNoDataError()
func (*Client) SendRawPDU ¶
func (*Client) SendSDs ¶ added in v0.5.0
func (c *Client) SendSDs(sessionId uint16, serialNumber uint32, data []SendableData)
func (*Client) SendWrongVersionError ¶
func (c *Client) SendWrongVersionError()
func (*Client) SetDisableVersionCheck ¶
func (*Client) SetIntervals ¶
func (*Client) SetVersion ¶
type ClientCallback ¶
type ClientConfiguration ¶
type ClientSession ¶
type ClientSession struct {
// contains filtered or unexported fields
}
func NewClientSession ¶
func NewClientSession(configuration ClientConfiguration, handler RTRClientSessionEventHandler) *ClientSession
func (*ClientSession) Disconnect ¶
func (c *ClientSession) Disconnect()
func (*ClientSession) SendPDU ¶
func (c *ClientSession) SendPDU(pdu PDU)
func (*ClientSession) SendRawPDU ¶
func (c *ClientSession) SendRawPDU(pdu PDU)
func (*ClientSession) SendResetQuery ¶
func (c *ClientSession) SendResetQuery()
func (*ClientSession) SendSerialQuery ¶
func (c *ClientSession) SendSerialQuery(sessionid uint16, serial uint32)
func (*ClientSession) Start ¶
func (c *ClientSession) Start(addr string, connType int, configTLS *tls.Config, configSSH *ssh.ClientConfig) error
func (*ClientSession) StartPlain ¶
func (c *ClientSession) StartPlain(addr string) error
func (*ClientSession) StartSSH ¶
func (c *ClientSession) StartSSH(addr string, config *ssh.ClientConfig) error
func (*ClientSession) StartTLS ¶
func (c *ClientSession) StartTLS(addr string, config *tls.Config) error
func (*ClientSession) StartWithConn ¶
func (c *ClientSession) StartWithConn(tcpconn net.Conn) error
func (*ClientSession) StartWithSSH ¶
type DefaultRTREventHandler ¶
type DefaultRTREventHandler struct { Log Logger // contains filtered or unexported fields }
func (*DefaultRTREventHandler) RequestCache ¶
func (e *DefaultRTREventHandler) RequestCache(c *Client)
func (*DefaultRTREventHandler) RequestNewVersion ¶
func (e *DefaultRTREventHandler) RequestNewVersion(c *Client, sessionId uint16, serialNumber uint32)
func (*DefaultRTREventHandler) SetSDManager ¶ added in v0.5.0
func (e *DefaultRTREventHandler) SetSDManager(m SendableDataManager)
type PDU ¶
type PDU interface { Bytes() []byte Write(io.Writer) String() string SetVersion(uint8) GetVersion() uint8 GetType() uint8 }
func DecodeBytes ¶
type PDUASPA ¶ added in v0.5.0
type PDUASPA struct { Version uint8 Flags uint8 AFIFlags uint8 ProviderASCount uint16 CustomerASNumber uint32 ProviderASNumbers []uint32 }
func (*PDUASPA) GetVersion ¶ added in v0.5.0
func (*PDUASPA) SetVersion ¶ added in v0.5.0
type PDUCacheReset ¶
type PDUCacheReset struct {
Version uint8
}
func (*PDUCacheReset) Bytes ¶
func (pdu *PDUCacheReset) Bytes() []byte
func (*PDUCacheReset) GetType ¶
func (pdu *PDUCacheReset) GetType() uint8
func (*PDUCacheReset) GetVersion ¶
func (pdu *PDUCacheReset) GetVersion() uint8
func (*PDUCacheReset) SetVersion ¶
func (pdu *PDUCacheReset) SetVersion(version uint8)
func (*PDUCacheReset) String ¶
func (pdu *PDUCacheReset) String() string
func (*PDUCacheReset) Write ¶
func (pdu *PDUCacheReset) Write(wr io.Writer)
type PDUCacheResponse ¶
func (*PDUCacheResponse) Bytes ¶
func (pdu *PDUCacheResponse) Bytes() []byte
func (*PDUCacheResponse) GetType ¶
func (pdu *PDUCacheResponse) GetType() uint8
func (*PDUCacheResponse) GetVersion ¶
func (pdu *PDUCacheResponse) GetVersion() uint8
func (*PDUCacheResponse) SetVersion ¶
func (pdu *PDUCacheResponse) SetVersion(version uint8)
func (*PDUCacheResponse) String ¶
func (pdu *PDUCacheResponse) String() string
func (*PDUCacheResponse) Write ¶
func (pdu *PDUCacheResponse) Write(wr io.Writer)
type PDUEndOfData ¶
type PDUEndOfData struct { Version uint8 SessionId uint16 SerialNumber uint32 RefreshInterval uint32 RetryInterval uint32 ExpireInterval uint32 }
func (*PDUEndOfData) Bytes ¶
func (pdu *PDUEndOfData) Bytes() []byte
func (*PDUEndOfData) GetType ¶
func (pdu *PDUEndOfData) GetType() uint8
func (*PDUEndOfData) GetVersion ¶
func (pdu *PDUEndOfData) GetVersion() uint8
func (*PDUEndOfData) SetVersion ¶
func (pdu *PDUEndOfData) SetVersion(version uint8)
func (*PDUEndOfData) String ¶
func (pdu *PDUEndOfData) String() string
func (*PDUEndOfData) Write ¶
func (pdu *PDUEndOfData) Write(wr io.Writer)
type PDUErrorReport ¶
func (*PDUErrorReport) Bytes ¶
func (pdu *PDUErrorReport) Bytes() []byte
func (*PDUErrorReport) GetType ¶
func (pdu *PDUErrorReport) GetType() uint8
func (*PDUErrorReport) GetVersion ¶
func (pdu *PDUErrorReport) GetVersion() uint8
func (*PDUErrorReport) SetVersion ¶
func (pdu *PDUErrorReport) SetVersion(version uint8)
func (*PDUErrorReport) String ¶
func (pdu *PDUErrorReport) String() string
func (*PDUErrorReport) Write ¶
func (pdu *PDUErrorReport) Write(wr io.Writer)
type PDUIPv4Prefix ¶
func (*PDUIPv4Prefix) Bytes ¶
func (pdu *PDUIPv4Prefix) Bytes() []byte
func (*PDUIPv4Prefix) GetType ¶
func (pdu *PDUIPv4Prefix) GetType() uint8
func (*PDUIPv4Prefix) GetVersion ¶
func (pdu *PDUIPv4Prefix) GetVersion() uint8
func (*PDUIPv4Prefix) SetVersion ¶
func (pdu *PDUIPv4Prefix) SetVersion(version uint8)
func (*PDUIPv4Prefix) String ¶
func (pdu *PDUIPv4Prefix) String() string
func (*PDUIPv4Prefix) Write ¶
func (pdu *PDUIPv4Prefix) Write(wr io.Writer)
type PDUIPv6Prefix ¶
func (*PDUIPv6Prefix) Bytes ¶
func (pdu *PDUIPv6Prefix) Bytes() []byte
func (*PDUIPv6Prefix) GetType ¶
func (pdu *PDUIPv6Prefix) GetType() uint8
func (*PDUIPv6Prefix) GetVersion ¶
func (pdu *PDUIPv6Prefix) GetVersion() uint8
func (*PDUIPv6Prefix) SetVersion ¶
func (pdu *PDUIPv6Prefix) SetVersion(version uint8)
func (*PDUIPv6Prefix) String ¶
func (pdu *PDUIPv6Prefix) String() string
func (*PDUIPv6Prefix) Write ¶
func (pdu *PDUIPv6Prefix) Write(wr io.Writer)
type PDUResetQuery ¶
type PDUResetQuery struct {
Version uint8
}
func (*PDUResetQuery) Bytes ¶
func (pdu *PDUResetQuery) Bytes() []byte
func (*PDUResetQuery) GetType ¶
func (pdu *PDUResetQuery) GetType() uint8
func (*PDUResetQuery) GetVersion ¶
func (pdu *PDUResetQuery) GetVersion() uint8
func (*PDUResetQuery) SetVersion ¶
func (pdu *PDUResetQuery) SetVersion(version uint8)
func (*PDUResetQuery) String ¶
func (pdu *PDUResetQuery) String() string
func (*PDUResetQuery) Write ¶
func (pdu *PDUResetQuery) Write(wr io.Writer)
type PDURouterKey ¶
type PDURouterKey struct { Version uint8 Flags uint8 SubjectKeyIdentifier []byte ASN uint32 SubjectPublicKeyInfo []byte }
func (*PDURouterKey) Bytes ¶
func (pdu *PDURouterKey) Bytes() []byte
func (*PDURouterKey) GetType ¶
func (pdu *PDURouterKey) GetType() uint8
func (*PDURouterKey) GetVersion ¶
func (pdu *PDURouterKey) GetVersion() uint8
func (*PDURouterKey) SetVersion ¶
func (pdu *PDURouterKey) SetVersion(version uint8)
func (*PDURouterKey) String ¶
func (pdu *PDURouterKey) String() string
func (*PDURouterKey) Write ¶
func (pdu *PDURouterKey) Write(wr io.Writer)
type PDUSerialNotify ¶
func (*PDUSerialNotify) Bytes ¶
func (pdu *PDUSerialNotify) Bytes() []byte
func (*PDUSerialNotify) GetType ¶
func (pdu *PDUSerialNotify) GetType() uint8
func (*PDUSerialNotify) GetVersion ¶
func (pdu *PDUSerialNotify) GetVersion() uint8
func (*PDUSerialNotify) SetVersion ¶
func (pdu *PDUSerialNotify) SetVersion(version uint8)
func (*PDUSerialNotify) String ¶
func (pdu *PDUSerialNotify) String() string
func (*PDUSerialNotify) Write ¶
func (pdu *PDUSerialNotify) Write(wr io.Writer)
type PDUSerialQuery ¶
func (*PDUSerialQuery) Bytes ¶
func (pdu *PDUSerialQuery) Bytes() []byte
func (*PDUSerialQuery) GetType ¶
func (pdu *PDUSerialQuery) GetType() uint8
func (*PDUSerialQuery) GetVersion ¶
func (pdu *PDUSerialQuery) GetVersion() uint8
func (*PDUSerialQuery) SetVersion ¶
func (pdu *PDUSerialQuery) SetVersion(version uint8)
func (*PDUSerialQuery) String ¶
func (pdu *PDUSerialQuery) String() string
func (*PDUSerialQuery) Write ¶
func (pdu *PDUSerialQuery) Write(wr io.Writer)
type RTRClientSessionEventHandler ¶
type RTRClientSessionEventHandler interface { //RequestCache(*ClientSession) HandlePDU(*ClientSession, PDU) ClientConnected(*ClientSession) ClientDisconnected(*ClientSession) }
type RTREventHandler ¶
type RTRServerEventHandler ¶
type SendableData ¶ added in v0.5.0
type SendableData interface { Copy() SendableData Equals(SendableData) bool HashKey() string String() string Type() string SetFlag(uint8) GetFlag() uint8 }
This is a general interface for things like a VRP, BGPsec Router key or ASPA object Be sure to have all of these as pointers, or SetFlag() cannot work!
func ApplyDiff ¶
func ApplyDiff(diff, prevSDs []SendableData) []SendableData
func ComputeDiff ¶
func ComputeDiff(newSDs, prevSDs []SendableData) (added, removed, unchanged []SendableData)
type SendableDataManager ¶ added in v0.5.0
type SendableDataManager interface { GetCurrentSerial(uint16) (uint32, bool) GetSessionId() uint16 GetCurrentSDs() ([]SendableData, bool) GetSDsSerialDiff(uint32) ([]SendableData, bool) }
This handles things like ROAs, BGPsec Router keys, ASPA info etc
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(configuration ServerConfiguration, handler RTRServerEventHandler, simpleHandler RTREventHandler) *Server
func (*Server) AddData ¶ added in v0.5.0
func (s *Server) AddData(vrps []SendableData)
func (*Server) AddSDsDiff ¶ added in v0.5.0
func (s *Server) AddSDsDiff(diff []SendableData)
func (*Server) ClientConnected ¶
func (*Server) ClientDisconnected ¶
func (*Server) GenerateSerial ¶
func (*Server) GetClientList ¶
func (*Server) GetCurrentSDs ¶ added in v0.5.0
func (s *Server) GetCurrentSDs() ([]SendableData, bool)
func (*Server) GetMaxConnections ¶
func (*Server) GetSDsSerialDiff ¶ added in v0.5.0
func (s *Server) GetSDsSerialDiff(serial uint32) ([]SendableData, bool)
func (*Server) GetSessionId ¶
func (*Server) NotifyClients ¶
func (*Server) NotifyClientsLatest ¶
func (s *Server) NotifyClientsLatest()
func (*Server) RequestCache ¶
func (*Server) RequestNewVersion ¶
func (*Server) SetBaseVersion ¶
func (*Server) SetManualSerial ¶
func (*Server) SetMaxConnections ¶
func (*Server) SetSerial ¶
This function sets the serial. Function must be called before the VRPs data is added.
func (*Server) SetSessionId ¶
func (*Server) SetVersionEnforced ¶
type ServerConfiguration ¶
type VAP ¶ added in v0.5.0
func (*VAP) Copy ¶ added in v0.5.0
func (vap *VAP) Copy() SendableData
func (*VAP) Equals ¶ added in v0.5.0
func (r1 *VAP) Equals(r2 SendableData) bool
Click to show internal directories.
Click to hide internal directories.