bgp

package
v0.0.0-...-2820c43 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2015 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AFI_IP  = 1
	AFI_IP6 = 2
)
View Source
const (
	SAFI_UNICAST                  = 1
	SAFI_MULTICAST                = 2
	SAFI_MPLS_LABEL               = 4
	SAFI_MPLS_VPN                 = 128
	SAFI_ROUTE_TARGET_CONSTRTAINS = 132
)
View Source
const (
	BGP_MSG_OPEN
	BGP_MSG_UPDATE
	BGP_MSG_NOTIFICATION
	BGP_MSG_KEEPALIVE
	BGP_MSG_ROUTE_REFRESH
)
View Source
const (
	BGP_RD_TWO_OCTET_AS = iota
	BGP_RD_IPV4_ADDRESS
	BGP_RD_FOUR_OCTET_AS
)
View Source
const (
	BGP_ATTR_FLAG_EXTENDED_LENGTH = 1 << 4
	BGP_ATTR_FLAG_PARTIAL         = 1 << 5
	BGP_ATTR_FLAG_TRANSITIVE      = 1 << 6
	BGP_ATTR_FLAG_OPTIONAL        = 1 << 7
)
View Source
const (
	BGP_ERROR_MESSAGE_HEADER_ERROR
	BGP_ERROR_OPEN_MESSAGE_ERROR
	BGP_ERROR_UPDATE_MESSAGE_ERROR
	BGP_ERROR_HOLD_TIMER_EXPIRED
	BGP_ERROR_FSM_ERROR
	BGP_ERROR_CEASE
)

NOTIFICATION Error Code RFC 4271 4.5.

View Source
const (
	BGP_ERROR_SUB_CONNECTION_NOT_SYNCHRONIZED
	BGP_ERROR_SUB_BAD_MESSAGE_LENGTH
	BGP_ERROR_SUB_BAD_MESSAGE_TYPE
)

NOTIFICATION Error Subcode for BGP_ERROR_MESSAGE_HEADER_ERROR

View Source
const (
	BGP_ERROR_SUB_UNSUPPORTED_VERSION_NUMBER
	BGP_ERROR_SUB_BAD_PEER_AS
	BGP_ERROR_SUB_BAD_BGP_IDENTIFIER
	BGP_ERROR_SUB_UNSUPPORTED_OPTIONAL_PARAMETER
	BGP_ERROR_SUB_AUTHENTICATION_FAILURE
	BGP_ERROR_SUB_UNACCEPTABLE_HOLD_TIME
)

NOTIFICATION Error Subcode for BGP_ERROR_OPEN_MESSAGE_ERROR

View Source
const (
	BGP_ERROR_SUB_MALFORMED_ATTRIBUTE_LIST
	BGP_ERROR_SUB_UNRECOGNIZED_WELL_KNOWN_ATTRIBUTE
	BGP_ERROR_SUB_MISSING_WELL_KNOWN_ATTRIBUTE
	BGP_ERROR_SUB_ATTRIBUTE_FLAGS_ERROR
	BGP_ERROR_SUB_ATTRIBUTE_LENGTH_ERROR
	BGP_ERROR_SUB_INVALID_ORIGIN_ATTRIBUTE
	BGP_ERROR_SUB_ROUTING_LOOP
	BGP_ERROR_SUB_INVALID_NEXT_HOP_ATTRIBUTE
	BGP_ERROR_SUB_OPTIONAL_ATTRIBUTE_ERROR
	BGP_ERROR_SUB_INVALID_NETWORK_FIELD
	BGP_ERROR_SUB_MALFORMED_AS_PATH
)

NOTIFICATION Error Subcode for BGP_ERROR_UPDATE_MESSAGE_ERROR

View Source
const (
	BGP_ERROR_SUB_MAXIMUM_NUMBER_OF_PREFIXES_REACHED
	BGP_ERROR_SUB_ADMINISTRATIVE_SHUTDOWN
	BGP_ERROR_SUB_PEER_DECONFIGURED
	BGP_ERROR_SUB_ADMINISTRATIVE_RESET
	BGP_ERROR_SUB_CONNECTION_RESET
	BGP_ERROR_SUB_OTHER_CONFIGURATION_CHANGE
	BGP_ERROR_SUB_CONNECTION_COLLISION_RESOLUTION
	BGP_ERROR_SUB_OUT_OF_RESOURCES
)

NOTIFICATION Error Subcode for BGP_ERROR_CEASE (RFC 4486)

View Source
const (
	BGP_HEADER_LENGTH      = 19
	BGP_MAX_MESSAGE_LENGTH = 4096
)
View Source
const (
	BMP_STAT_TYPE_REJECTED = iota
	BMP_STAT_TYPE_DUPLICATE_PREFIX
	BMP_STAT_TYPE_DUPLICATE_WITHDRAW
	BMP_STAT_TYPE_INV_UPDATE_DUE_TO_CLUSTER_LIST_LOOP
	BMP_STAT_TYPE_INV_UPDATE_DUE_TO_AS_PATH_LOOP
	BMP_STAT_TYPE_INV_UPDATE_DUE_TO_ORIGINATOR_ID
	BMP_STAT_TYPE_INV_UPDATE_DUE_TO_AS_CONFED_LOOP
	BMP_STAT_TYPE_ADJ_RIB_IN
	BMP_STAT_TYPE_LOC_RIB
)
View Source
const (
	BMP_PEER_DOWN_REASON_UNKNOWN = iota
	BMP_PEER_DOWN_REASON_LOCAL_BGP_NOTIFICATION
	BMP_PEER_DOWN_REASON_LOCAL_NO_NOTIFICATION
	BMP_PEER_DOWN_REASON_REMOTE_BGP_NOTIFICATION
	BMP_PEER_DOWN_REASON_REMOTE_NO_NOTIFICATION
)
View Source
const (
	BMP_MSG_ROUTE_MONITORING = iota
	BMP_MSG_STATISTICS_REPORT
	BMP_MSG_PEER_DOWN_NOTIFICATION
	BMP_MSG_PEER_UP_NOTIFICATION
	BMP_MSG_INITIATION
	BMP_MSG_TERMINATION
)
View Source
const AS_TRANS = 23456
View Source
const (
	BGP_ERROR_SUB_FSM_ERROR
)

