bgp

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadRouterID = fmt.Errorf("Invalid router-id (must be IPv4 address")

ErrBadRouterID is returned when an invalid router-id is provided.

View Source
var ErrPeerNotFound = fmt.Errorf("Peer not found")

ErrPeerNotFound is returned when a user provided peer couldn't be found.

View Source
var ErrPrefixNotFound = fmt.Errorf("Prefix not found")

ErrPrefixNotFound is returned when a user provided prefix couldn't be found.

Functions

This section is empty.

Types

type DebugInfo

type DebugInfo struct {
	Server   DebugInfoServer   `json:"server" yaml:"server"`
	Prefixes []DebugInfoPrefix `json:"prefixes" yaml:"prefixes"`
	Peers    []DebugInfoPeer   `json:"peers" yaml:"peers"`
}

DebugInfo represents the internal debug state of the BGP server.

type DebugInfoPeer

type DebugInfoPeer struct {
	Address  string `json:"address" yaml:"address"`
	ASN      uint32 `json:"asn" yaml:"asn"`
	Password string `json:"password" yaml:"password"`
	Count    int    `json:"count" yaml:"count"`
	HoldTime uint64 `json:"holdtime" yaml:"holdtime"`
}

DebugInfoPeer exposes details on a single BGP peer.

type DebugInfoPrefix

type DebugInfoPrefix struct {
	Owner   string `json:"owner" yaml:"owner"`
	Prefix  string `json:"prefix" yaml:"prefix"`
	Nexthop string `json:"nexthop" yaml:"nexthop"`
}

DebugInfoPrefix exposes details on a single BGP prefix.

type DebugInfoServer

type DebugInfoServer struct {
	Address  string `json:"address" yaml:"address"`
	ASN      uint32 `json:"asn" yaml:"asn"`
	RouterID string `json:"router_id" yaml:"router_id"`
	Running  bool   `json:"running" yaml:"running"`
}

DebugInfoServer exposes the shared listener configuration.

type Server

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

Server represents a BGP server instance.

func NewServer

func NewServer() *Server

NewServer returns a new server instance.

func (*Server) AddPeer

func (s *Server) AddPeer(address net.IP, asn uint32, password string, holdTime uint64) error

AddPeer adds a new BGP peer.

func (*Server) AddPrefix

func (s *Server) AddPrefix(subnet net.IPNet, nexthop net.IP, owner string) error

AddPrefix adds a new prefix to the BGP server.

func (*Server) Debug

func (s *Server) Debug() DebugInfo

Debug returns a dump of the current configuration.

func (*Server) Reconfigure

func (s *Server) Reconfigure(address string, asn uint32, routerID net.IP) error

Reconfigure updates the listener with a new configuration..

func (*Server) RemovePeer

func (s *Server) RemovePeer(address net.IP) error

RemovePeer removes a prefix from the BGP server.

func (*Server) RemovePrefix

func (s *Server) RemovePrefix(subnet net.IPNet, nexthop net.IP) error

RemovePrefix removes a prefix from the BGP server.

func (*Server) RemovePrefixByOwner

func (s *Server) RemovePrefixByOwner(owner string) error

RemovePrefixByOwner removes all prefixes for the provided owner.

func (*Server) Start

func (s *Server) Start(address string, asn uint32, routerID net.IP) error

Start sets up the BGP listener.

func (*Server) Stop

func (s *Server) Stop() error

Stop tears down the BGP listener.

Jump to

Keyboard shortcuts

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