mirror of
https://github.com/alice-lg/birdwatcher.git
synced 2025-03-09 00:00:05 +01:00
Merge pull request #3 from ecix/filter-meta
Add useful meta data to filtered routes
This commit is contained in:
commit
3e8140a414
4 changed files with 8 additions and 8 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.7.8
|
||||
1.7.12
|
||||
|
|
|
@ -159,7 +159,6 @@ func ProtocolsBgp() (Parsed, bool) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
return Parsed{"protocols": bgpProto, "ttl": p["ttl"]}, from_cache
|
||||
}
|
||||
|
||||
|
@ -182,7 +181,7 @@ func RoutesProtoCount(protocol string) (Parsed, bool) {
|
|||
}
|
||||
|
||||
func RoutesFiltered(protocol string) (Parsed, bool) {
|
||||
return RunAndParse("route protocol '"+protocol+"' filtered", parseRoutes)
|
||||
return RunAndParse("route filtered protocol '"+protocol+"' all", parseRoutes)
|
||||
}
|
||||
|
||||
func RoutesExport(protocol string) (Parsed, bool) {
|
||||
|
|
|
@ -131,8 +131,9 @@ func parseRoutes(input []byte) Parsed {
|
|||
second_rx := regexp.MustCompile(`^\s+via\s+([0-9a-f\.\:]+)\s+on\s+([\w+)\s+\[([\w\.]+)\s+([0-9\-\:\s]+)(?:\s+from\s+([0-9a-f\.\:\/]+)){0,1}\]\s+(?:(\*)\s+){0,1}\((\d+)(?:\/\d+){0,1}\).*$`)
|
||||
type_rx := regexp.MustCompile(`^\s+Type:\s+(.*)\s*$`)
|
||||
bgp_rx := regexp.MustCompile(`^\s+BGP.(\w+):\s+(.+)\s*$`)
|
||||
community_rx := regexp.MustCompile(`^\((\d+),(\d+)\)`)
|
||||
large_community_rx := regexp.MustCompile(`^\((\d+),(\d+),(\d+)\)`)
|
||||
community_rx := regexp.MustCompile(`^\((\d+),\s*(\d+)\)`)
|
||||
large_community_rx := regexp.MustCompile(`^\((\d+),\s*(\d+),\s*(\d+)\)`)
|
||||
paren_rx := regexp.MustCompile(`\([^\(]*\)\s*`)
|
||||
for _, line := range lines {
|
||||
if specialLine(line) || (len(route) == 0 && emptyLine(line)) {
|
||||
continue
|
||||
|
@ -178,7 +179,7 @@ func parseRoutes(input []byte) Parsed {
|
|||
|
||||
if groups[1] == "community" {
|
||||
communities := [][]int64{}
|
||||
for _, community := range strings.Split(groups[2], " ") {
|
||||
for _, community := range paren_rx.FindAllString(groups[2], -1) {
|
||||
if community_rx.MatchString(community) {
|
||||
com_groups := community_rx.FindStringSubmatch(community)
|
||||
maj := parseInt(com_groups[1])
|
||||
|
@ -189,7 +190,7 @@ func parseRoutes(input []byte) Parsed {
|
|||
bgp["communities"] = communities
|
||||
} else if groups[1] == "large_community" {
|
||||
communities := [][]int64{}
|
||||
for _, community := range strings.Split(groups[2], " ") {
|
||||
for _, community := range paren_rx.FindAllString(groups[2], -1) {
|
||||
if large_community_rx.MatchString(community) {
|
||||
com_groups := large_community_rx.FindStringSubmatch(community)
|
||||
maj := parseInt(com_groups[1])
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
)
|
||||
|
||||
//go:generate versionize
|
||||
var VERSION = "1.7.8"
|
||||
var VERSION = "1.7.11"
|
||||
|
||||
func isModuleEnabled(module string, modulesEnabled []string) bool {
|
||||
for _, enabled := range modulesEnabled {
|
||||
|
|
Loading…
Add table
Reference in a new issue