NOTIFICATION Error Subcode for BGP_ERROR_FSM_ERROR

View Source
const (
	BGP_ERROR_SUB_HOLD_TIMER_EXPIRED
)

NOTIFICATION Error Subcode for BGP_ERROR_HOLD_TIMER_EXPIRED

View Source
const (
	BGP_OPT_CAPABILITY = 2
)
View Source
const BGP_PORT = 179
View Source
const (
	BMP_HEADER_SIZE = 6
)

Variables

This section is empty.

Functions

func NewMessageError

func NewMessageError(typeCode, subTypeCode uint8, data []byte, msg string) error

func ValidateAttribute

func ValidateAttribute(a PathAttributeInterface, rfs []RouteFamily) (bool, error)

func ValidateBGPMessage

func ValidateBGPMessage(m *BGPMessage) error

func ValidateFlags

func ValidateFlags(t BGPAttrType, flags uint8) (bool, string)

validator for PathAttribute

func ValidateOpenMsg

func ValidateOpenMsg(m *BGPOpen, expectedAS uint32) error

func ValidateUpdateMsg

func ValidateUpdateMsg(m *BGPUpdate, rfs []RouteFamily) (bool, error)

Validator for BGPUpdate

Types

type AddrPrefixInterface

type AddrPrefixInterface interface {
	DecodeFromBytes([]byte) error
	Serialize() ([]byte, error)
	AFI() uint16
	SAFI() uint8
	Len() int
	String() string
}

type As4PathParam

type As4PathParam struct {
	Type uint8
	Num  uint8
	AS   []uint32
}

func NewAs4PathParam

func NewAs4PathParam(segType uint8, as []uint32) *As4PathParam

func (*As4PathParam) ASLen

func (a *As4PathParam) ASLen() int

func (*As4PathParam) DecodeFromBytes

func (a *As4PathParam) DecodeFromBytes(data []byte) error

func (*As4PathParam) Len

func (a *As4PathParam) Len() int

func (*As4PathParam) Serialize

func (a *As4PathParam) Serialize() ([]byte, error)

type AsPathParam

type AsPathParam struct {
	Type uint8
	Num  uint8
	AS   []uint16
}

func NewAsPathParam

func NewAsPathParam(segType uint8, as []uint16) *AsPathParam

func (*AsPathParam) ASLen

func (a *AsPathParam) ASLen() int

func (*AsPathParam) DecodeFromBytes

func (a *AsPathParam) DecodeFromBytes(data []byte) error

func (*AsPathParam) Len

func (a *AsPathParam) Len() int

func (*AsPathParam) Serialize

func (a *AsPathParam) Serialize() ([]byte, error)

type AsPathParamInterface

type AsPathParamInterface interface {
	Serialize() ([]byte, error)
	DecodeFromBytes([]byte) error
	Len() int
	ASLen() int
}

type BGPAttrType

type BGPAttrType uint8
const (
	BGP_ATTR_TYPE_ORIGIN BGPAttrType
	BGP_ATTR_TYPE_AS_PATH
	BGP_ATTR_TYPE_NEXT_HOP
	BGP_ATTR_TYPE_MULTI_EXIT_DISC
	BGP_ATTR_TYPE_LOCAL_PREF
	BGP_ATTR_TYPE_ATOMIC_AGGREGATE
	BGP_ATTR_TYPE_AGGREGATOR
	BGP_ATTR_TYPE_COMMUNITIES
	BGP_ATTR_TYPE_ORIGINATOR_ID
	BGP_ATTR_TYPE_CLUSTER_LIST

	BGP_ATTR_TYPE_MP_REACH_NLRI
	BGP_ATTR_TYPE_MP_UNREACH_NLRI
	BGP_ATTR_TYPE_EXTENDED_COMMUNITIES
	BGP_ATTR_TYPE_AS4_PATH
	BGP_ATTR_TYPE_AS4_AGGREGATOR
)

func (BGPAttrType) String

func (i BGPAttrType) String() string

type BGPBody

type BGPBody interface {
	DecodeFromBytes([]byte) error
	Serialize() ([]byte, error)
}

type BGPCapabilityCode

type BGPCapabilityCode uint8
const (
	BGP_CAP_MULTIPROTOCOL          BGPCapabilityCode = 1
	BGP_CAP_ROUTE_REFRESH          BGPCapabilityCode = 2
	BGP_CAP_CARRYING_LABEL_INFO    BGPCapabilityCode = 4
	BGP_CAP_GRACEFUL_RESTART       BGPCapabilityCode = 64
	BGP_CAP_FOUR_OCTET_AS_NUMBER   BGPCapabilityCode = 65
	BGP_CAP_ENHANCED_ROUTE_REFRESH BGPCapabilityCode = 70
	BGP_CAP_ROUTE_REFRESH_CISCO    BGPCapabilityCode = 128
)

func (BGPCapabilityCode) String

