mirror of
https://github.com/alice-lg/birdwatcher.git
synced 2025-03-09 00:00:05 +01:00
Merge branch 'develop' into master for 1.12.1
Changes since last version: * Parser: ignore whitespace at the end of the protocol line * Fix parser tests failing
This commit is contained in:
commit
67fdd4b95c
3 changed files with 8 additions and 10 deletions
|
@ -65,7 +65,7 @@ func init() {
|
|||
regex.routeCount.countRx = regexp.MustCompile(`^(\d+)\s+of\s+(\d+)\s+routes.*$`)
|
||||
|
||||
regex.protocol.channel = regexp.MustCompile("Channel ipv([46])")
|
||||
regex.protocol.protocol = regexp.MustCompile(`^(?:1002\-)?([^\s]+)\s+(BGP|Pipe|BFD|Direct|Device|Kernel)\s+([^\s]+)\s+([^\s]+)\s+(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}|[^\s]+)(?:\s+(.*))?$`)
|
||||
regex.protocol.protocol = regexp.MustCompile(`^(?:1002\-)?([^\s]+)\s+(BGP|Pipe|BFD|Direct|Device|Kernel)\s+([^\s]+)\s+([^\s]+)\s+(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}|[^\s]+)(?:\s+(.*?)\s*)?$`)
|
||||
regex.protocol.numericValue = regexp.MustCompile(`^\s+([^:]+):\s+([\d]+)\s*$`)
|
||||
regex.protocol.routes = regexp.MustCompile(`^\s+Routes:\s+(.*)`)
|
||||
regex.protocol.stringValue = regexp.MustCompile(`^\s+([^:]+):\s+(.+)\s*$`)
|
||||
|
|
|
@ -2,11 +2,9 @@ package main
|
|||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"strings"
|
||||
|
||||
|
@ -126,6 +124,8 @@ func (m *MyLogger) Write(p []byte) (n int, err error) {
|
|||
}
|
||||
|
||||
func main() {
|
||||
// Disable timestamps for the default logger, as they are generated by the syslog implementation
|
||||
log.SetFlags(log.Flags() &^ (log.Ldate | log.Ltime))
|
||||
bird6 := flag.Bool("6", false, "Use bird6 instead of bird")
|
||||
workerPoolSize := flag.Int("worker-pool-size", 8, "Number of go routines used to parse routing tables concurrently")
|
||||
configfile := flag.String("config", "/etc/birdwatcher/birdwatcher.conf", "Configuration file location")
|
||||
|
@ -168,12 +168,10 @@ func main() {
|
|||
// Make server
|
||||
r := makeRouter(conf.Server)
|
||||
|
||||
// Set up our own custom log.Logger
|
||||
// Use this weird golang format to imitate log.Logger's timestamp in log.Prefix()
|
||||
ts := time.Now().Format("2006/01/02 15:04:05")
|
||||
// set log prefix timestamp to our own custom prefix
|
||||
log.SetPrefix(ts)
|
||||
myquerylog := log.New(os.Stdout, fmt.Sprintf("%s %s: ", ts, "QUERY"), 0)
|
||||
// Set up our own custom log.Logger without a prefix
|
||||
myquerylog := log.New(os.Stdout, "", 0)
|
||||
// Disable timestamps, as they are contained in the query log
|
||||
myquerylog.SetFlags(myquerylog.Flags() &^ (log.Ldate | log.Ltime))
|
||||
mylogger := &MyLogger{myquerylog}
|
||||
|
||||
if conf.Server.EnableTLS {
|
||||
|
|
|
@ -19,7 +19,7 @@ BIRD 1.6.3 ready.
|
|||
BGP.community: (65011,40) (9033,3251)
|
||||
BGP.large_community: (9033, 65666, 12) (9033, 65666, 9)
|
||||
BGP.ext_community: (ro, 21414, 52001) (ro, 21414, 52004) (ro, 21414, 64515)
|
||||
unicast [ID8503_AS1340 2017-06-21 08:17:33] (100/?) [AS1340i]
|
||||
unicast [ID8503_AS1340 2017-06-21 08:17:33] (100/?) [AS1340i]
|
||||
via 1.2.3.16 on eno8
|
||||
Type: BGP univ
|
||||
BGP.origin: IGP
|
||||
|
|
Loading…
Add table
Reference in a new issue