community

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCommunityValue  = errors.New("invalid community value")
	ErrInvalidCommunityFormat = errors.New("invalid community format")
)

Functions

func IsLarge

func IsLarge(c BGPCommunity) bool

IsLarge returns true if this is a Legacy community.

func IsLegacy

func IsLegacy(c BGPCommunity) bool

IsLegacy returns true if this is a Legacy community.

Types

type BGPCommunity

type BGPCommunity interface {
	LessThan(BGPCommunity) bool
	String() string
}

BGPCommunity represents a BGP community.

func New

func New(c string) (BGPCommunity, error)

New parses the provided string and returns a newly created BGPCommunity object. Strings are parsed according to Juniper style syntax (https://www.juniper.net/documentation/us/en/software/\ junos/routing-policy/bgp/topics/concept/policy-bgp-communities-extended-communities-match-conditions-overview.html Legacy communities are of format "<AS number>:<community value>". Extended communities (support of which is yet to be implemented) are of format "<type>:<administrator>:<assigned-number>". Large communities are of format large:<global administrator>:<localdata part 1>:<localdata part 2>.

type BGPCommunityLarge

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

BGPCommunity holds the internal representation of a large BGP community.

func (BGPCommunityLarge) LessThan

func (b BGPCommunityLarge) LessThan(c BGPCommunity) bool

LessThan makes 2 different BGPCommunity objects comparable. For the sake of comparison, legacy communities are considered to be large communities in format <legacy community>:0:0 and thus can be compared with large communities.

func (BGPCommunityLarge) String

func (b BGPCommunityLarge) String() string

String returns the string representation of this community. Large communities will be printed as ("<global administrator>:<localdata part 1>:<localdata part 2>").

type BGPCommunityLegacy

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

BGPCommunityLegacy holds the internal representation of a BGP legacy community.

func (BGPCommunityLegacy) LessThan

func (b BGPCommunityLegacy) LessThan(c BGPCommunity) bool

LessThan makes 2 different BGPCommunity objects comparable. For the sake of comparison, legacy communities are considered to be large communities in format <legacy community>:0:0 and thus can be compared with large communities.

func (BGPCommunityLegacy) String

func (b BGPCommunityLegacy) String() string

String returns the string representation of this community. Legacy communities will be printed in new-format, "<AS number>:<community value>".

func (BGPCommunityLegacy) ToUint32

func (b BGPCommunityLegacy) ToUint32() uint32

ToUint32 returns the uint32 representation of this legacy community.

Jump to

Keyboard shortcuts

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