func (i BGPCapabilityCode) String() string

type BGPHeader

type BGPHeader struct {
	Marker []byte
	Len    uint16
	Type   uint8
}

func (*BGPHeader) DecodeFromBytes

func (msg *BGPHeader) DecodeFromBytes(data []byte) error

func (*BGPHeader) Serialize

func (msg *BGPHeader) Serialize() ([]byte, error)

type BGPKeepAlive

type BGPKeepAlive struct {
}

func (*BGPKeepAlive) DecodeFromBytes

func (msg *BGPKeepAlive) DecodeFromBytes(data []byte) error

func (*BGPKeepAlive) Serialize

func (msg *BGPKeepAlive) Serialize() ([]byte, error)

type BGPMessage

type BGPMessage struct {
	Header BGPHeader
	Body   BGPBody
}

func NewBGPKeepAliveMessage

func NewBGPKeepAliveMessage() *BGPMessage

func NewBGPNotificationMessage

func NewBGPNotificationMessage(errcode uint8, errsubcode uint8, data []byte) *BGPMessage

func NewBGPOpenMessage

func NewBGPOpenMessage(myas uint16, holdtime uint16, id string, optparams []OptionParameterInterface) *BGPMessage

func NewBGPRouteRefreshMessage

func NewBGPRouteRefreshMessage(afi uint16, demarcation uint8, safi uint8) *BGPMessage

func NewBGPUpdateMessage

func NewBGPUpdateMessage(withdrawnRoutes []WithdrawnRoute, pathattrs []PathAttributeInterface, nlri []NLRInfo) *BGPMessage

func ParseBGPBody

func ParseBGPBody(h *BGPHeader, data []byte) (*BGPMessage, error)

func ParseBGPMessage

func ParseBGPMessage(data []byte) (*BGPMessage, error)

func (*BGPMessage) Serialize

func (msg *BGPMessage) Serialize() ([]byte, error)

type BGPNotification

type BGPNotification struct {
	ErrorCode    uint8
	ErrorSubcode uint8
	Data         []byte
}

func (*BGPNotification) DecodeFromBytes

func (msg *BGPNotification) DecodeFromBytes(data []byte) error

func (*BGPNotification) Serialize

func (msg *BGPNotification) Serialize() ([]byte, error)

type BGPOpen

type BGPOpen struct {
	Version     uint8
	MyAS        uint16
	HoldTime    uint16
	ID          net.IP
	OptParamLen uint8
	OptParams   []OptionParameterInterface
}

func (*BGPOpen) DecodeFromBytes

func (msg *BGPOpen) DecodeFromBytes(data []byte) error

func (*BGPOpen) Serialize

func (msg *BGPOpen) Serialize() ([]byte, error)

type BGPRouteRefresh

type BGPRouteRefresh struct {
	AFI         uint16
	Demarcation uint8
	SAFI        uint8
}

func (*BGPRouteRefresh) DecodeFromBytes

func (msg *BGPRouteRefresh) DecodeFromBytes(data []byte) error

func (*BGPRouteRefresh) Serialize

func (msg *BGPRouteRefresh) Serialize() ([]byte, error)

type BGPUpdate

type BGPUpdate struct {
	WithdrawnRoutesLen    uint16
	WithdrawnRoutes       []WithdrawnRoute
	TotalPathAttributeLen uint16
	PathAttributes        []PathAttributeInterface
	NLRI                  []NLRInfo
}

func (*BGPUpdate) DecodeFromBytes

func (msg *BGPUpdate) DecodeFromBytes(data []byte) error

func (*BGPUpdate) Serialize

func (msg *BGPUpdate) Serialize() ([]byte, error)

type BMPBody

type BMPBody interface {
	ParseBody(*BMPMessage, []byte) error
}

type BMPHeader

type BMPHeader struct {
	Version uint8
	Length  uint32
	Type    uint8
}

func (*BMPHeader) DecodeFromBytes

func (msg *BMPHeader) DecodeFromBytes(data []byte) error

func (*BMPHeader) Len

func (msg *BMPHeader) Len() int

type BMPInitiation

type BMPInitiation struct {
	Info []BMPTLV
}

func (*BMPInitiation) ParseBody

func (body *BMPInitiation) ParseBody(msg *BMPMessage, data []byte) error

type BMPMessage

type BMPMessage struct {
	Header     BMPHeader
	PeerHeader BMPPeerHeader
	Body       BMPBody
}

func ParseBMPMessage

func ParseBMPMessage(data []byte) (*BMPMessage, error)

func ReadBMPMessage

func ReadBMPMessage(conn net.Conn) (*BMPMessage, error)

move somewhere else

func (*BMPMessage) Len

func (msg *BMPMessage) Len() int

type BMPPeerDownNotification

type BMPPeerDownNotification struct {
	Reason          uint8
	BGPNotification *BGPMessage
	Data            []byte
}

func (*BMPPeerDownNotification) ParseBody

func (body *BMPPeerDownNotification) ParseBody(msg *BMPMessage, data []byte) error

type BMPPeerHeader

type BMPPeerHeader struct {
	PeerType          uint8
	IsPostPolicy      bool
	PeerDistinguisher uint64
	PeerAddress       net.IP
	PeerAS            uint32
	PeerBGPID         net.IP
	Timestamp         float64
	// contains filtered or unexported fields
}

func (*BMPPeerHeader) DecodeFromBytes

func (msg *BMPPeerHeader) DecodeFromBytes(data []byte) error

type BMPPeerUpNotification

