routers

package
v0.0.0-...-fa76d37 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRouterMap

func CreateRouterMap(cfg *utils.Config) utils.RouterMap

func Get

func Get(name string) utils.Router

Types

type Yaml

type Yaml struct {
	Path     string // Path represents the file path.
	Template struct {
		Name string `yaml:"name"` // Name represents the template name.
		Ping struct {
			Any  []string `yaml:"any"`  // Any represents the list of ping targets for any IP address.
			IPv4 []string `yaml:"ipv4"` // IPv4 represents the list of ping targets for IPv4 addresses.
			IPv6 []string `yaml:"ipv6"` // IPv6 represents the list of ping targets for IPv6 addresses.
		} `yaml:"ping"` // Ping represents the ping section in the template.
		Traceroute struct {
			Any  []string `yaml:"any"`  // Any represents the list of traceroute targets for any IP address.
			IPv4 []string `yaml:"ipv4"` // IPv4 represents the list of traceroute targets for IPv4 addresses.
			IPv6 []string `yaml:"ipv6"` // IPv6 represents the list of traceroute targets for IPv6 addresses.
		} `yaml:"traceroute"` // Traceroute represents the traceroute section in the template.
		BGP struct {
			Route     []string `yaml:"route"`     // Route represents the list of BGP routes.
			Community []string `yaml:"community"` // Community represents the list of BGP communities.
			ASPath    []string `yaml:"aspath"`    // ASPath represents the list of BGP AS paths.
		} `yaml:"bgp"` // BGP represents the BGP section in the template.
	}
}

Yaml represents the structure of a YAML file.

func (*Yaml) BGPASPath

func (rt *Yaml) BGPASPath(cfg *utils.RouterConfig, aspath string) ([]string, error)

BGPASPath returns a slice of strings representing the BGP AS path for the given router configuration and AS path string. It uses the "_tpl" method to render the "bgp.aspath" template with the provided configuration and AS path.

func (*Yaml) BGPCommunity

func (rt *Yaml) BGPCommunity(cfg *utils.RouterConfig, community string) ([]string, error)

BGPCommunity returns a list of strings representing the BGP community values for the given router configuration and community.

func (*Yaml) BGPRoute

func (rt *Yaml) BGPRoute(cfg *utils.RouterConfig, ip *utils.IPNet) ([]string, error)

BGPRoute generates BGP route configuration based on the provided RouterConfig and IPNet. It returns a slice of strings representing the generated configuration and an error if any.

func (*Yaml) Ping

func (rt *Yaml) Ping(cfg *utils.RouterConfig, ip *utils.IPNet) ([]string, error)

Ping sends a ping request to the specified IP address using the provided router configuration. It returns a slice of strings representing the ping response and an error if any.

func (*Yaml) Traceroute

func (rt *Yaml) Traceroute(cfg *utils.RouterConfig, ip *utils.IPNet) ([]string, error)

Traceroute performs a traceroute operation using the provided router configuration and IP address. It returns a slice of strings representing the traceroute results and an error if any.

Jump to

Keyboard shortcuts

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