utils

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckArgsNonExist

func CheckArgsNonExist(args []string) bool

func CnovertStringToAsn

func CnovertStringToAsn(str string) (int, error)

func CnovertStringToIp

func CnovertStringToIp(str string) (netip.Addr, error)

func FindLongestPrefixIndex added in v1.1.4

func FindLongestPrefixIndex(rsp *ripestat.PrefixRoutingConsistency) int

FindLongestPrefixIndex returns the index of the route with the longest prefix that has in_bgp: true. If no BGP route found, returns the longest prefix regardless. Returns -1 if routes is empty.

func GetMaxConcurrentRequests added in v1.1.4

func GetMaxConcurrentRequests() int

func GetPrefixLength added in v1.1.4

func GetPrefixLength(prefix string) int

GetPrefixLength extracts the prefix length from a CIDR notation string e.g., "8.8.8.0/24" returns 24, "2001:db8::/32" returns 32

func PrintInvalidArgs added in v1.1.0

func PrintInvalidArgs(invalidSlice []string)

func ReadInputFile added in v1.1.4

func ReadInputFile(filename string) ([]string, error)

ReadInputFile reads a file and returns a slice of strings Each line in the file should contain one IP address or ASN Empty lines and lines starting with # are ignored

func SearchAsnInfo added in v1.1.0

func SearchAsnInfo(asns []int)

func SearchIpv4Info added in v1.1.0

func SearchIpv4Info(ipv4s []netip.Addr, longestPrefix bool)

func SearchIpv4InfoGroupByAsn added in v1.1.4

func SearchIpv4InfoGroupByAsn(ipv4s []netip.Addr)

func SearchIpv4InfoGroupByPrefix added in v1.1.4

func SearchIpv4InfoGroupByPrefix(ipv4s []netip.Addr)

func SearchIpv6Info added in v1.1.0

func SearchIpv6Info(ipv6s []netip.Addr, longestPrefix bool)

func SearchIpv6InfoGroupByAsn added in v1.1.4

func SearchIpv6InfoGroupByAsn(ipv6s []netip.Addr)

func SearchIpv6InfoGroupByPrefix added in v1.1.4

func SearchIpv6InfoGroupByPrefix(ipv6s []netip.Addr)

func SetMaxConcurrentRequests added in v1.1.4

func SetMaxConcurrentRequests(n int)

Types

type ASNInfo added in v1.1.4

type ASNInfo struct {
	ASN    int
	ASName string
}

type PrefixInfo added in v1.1.4

type PrefixInfo struct {
	Prefix string
	InBGP  bool
	ASN    int
	ASName string
}

Jump to

Keyboard shortcuts

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