type BMPPeerUpNotification struct {
	LocalAddress    net.IP
	LocalPort       uint16
	RemotePort      uint16
	SentOpenMsg     *BGPMessage
	ReceivedOpenMsg *BGPMessage
}

func (*BMPPeerUpNotification) ParseBody

func (body *BMPPeerUpNotification) ParseBody(msg *BMPMessage, data []byte) error

type BMPRouteMonitoring

type BMPRouteMonitoring struct {
	BGPUpdate *BGPMessage
}

func (*BMPRouteMonitoring) ParseBody

func (body *BMPRouteMonitoring) ParseBody(msg *BMPMessage, data []byte) error

type BMPStatisticsReport

type BMPStatisticsReport struct {
	Stats []BMPStatsTLV
}

func (*BMPStatisticsReport) ParseBody

func (body *BMPStatisticsReport) ParseBody(msg *BMPMessage, data []byte) error

type BMPStatsTLV

type BMPStatsTLV struct {
	Type   uint16
	Length uint16
	Value  uint64
}

type BMPTLV

type BMPTLV struct {
	Type   uint16
	Length uint16
	Value  []byte
}

type BMPTermination

type BMPTermination struct {
	Info []BMPTLV
}

func (*BMPTermination) ParseBody

func (body *BMPTermination) ParseBody(msg *BMPMessage, data []byte) error

type CapCarryingLabelInfo

type CapCarryingLabelInfo struct {
	DefaultParameterCapability
}

type CapEnhancedRouteRefresh

type CapEnhancedRouteRefresh struct {
	DefaultParameterCapability
}

func NewCapEnhancedRouteRefresh

func NewCapEnhancedRouteRefresh() *CapEnhancedRouteRefresh

type CapFourOctetASNumber

type CapFourOctetASNumber struct {
	DefaultParameterCapability
	CapValue uint32
}

func NewCapFourOctetASNumber

func NewCapFourOctetASNumber(asnum uint32) *CapFourOctetASNumber

func (*CapFourOctetASNumber) DecodeFromBytes

func (c *CapFourOctetASNumber) DecodeFromBytes(data []byte) error

func (*CapFourOctetASNumber) Serialize

func (c *CapFourOctetASNumber) Serialize() ([]byte, error)

type CapGracefulRestart

type CapGracefulRestart struct {
	DefaultParameterCapability
	CapValue CapGracefulRestartValue
}

func NewCapGracefulRestart

func NewCapGracefulRestart(flags uint8, time uint16, tuples []CapGracefulRestartTuples) *CapGracefulRestart

func (*CapGracefulRestart) DecodeFromBytes

func (c *CapGracefulRestart) DecodeFromBytes(data []byte) error

func (*CapGracefulRestart) Serialize

func (c *CapGracefulRestart) Serialize() ([]byte, error)

type CapGracefulRestartTuples

type CapGracefulRestartTuples struct {
	AFI   uint16
	SAFI  uint8
	Flags uint8
}

type CapGracefulRestartValue

type CapGracefulRestartValue struct {
	Flags  uint8
	Time   uint16
	Tuples []CapGracefulRestartTuples
}

type CapMultiProtocol

type CapMultiProtocol struct {
	DefaultParameterCapability
	CapValue CapMultiProtocolValue
}

func NewCapMultiProtocol

func NewCapMultiProtocol(afi uint16, safi uint8) *CapMultiProtocol

func (*CapMultiProtocol) DecodeFromBytes

func (c *CapMultiProtocol) DecodeFromBytes(data []byte) error

func (*CapMultiProtocol) Serialize

func (c *CapMultiProtocol) Serialize() ([]byte, error)

type CapMultiProtocolValue

type CapMultiProtocolValue struct {
	AFI  uint16
	SAFI uint8
}

type CapRouteRefresh

type CapRouteRefresh struct {
	DefaultParameterCapability
}

func NewCapRouteRefresh

func NewCapRouteRefresh() *CapRouteRefresh

type CapRouteRefreshCisco

type CapRouteRefreshCisco struct {
	DefaultParameterCapability
}

func NewCapRouteRefreshCisco

func NewCapRouteRefreshCisco() *CapRouteRefreshCisco

type CapUnknown

type CapUnknown struct {
	DefaultParameterCapability
}

type DefaultAsPath

type DefaultAsPath struct {
}

type DefaultParameterCapability

type DefaultParameterCapability struct {
	CapCode  BGPCapabilityCode
	CapLen   uint8
	CapValue []byte
}

func (*DefaultParameterCapability) Code

func (*DefaultParameterCapability) DecodeFromBytes

func (c *DefaultParameterCapability) DecodeFromBytes(data []byte) error

func (*DefaultParameterCapability) Len

func (*DefaultParameterCapability) Serialize

func (c *DefaultParameterCapability) Serialize() ([]byte, error)

type DefaultRouteDistinguisher

type DefaultRouteDistinguisher struct {
	Type  uint16
	Value []byte
}

func (*DefaultRouteDistinguisher) DecodeFromBytes

func (rd *DefaultRouteDistinguisher) DecodeFromBytes(data []byte) error

func (*DefaultRouteDistinguisher) Len

func (rd *DefaultRouteDistinguisher) Len() int

func (*DefaultRouteDistinguisher) Serialize

func (rd *DefaultRouteDistinguisher) Serialize() ([]byte, error)

type ExtendedCommunityInterface

type ExtendedCommunityInterface interface {
	Serialize() ([]byte, error)
	String() string
}

type FSMState

type FSMState int
const (
	BGP_FSM_IDLE FSMState
	BGP_FSM_CONNECT
	BGP_FSM_ACTIVE
	BGP_FSM_OPENSENT
	BGP_FSM_OPENCONFIRM
	BGP_FSM_ESTABLISHED
)

