| 1 | package parserscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/ |
| 2 | |
| 3 | import ( |
| 4 | "bufioscip-go gomod github.com/golang/go/src go1.25 bufio/" |
| 5 | "bytesscip-go gomod github.com/golang/go/src go1.25 bytes/" |
| 6 | "regexpscip-go gomod github.com/golang/go/src go1.25 regexp/" |
| 7 | "strconvscip-go gomod github.com/golang/go/src go1.25 strconv/" |
| 8 | "stringsscip-go gomod github.com/golang/go/src go1.25 strings/" |
| 9 | |
| 10 | "github.com/czerwonk/bird_exporter/protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/" |
| 11 | ) |
| 12 | |
| 13 | var ( |
| 14 | protocolRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/protocolRegex. *regexpscip-go gomod github.com/golang/go/src go1.25 regexp/.Regexpscip-go gomod github.com/golang/go/src go1.25 regexp/Regexp# |
| 15 | descriptionRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/descriptionRegex. *regexpscip-go gomod github.com/golang/go/src go1.25 regexp/.Regexpscip-go gomod github.com/golang/go/src go1.25 regexp/Regexp# |
| 16 | routeRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/routeRegex. *regexpscip-go gomod github.com/golang/go/src go1.25 regexp/.Regexpscip-go gomod github.com/golang/go/src go1.25 regexp/Regexp# |
| 17 | uptimeRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/uptimeRegex. *regexpscip-go gomod github.com/golang/go/src go1.25 regexp/.Regexpscip-go gomod github.com/golang/go/src go1.25 regexp/Regexp# |
| 18 | routeChangeRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/routeChangeRegex. *regexpscip-go gomod github.com/golang/go/src go1.25 regexp/.Regexpscip-go gomod github.com/golang/go/src go1.25 regexp/Regexp# |
| 19 | filterRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/filterRegex. *regexpscip-go gomod github.com/golang/go/src go1.25 regexp/.Regexpscip-go gomod github.com/golang/go/src go1.25 regexp/Regexp# |
| 20 | channelRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/channelRegex. *regexpscip-go gomod github.com/golang/go/src go1.25 regexp/.Regexpscip-go gomod github.com/golang/go/src go1.25 regexp/Regexp# |
| 21 | ) |
| 22 | |
| 23 | type contextscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context# struct { |
| 24 | currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current. *protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.Protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol# |
| 25 | linescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#line. string |
| 26 | handledscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#handled. bool |
| 27 | protocolsscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#protocols. []*protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.Protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol# |
| 28 | ipVersionscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#ipVersion. string |
| 29 | } |
| 30 | |
| 31 | func initscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/init().() { |
| 32 | protocolRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/protocolRegex. = regexpscip-go gomod github.com/golang/go/src go1.25 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.25 regexp/MustCompile().(`^(?:1002\-)?([^\s]+)\s+(MRT|BGP|BFD|OSPF|RPKI|RIP|RAdv|Pipe|Perf|Direct|Babel|Device|Kernel|Static)\s+([^\s]+)\s+([^\s]+)\s+(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}|[^\s]+)(?:\s+(.*?))?$`) |
| 33 | descriptionRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/descriptionRegex. = regexpscip-go gomod github.com/golang/go/src go1.25 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.25 regexp/MustCompile().(`Description:\s+(.*)`) |
| 34 | routeRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/routeRegex. = regexpscip-go gomod github.com/golang/go/src go1.25 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.25 regexp/MustCompile().(`^\s+Routes:\s+(\d+) imported, (?:(\d+) filtered, )?(\d+) exported(?:, (\d+) preferred)?`) |
| 35 | uptimeRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/uptimeRegex. = regexpscip-go gomod github.com/golang/go/src go1.25 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.25 regexp/MustCompile().(`^(?:((\d+):(\d{2}):(\d{2}))|(\d+)|(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}))$`) |
| 36 | routeChangeRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/routeChangeRegex. = regexpscip-go gomod github.com/golang/go/src go1.25 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.25 regexp/MustCompile().(`(Import|Export) (updates|withdraws):\s+(\d+|---)\s+(\d+|---)\s+(\d+|---)\s+(\d+|---)\s+(\d+|---)\s*`) |
| 37 | filterRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/filterRegex. = regexpscip-go gomod github.com/golang/go/src go1.25 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.25 regexp/MustCompile().(`(Input|Output) filter:\s+(.*)`) |
| 38 | channelRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/channelRegex. = regexpscip-go gomod github.com/golang/go/src go1.25 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.25 regexp/MustCompile().(`Channel ipv(4|6)`) |
| 39 | } |
| 40 | |
| 41 | // ParseProtocols parses bird output and returns protocol.Protocol structs |
| 42 | func ParseProtocolsscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/ParseProtocols().(data []byte, ipVersion string) []*protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.Protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol# { |
| 43 | reader := bytesscip-go gomod github.com/golang/go/src go1.25 bytes/.NewReaderscip-go gomod github.com/golang/go/src go1.25 bytes/NewReader().(data) |
| 44 | scanner := bufioscip-go gomod github.com/golang/go/src go1.25 bufio/.NewScannerscip-go gomod github.com/golang/go/src go1.25 bufio/NewScanner().(reader) |
| 45 | |
| 46 | c := &contextscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#{protocolsscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#protocols.: make([]*protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.Protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#, 0), ipVersionscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#ipVersion.: ipVersion} |
| 47 | |
| 48 | var handlers = []func(*contextscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#){ |
| 49 | handleEmptyLinescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/handleEmptyLine()., |
| 50 | parseLineForProtocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseLineForProtocol()., |
| 51 | parseLineForDescriptionscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseLineForDescription()., |
| 52 | parseLineForChannelscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseLineForChannel()., |
| 53 | parseLineForRoutesscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseLineForRoutes()., |
| 54 | parseLineForRouteChangesscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseLineForRouteChanges()., |
| 55 | parseLineForFilterNamescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseLineForFilterName()., |
| 56 | } |
| 57 | |
| 58 | for scanner.Scanscip-go gomod github.com/golang/go/src go1.25 bufio/Scanner#Scan().() { |
| 59 | c.linescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#line. = stringsscip-go gomod github.com/golang/go/src go1.25 strings/.TrimRightscip-go gomod github.com/golang/go/src go1.25 strings/TrimRight().(scanner.Textscip-go gomod github.com/golang/go/src go1.25 bufio/Scanner#Text().(), " ") |
| 60 | c.handledscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#handled. = false |
| 61 | |
| 62 | for _, h := range handlers { |
| 63 | if !c.handledscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#handled. { |
| 64 | h(c) |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | return c.protocolsscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#protocols. |
| 70 | } |
| 71 | |
| 72 | func handleEmptyLinescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/handleEmptyLine().(c *contextscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#) { |
| 73 | if c.linescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#line. != "" { |
| 74 | return |
| 75 | } |
| 76 | |
| 77 | c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current. = nil |
| 78 | c.handledscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#handled. = true |
| 79 | } |
| 80 | |
| 81 | func parseLineForProtocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseLineForProtocol().(c *contextscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#) { |
| 82 | match := protocolRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/protocolRegex..FindStringSubmatchscip-go gomod github.com/golang/go/src go1.25 regexp/Regexp#FindStringSubmatch().(c.linescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#line.) |
| 83 | |
| 84 | if match == nil { |
| 85 | return |
| 86 | } |
| 87 | |
| 88 | proto := parseProtoscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseProto().(match[2]) |
| 89 | ut := parseUptimescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseUptime().(match[5]) |
| 90 | |
| 91 | c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current. = protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.NewProtocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/NewProtocol().(match[1], proto, c.ipVersionscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#ipVersion., ut) |
| 92 | c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current..Upscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Up. = parseStatescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseState().(match[4]) |
| 93 | c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current..Statescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#State. = match[6] |
| 94 | |
| 95 | c.protocolsscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#protocols. = append(c.protocolsscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#protocols., c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current.) |
| 96 | c.handledscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#handled. = true |
| 97 | } |
| 98 | |
| 99 | func parseLineForDescriptionscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseLineForDescription().(c *contextscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#) { |
| 100 | match := descriptionRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/descriptionRegex..FindStringSubmatchscip-go gomod github.com/golang/go/src go1.25 regexp/Regexp#FindStringSubmatch().(c.linescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#line.) |
| 101 | |
| 102 | if match == nil { |
| 103 | return |
| 104 | } |
| 105 | |
| 106 | if len(match) <= 1 { |
| 107 | return |
| 108 | } |
| 109 | |
| 110 | c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current..Descriptionscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Description. = stringsscip-go gomod github.com/golang/go/src go1.25 strings/.Joinscip-go gomod github.com/golang/go/src go1.25 strings/Join().(match[1:], " ") |
| 111 | } |
| 112 | |
| 113 | func parseProtoscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseProto().(val string) protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.Protoscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Proto# { |
| 114 | switch val { |
| 115 | case "BGP": |
| 116 | return protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.BGPscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/BGP. |
| 117 | case "OSPF": |
| 118 | return protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.OSPFscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/OSPF. |
| 119 | case "Direct": |
| 120 | return protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.Directscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Direct. |
| 121 | case "Kernel": |
| 122 | return protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.Kernelscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Kernel. |
| 123 | case "Static": |
| 124 | return protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.Staticscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Static. |
| 125 | case "Babel": |
| 126 | return protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.Babelscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Babel. |
| 127 | case "RPKI": |
| 128 | return protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.RPKIscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/RPKI. |
| 129 | case "BFD": |
| 130 | return protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.BFDscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/BFD. |
| 131 | } |
| 132 | |
| 133 | return protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.PROTO_UNKNOWNscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/PROTO_UNKNOWN. |
| 134 | } |
| 135 | |
| 136 | func parseStatescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseState().(state string) int { |
| 137 | if state == "up" { |
| 138 | return 1 |
| 139 | } |
| 140 | |
| 141 | return 0 |
| 142 | } |
| 143 | |
| 144 | func parseUptimescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseUptime().(value string) int { |
| 145 | match := uptimeRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/uptimeRegex..FindStringSubmatchscip-go gomod github.com/golang/go/src go1.25 regexp/Regexp#FindStringSubmatch().(value) |
| 146 | |
| 147 | if match == nil { |
| 148 | return 0 |
| 149 | } |
| 150 | |
| 151 | if len(match[1]) > 0 { |
| 152 | return parseUptimeForDurationscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseUptimeForDuration().(match) |
| 153 | } |
| 154 | |
| 155 | if len(match[5]) > 0 { |
| 156 | return parseUptimeForTimestampscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseUptimeForTimestamp().(value) |
| 157 | } |
| 158 | |
| 159 | return parseUptimeForIsoscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseUptimeForIso().(value) |
| 160 | } |
| 161 | |
| 162 | func parseLineForChannelscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseLineForChannel().(c *contextscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#) { |
| 163 | if c.ipVersionscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#ipVersion. != "" || c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current. == nil { |
| 164 | return |
| 165 | } |
| 166 | |
| 167 | channel := channelRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/channelRegex..FindStringSubmatchscip-go gomod github.com/golang/go/src go1.25 regexp/Regexp#FindStringSubmatch().(c.linescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#line.) |
| 168 | if channel == nil { |
| 169 | return |
| 170 | } |
| 171 | |
| 172 | if len(c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current..IPVersionscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#IPVersion.) == 0 { |
| 173 | c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current..IPVersionscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#IPVersion. = channel[1] |
| 174 | } else { |
| 175 | c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current. = &protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.Protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#{ |
| 176 | Namescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Name.: c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current..Namescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Name., |
| 177 | Protoscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Proto.: c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current..Protoscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Proto., |
| 178 | Upscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Up.: c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current..Upscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Up., |
| 179 | Uptimescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Uptime.: c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current..Uptimescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Uptime., |
| 180 | IPVersionscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#IPVersion.: channel[1], |
| 181 | } |
| 182 | c.protocolsscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#protocols. = append(c.protocolsscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#protocols., c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current.) |
| 183 | } |
| 184 | |
| 185 | c.handledscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#handled. = true |
| 186 | } |
| 187 | |
| 188 | func parseLineForRoutesscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseLineForRoutes().(c *contextscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#) { |
| 189 | if c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current. == nil { |
| 190 | return |
| 191 | } |
| 192 | |
| 193 | match := routeRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/routeRegex..FindStringSubmatchscip-go gomod github.com/golang/go/src go1.25 regexp/Regexp#FindStringSubmatch().(c.linescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#line.) |
| 194 | if match == nil { |
| 195 | return |
| 196 | } |
| 197 | |
| 198 | c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current..Importedscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Imported., _ = strconvscip-go gomod github.com/golang/go/src go1.25 strconv/.ParseIntscip-go gomod github.com/golang/go/src go1.25 strconv/ParseInt().(match[1], 10, 64) |
| 199 | c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current..Exportedscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Exported., _ = strconvscip-go gomod github.com/golang/go/src go1.25 strconv/.ParseIntscip-go gomod github.com/golang/go/src go1.25 strconv/ParseInt().(match[3], 10, 64) |
| 200 | |
| 201 | if len(match[2]) > 0 { |
| 202 | c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current..Filteredscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Filtered., _ = strconvscip-go gomod github.com/golang/go/src go1.25 strconv/.ParseIntscip-go gomod github.com/golang/go/src go1.25 strconv/ParseInt().(match[2], 10, 64) |
| 203 | } |
| 204 | |
| 205 | if len(match[4]) > 0 { |
| 206 | c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current..Preferredscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#Preferred., _ = strconvscip-go gomod github.com/golang/go/src go1.25 strconv/.ParseIntscip-go gomod github.com/golang/go/src go1.25 strconv/ParseInt().(match[4], 10, 64) |
| 207 | } |
| 208 | |
| 209 | c.handledscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#handled. = true |
| 210 | } |
| 211 | |
| 212 | func parseLineForRouteChangesscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseLineForRouteChanges().(c *contextscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#) { |
| 213 | if c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current. == nil { |
| 214 | return |
| 215 | } |
| 216 | |
| 217 | match := routeChangeRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/routeChangeRegex..FindStringSubmatchscip-go gomod github.com/golang/go/src go1.25 regexp/Regexp#FindStringSubmatch().(c.linescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#line.) |
| 218 | if match == nil { |
| 219 | return |
| 220 | } |
| 221 | |
| 222 | x := getRouteChangeCountscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/getRouteChangeCount().(match, c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current.) |
| 223 | x.Receivedscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/RouteChangeCount#Received. = parseRouteChangeValuescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseRouteChangeValue().(match[3]) |
| 224 | x.Rejectedscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/RouteChangeCount#Rejected. = parseRouteChangeValuescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseRouteChangeValue().(match[4]) |
| 225 | x.Filteredscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/RouteChangeCount#Filtered. = parseRouteChangeValuescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseRouteChangeValue().(match[5]) |
| 226 | x.Ignoredscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/RouteChangeCount#Ignored. = parseRouteChangeValuescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseRouteChangeValue().(match[6]) |
| 227 | x.Acceptedscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/RouteChangeCount#Accepted. = parseRouteChangeValuescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseRouteChangeValue().(match[7]) |
| 228 | |
| 229 | c.handledscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#handled. = true |
| 230 | } |
| 231 | |
| 232 | func getRouteChangeCountscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/getRouteChangeCount().(values []string, p *protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.Protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#) *protocolscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/.RouteChangeCountscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/RouteChangeCount# { |
| 233 | if values[1] == "Import" { |
| 234 | if values[2] == "updates" { |
| 235 | return &p.ImportUpdatesscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#ImportUpdates. |
| 236 | } |
| 237 | |
| 238 | return &p.ImportWithdrawsscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#ImportWithdraws. |
| 239 | } |
| 240 | |
| 241 | if values[2] == "updates" { |
| 242 | return &p.ExportUpdatesscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#ExportUpdates. |
| 243 | } |
| 244 | |
| 245 | return &p.ExportWithdrawsscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#ExportWithdraws. |
| 246 | } |
| 247 | |
| 248 | func parseRouteChangeValuescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseRouteChangeValue().(value string) int64 { |
| 249 | if value == "---" { |
| 250 | return 0 |
| 251 | } |
| 252 | |
| 253 | return parseIntscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseInt().(value) |
| 254 | } |
| 255 | |
| 256 | func parseLineForFilterNamescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/parseLineForFilterName().(c *contextscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#) { |
| 257 | if c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current. == nil { |
| 258 | return |
| 259 | } |
| 260 | |
| 261 | match := filterRegexscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/filterRegex..FindStringSubmatchscip-go gomod github.com/golang/go/src go1.25 regexp/Regexp#FindStringSubmatch().(c.linescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#line.) |
| 262 | if match == nil { |
| 263 | return |
| 264 | } |
| 265 | |
| 266 | if match[1] == "Input" { |
| 267 | c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current..ImportFilterscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#ImportFilter. = match[2] |
| 268 | } else { |
| 269 | c.currentscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#current..ExportFilterscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/Protocol#ExportFilter. = match[2] |
| 270 | } |
| 271 | |
| 272 | c.handledscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/context#handled. = true |
| 273 | } |