func (FSMState) String

func (i FSMState) String() string

type FourOctetAsSpecificExtended

type FourOctetAsSpecificExtended struct {
	SubType    uint8
	AS         uint32
	LocalAdmin uint16
}

func (*FourOctetAsSpecificExtended) Serialize

func (e *FourOctetAsSpecificExtended) Serialize() ([]byte, error)

func (*FourOctetAsSpecificExtended) String

func (e *FourOctetAsSpecificExtended) String() string

type IPAddrPrefix

type IPAddrPrefix struct {
	IPAddrPrefixDefault
	// contains filtered or unexported fields
}

func NewIPAddrPrefix

func NewIPAddrPrefix(length uint8, prefix string) *IPAddrPrefix

func (*IPAddrPrefix) AFI

func (r *IPAddrPrefix) AFI() uint16

func (*IPAddrPrefix) DecodeFromBytes

func (r *IPAddrPrefix) DecodeFromBytes(data []byte) error

func (*IPAddrPrefix) SAFI

func (r *IPAddrPrefix) SAFI() uint8

func (*IPAddrPrefix) Serialize

func (r *IPAddrPrefix) Serialize() ([]byte, error)

type IPAddrPrefixDefault

type IPAddrPrefixDefault struct {
	Length uint8
	Prefix net.IP
}

func (*IPAddrPrefixDefault) Len

func (r *IPAddrPrefixDefault) Len() int

func (*IPAddrPrefixDefault) String

func (r *IPAddrPrefixDefault) String() string

type IPv4AddressSpecificExtended

type IPv4AddressSpecificExtended struct {
	SubType    uint8
	IPv4       net.IP
	LocalAdmin uint16
}

func (*IPv4AddressSpecificExtended) Serialize

func (e *IPv4AddressSpecificExtended) Serialize() ([]byte, error)

func (*IPv4AddressSpecificExtended) String

func (e *IPv4AddressSpecificExtended) String() string

type IPv6AddrPrefix

type IPv6AddrPrefix struct {
	IPAddrPrefix
}

func NewIPv6AddrPrefix

func NewIPv6AddrPrefix(length uint8, prefix string) *IPv6AddrPrefix

func (*IPv6AddrPrefix) AFI

func (r *IPv6AddrPrefix) AFI() uint16

type Label

type Label struct {
	Labels []uint32
}

func NewLabel

func NewLabel(labels ...uint32) *Label

func (*Label) DecodeFromBytes

func (l *Label) DecodeFromBytes(data []byte) error

func (*Label) Len

func (l *Label) Len() int

func (*Label) Serialize

func (l *Label) Serialize() ([]byte, error)

type LabelledIPAddrPrefix

type LabelledIPAddrPrefix struct {
	IPAddrPrefixDefault
	Labels Label
	// contains filtered or unexported fields
}

func NewLabelledIPAddrPrefix

func NewLabelledIPAddrPrefix(length uint8, prefix string, label Label) *LabelledIPAddrPrefix

func (*LabelledIPAddrPrefix) AFI

func (r *LabelledIPAddrPrefix) AFI() uint16

func (*LabelledIPAddrPrefix) DecodeFromBytes

func (l *LabelledIPAddrPrefix) DecodeFromBytes(data []byte) error

func (*LabelledIPAddrPrefix) SAFI

func (r *LabelledIPAddrPrefix) SAFI() uint8

func (*LabelledIPAddrPrefix) Serialize

func (l *LabelledIPAddrPrefix) Serialize() ([]byte, error)

type LabelledIPv6AddrPrefix

type LabelledIPv6AddrPrefix struct {
	LabelledIPAddrPrefix
}

func NewLabelledIPv6AddrPrefix

func NewLabelledIPv6AddrPrefix(length uint8, prefix string, label Label) *LabelledIPv6AddrPrefix

type LabelledVPNIPAddrPrefix

type LabelledVPNIPAddrPrefix struct {
	IPAddrPrefixDefault
	Labels Label
	RD     RouteDistinguisherInterface
	// contains filtered or unexported fields
}

func NewLabelledVPNIPAddrPrefix

func NewLabelledVPNIPAddrPrefix(length uint8, prefix string, label Label, rd RouteDistinguisherInterface) *LabelledVPNIPAddrPrefix

func (*LabelledVPNIPAddrPrefix) AFI

func (*LabelledVPNIPAddrPrefix) DecodeFromBytes

func (l *LabelledVPNIPAddrPrefix) DecodeFromBytes(data []byte) error

func (*LabelledVPNIPAddrPrefix) SAFI

func (l *LabelledVPNIPAddrPrefix) SAFI() uint8

func (*LabelledVPNIPAddrPrefix) Serialize

func (l *LabelledVPNIPAddrPrefix) Serialize() ([]byte, error)

type LabelledVPNIPv6AddrPrefix

type LabelledVPNIPv6AddrPrefix struct {
	LabelledVPNIPAddrPrefix
}

func NewLabelledVPNIPv6AddrPrefix

func NewLabelledVPNIPv6AddrPrefix(length uint8, prefix string, label Label, rd RouteDistinguisherInterface) *LabelledVPNIPv6AddrPrefix

func (*LabelledVPNIPv6AddrPrefix) AFI

type MessageError

type MessageError struct {
	TypeCode    uint8
	SubTypeCode uint8
	Data        []byte
	Message     string
}

func (*MessageError) Error

func (e *MessageError) Error() string

type NLRInfo

type NLRInfo struct {
	IPAddrPrefix
}

func NewNLRInfo

func NewNLRInfo(length uint8, prefix string) *NLRInfo

type OpaqueExtended

type OpaqueExtended struct {
	Value []byte
}

func (*OpaqueExtended) Serialize

func (e *OpaqueExtended) Serialize() ([]byte, error)

func (*OpaqueExtended) String

func (e *OpaqueExtended) String() string

type OptionParameterCapability

type OptionParameterCapability struct {
	ParamType  uint8
	ParamLen   uint8
	Capability []ParameterCapabilityInterface
}

func NewOptionParameterCapability

func NewOptionParameterCapability(capability []ParameterCapabilityInterface) *OptionParameterCapability

func (*OptionParameterCapability) DecodeFromBytes

func (o *OptionParameterCapability) DecodeFromBytes(data []byte) error

func (*OptionParameterCapability) Serialize

func (o *OptionParameterCapability) Serialize() ([]byte, error)

type OptionParameterInterface

type OptionParameterInterface interface {
	Serialize() ([]byte, error)
}

type OptionParameterUnknown

type OptionParameterUnknown struct {
	ParamType uint8
	ParamLen  uint8
	Value     []byte
}

func (*OptionParameterUnknown) Serialize

func (o *OptionParameterUnknown) Serialize() ([]byte, error)

type ParameterCapabilityInterface

type ParameterCapabilityInterface interface {
	DecodeFromBytes([]byte) error
	Serialize() ([]byte, error)
	Len() int
	Code() BGPCapabilityCode
}

type PathAttribute

type PathAttribute struct {
	Flags  uint8
	Type   BGPAttrType
	Length uint16
	Value  []byte
}

func (*PathAttribute) DecodeFromBytes

func (p *PathAttribute) DecodeFromBytes(data []byte) error

func (*PathAttribute) Len

func (p *PathAttribute) Len() int

func (*PathAttribute) Serialize

func (p *PathAttribute) Serialize() ([]byte, error)

type PathAttributeAggregator

type PathAttributeAggregator struct {
	PathAttribute
	Value PathAttributeAggregatorParam
}

func NewPathAttributeAggregator

func NewPathAttributeAggregator(as interface{}, address string) *PathAttributeAggregator

func (*PathAttributeAggregator) DecodeFromBytes

func (p *PathAttributeAggregator) DecodeFromBytes(data []byte) error

func (*PathAttributeAggregator) MarshalJSON

func (p *PathAttributeAggregator) MarshalJSON() ([]byte, error)

func (*PathAttributeAggregator) Serialize

func (p *PathAttributeAggregator) Serialize() ([]byte, error)

type PathAttributeAggregatorParam

type PathAttributeAggregatorParam struct {
	AS uint32

	Address net.IP
	// contains filtered or unexported fields
}

type PathAttributeAs4Aggregator

type PathAttributeAs4Aggregator struct {
	PathAttribute
	Value PathAttributeAggregatorParam
}

func NewPathAttributeAs4Aggregator

func NewPathAttributeAs4Aggregator(as uint32, address string) *PathAttributeAs4Aggregator

func (*PathAttributeAs4Aggregator) DecodeFromBytes

func (p *PathAttributeAs4Aggregator) DecodeFromBytes(data []byte) error

func (*PathAttributeAs4Aggregator) Serialize

func (p *PathAttributeAs4Aggregator) Serialize() ([]byte, error)

type PathAttributeAs4Path

type PathAttributeAs4Path struct {
	PathAttribute
	Value []*As4PathParam
	DefaultAsPath
}

func NewPathAttributeAs4Path

func NewPathAttributeAs4Path(value []*As4PathParam) *PathAttributeAs4Path

func (*PathAttributeAs4Path) DecodeFromBytes

func (p *PathAttributeAs4Path) DecodeFromBytes(data []byte) error

func (*PathAttributeAs4Path) MarshalJSON

func (p *PathAttributeAs4Path) MarshalJSON() ([]byte, error)

func (*PathAttributeAs4Path) Serialize

func (p *PathAttributeAs4Path) Serialize() ([]byte, error)

type PathAttributeAsPath

type PathAttributeAsPath struct {
	DefaultAsPath
	PathAttribute
	Value []AsPathParamInterface
}

func NewPathAttributeAsPath

func NewPathAttributeAsPath(value []AsPathParamInterface) *PathAttributeAsPath

func (*PathAttributeAsPath) DecodeFromBytes

func (p *PathAttributeAsPath) DecodeFromBytes(data []byte) error

func (*PathAttributeAsPath) MarshalJSON

func (p *PathAttributeAsPath) MarshalJSON() ([]byte, error)

func (*PathAttributeAsPath) Serialize

func (p *PathAttributeAsPath) Serialize() ([]byte, error)

type PathAttributeAtomicAggregate

type PathAttributeAtomicAggregate struct {
	PathAttribute
}

func NewPathAttributeAtomicAggregate

func NewPathAttributeAtomicAggregate() *PathAttributeAtomicAggregate

func (*PathAttributeAtomicAggregate) MarshalJSON

func (p *PathAttributeAtomicAggregate) MarshalJSON() ([]byte, error)

type PathAttributeClusterList

type PathAttributeClusterList struct {
	PathAttribute
	Value []net.IP
}

func NewPathAttributeClusterList

func NewPathAttributeClusterList(value []string) *PathAttributeClusterList

func (*PathAttributeClusterList) DecodeFromBytes

func (p *PathAttributeClusterList) DecodeFromBytes(data []byte) error

func (*PathAttributeClusterList) MarshalJSON

func (p *PathAttributeClusterList) MarshalJSON() ([]byte, error)

func (*PathAttributeClusterList) Serialize

func (p *PathAttributeClusterList) Serialize() ([]byte, error)

type PathAttributeCommunities

type PathAttributeCommunities struct {
	PathAttribute
	Value []uint32
}

func NewPathAttributeCommunities

func NewPathAttributeCommunities(value []uint32) *PathAttributeCommunities

func (*PathAttributeCommunities) DecodeFromBytes

func (p *PathAttributeCommunities) DecodeFromBytes(data []byte) error

func (*PathAttributeCommunities) MarshalJSON

func (p *PathAttributeCommunities) MarshalJSON() ([]byte, error)

func (*PathAttributeCommunities) Serialize

func (p *PathAttributeCommunities) Serialize() ([]byte, error)

type PathAttributeExtendedCommunities

type PathAttributeExtendedCommunities struct {
	PathAttribute
	Value []ExtendedCommunityInterface
}

func (*PathAttributeExtendedCommunities) DecodeFromBytes

func (p *PathAttributeExtendedCommunities) DecodeFromBytes(data []byte) error

func (*PathAttributeExtendedCommunities) Serialize

func (p *PathAttributeExtendedCommunities) Serialize() ([]byte, error)

type PathAttributeInterface

type PathAttributeInterface interface {
	DecodeFromBytes([]byte) error
	Serialize() ([]byte, error)
	Len() int
	// contains filtered or unexported methods
}

type PathAttributeLocalPref

type PathAttributeLocalPref struct {
	PathAttribute
	Value uint32
}

func NewPathAttributeLocalPref

func NewPathAttributeLocalPref(value uint32) *PathAttributeLocalPref

func (*PathAttributeLocalPref) DecodeFromBytes

func (p *PathAttributeLocalPref) DecodeFromBytes(data []byte) error

func (*PathAttributeLocalPref) MarshalJSON

func (p *PathAttributeLocalPref) MarshalJSON() ([]byte, error)

func (*PathAttributeLocalPref) Serialize

func (p *PathAttributeLocalPref) Serialize() ([]byte, error)

type PathAttributeMpReachNLRI

type PathAttributeMpReachNLRI struct {
	PathAttribute
	Nexthop net.IP
	AFI     uint16
	SAFI    uint8
	Value   []AddrPrefixInterface
}

func NewPathAttributeMpReachNLRI

func NewPathAttributeMpReachNLRI(nexthop string, nlri []AddrPrefixInterface) *PathAttributeMpReachNLRI

func (*PathAttributeMpReachNLRI) DecodeFromBytes

func (p *PathAttributeMpReachNLRI) DecodeFromBytes(data []byte) error

func (*PathAttributeMpReachNLRI) MarshalJSON

func (p *PathAttributeMpReachNLRI) MarshalJSON() ([]byte, error)

func (*PathAttributeMpReachNLRI) Serialize

func (p *PathAttributeMpReachNLRI) Serialize() ([]byte, error)

type PathAttributeMpUnreachNLRI

type PathAttributeMpUnreachNLRI struct {
	PathAttribute
	AFI   uint16
	SAFI  uint8
	Value []AddrPrefixInterface
}

func NewPathAttributeMpUnreachNLRI

func NewPathAttributeMpUnreachNLRI(nlri []AddrPrefixInterface) *PathAttributeMpUnreachNLRI

func (*PathAttributeMpUnreachNLRI) DecodeFromBytes

func (p *PathAttributeMpUnreachNLRI) DecodeFromBytes(data []byte) error

func (*PathAttributeMpUnreachNLRI) Serialize

func (p *PathAttributeMpUnreachNLRI) Serialize() ([]byte, error)

type PathAttributeMultiExitDisc

type PathAttributeMultiExitDisc struct {
	PathAttribute
	Value uint32
}

func NewPathAttributeMultiExitDisc

func NewPathAttributeMultiExitDisc(value uint32) *PathAttributeMultiExitDisc

func (*PathAttributeMultiExitDisc) DecodeFromBytes

func (p *PathAttributeMultiExitDisc) DecodeFromBytes(data []byte) error

func (*PathAttributeMultiExitDisc) MarshalJSON

func (p *PathAttributeMultiExitDisc) MarshalJSON() ([]byte, error)

func (*PathAttributeMultiExitDisc) Serialize

func (p *PathAttributeMultiExitDisc) Serialize() ([]byte, error)

type PathAttributeNextHop

type PathAttributeNextHop struct {
	PathAttribute
	Value net.IP
}

func NewPathAttributeNextHop

func NewPathAttributeNextHop(value string) *PathAttributeNextHop

func (*PathAttributeNextHop) DecodeFromBytes

func (p *PathAttributeNextHop) DecodeFromBytes(data []byte) error

func (*PathAttributeNextHop) MarshalJSON

func (p *PathAttributeNextHop) MarshalJSON() ([]byte, error)

func (*PathAttributeNextHop) Serialize

func (p *PathAttributeNextHop) Serialize() ([]byte, error)

type PathAttributeOrigin

type PathAttributeOrigin struct {
	PathAttribute
}

func NewPathAttributeOrigin

func NewPathAttributeOrigin(value uint8) *PathAttributeOrigin

func (*PathAttributeOrigin) MarshalJSON

func (p *PathAttributeOrigin) MarshalJSON() ([]byte, error)

type PathAttributeOriginatorId

type PathAttributeOriginatorId struct {
	PathAttribute
	Value net.IP
}

func NewPathAttributeOriginatorId

func NewPathAttributeOriginatorId(value string) *PathAttributeOriginatorId

func (*PathAttributeOriginatorId) DecodeFromBytes

func (p *PathAttributeOriginatorId) DecodeFromBytes(data []byte) error

func (*PathAttributeOriginatorId) MarshalJSON

func (p *PathAttributeOriginatorId) MarshalJSON() ([]byte, error)

func (*PathAttributeOriginatorId) Serialize

func (p *PathAttributeOriginatorId) Serialize() ([]byte, error)

type PathAttributeUnknown

type PathAttributeUnknown struct {
	PathAttribute
}

type RouteDistinguisherFourOctetAS

type RouteDistinguisherFourOctetAS struct {
	DefaultRouteDistinguisher
	Value RouteDistinguisherFourOctetASValue
}

func NewRouteDistinguisherFourOctetAS

func NewRouteDistinguisherFourOctetAS(admin uint32, assigned uint16) *RouteDistinguisherFourOctetAS

func (*RouteDistinguisherFourOctetAS) Serialize

func (rd *RouteDistinguisherFourOctetAS) Serialize() ([]byte, error)

type RouteDistinguisherFourOctetASValue

type RouteDistinguisherFourOctetASValue struct {
	Admin    uint32
	Assigned uint16
}

type RouteDistinguisherIPAddressAS

type RouteDistinguisherIPAddressAS struct {
	DefaultRouteDistinguisher
	Value RouteDistinguisherIPAddressASValue
}

func NewRouteDistinguisherIPAddressAS

func NewRouteDistinguisherIPAddressAS(admin string, assigned uint16) *RouteDistinguisherIPAddressAS

func (*RouteDistinguisherIPAddressAS) Serialize

func (rd *RouteDistinguisherIPAddressAS) Serialize() ([]byte, error)

type RouteDistinguisherIPAddressASValue

type RouteDistinguisherIPAddressASValue struct {
	Admin    net.IP
	Assigned uint16
}

type RouteDistinguisherInterface

type RouteDistinguisherInterface interface {
	DecodeFromBytes([]byte) error
	Serialize() ([]byte, error)
	Len() int
}

type RouteDistinguisherTwoOctetAS

type RouteDistinguisherTwoOctetAS struct {
	DefaultRouteDistinguisher
	Value RouteDistinguisherTwoOctetASValue
}

func NewRouteDistinguisherTwoOctetAS

func NewRouteDistinguisherTwoOctetAS(admin uint16, assigned uint32) *RouteDistinguisherTwoOctetAS

func (*RouteDistinguisherTwoOctetAS) Serialize

func (rd *RouteDistinguisherTwoOctetAS) Serialize() ([]byte, error)

type RouteDistinguisherTwoOctetASValue

type RouteDistinguisherTwoOctetASValue struct {
	Admin    uint16
	Assigned uint32
}

type RouteDistinguisherUnknown

type RouteDistinguisherUnknown struct {
	DefaultRouteDistinguisher
}

type RouteFamily

type RouteFamily int
const (
	RF_IPv4_UC   RouteFamily = AFI_IP<<16 | SAFI_UNICAST
	RF_IPv6_UC   RouteFamily = AFI_IP6<<16 | SAFI_UNICAST
	RF_IPv4_VPN  RouteFamily = AFI_IP<<16 | SAFI_MPLS_VPN
	RF_IPv6_VPN  RouteFamily = AFI_IP6<<16 | SAFI_MPLS_VPN
	RF_IPv4_MPLS RouteFamily = AFI_IP<<16 | SAFI_MPLS_LABEL
	RF_IPv6_MPLS RouteFamily = AFI_IP6<<16 | SAFI_MPLS_LABEL
	RF_RTC_UC    RouteFamily = AFI_IP<<16 | SAFI_ROUTE_TARGET_CONSTRTAINS
)

func (RouteFamily) String

func (i RouteFamily) String() string

type RouteTargetMembershipNLRI

type RouteTargetMembershipNLRI struct {
	AS          uint32
	RouteTarget ExtendedCommunityInterface
}

func (*RouteTargetMembershipNLRI) AFI

func (*RouteTargetMembershipNLRI) DecodeFromBytes

func (n *RouteTargetMembershipNLRI) DecodeFromBytes(data []byte) error

func (*RouteTargetMembershipNLRI) Len

func (n *RouteTargetMembershipNLRI) Len() int

func (*RouteTargetMembershipNLRI) SAFI

func (n *RouteTargetMembershipNLRI) SAFI() uint8

func (*RouteTargetMembershipNLRI) Serialize

func (n *RouteTargetMembershipNLRI) Serialize() ([]byte, error)

func (*RouteTargetMembershipNLRI) String

func (n *RouteTargetMembershipNLRI) String() string

type TwoOctetAsSpecificExtended

type TwoOctetAsSpecificExtended struct {
	SubType    uint8
	AS         uint16
	LocalAdmin uint32
}

func (*TwoOctetAsSpecificExtended) Serialize

func (e *TwoOctetAsSpecificExtended) Serialize() ([]byte, error)

func (*TwoOctetAsSpecificExtended) String

func (e *TwoOctetAsSpecificExtended) String() string

type UnknownExtended

type UnknownExtended struct {
	Type  BGPAttrType
	Value []byte
}

func (*UnknownExtended) Serialize

func (e *UnknownExtended) Serialize() ([]byte, error)

func (*UnknownExtended) String

func (e *UnknownExtended) String() string

type WithdrawnRoute

type WithdrawnRoute struct {
	IPAddrPrefix
}

Jump to

Keyboard shortcuts

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