diff --git a/lg.go b/lg.go index fc769c7..a72c158 100644 --- a/lg.go +++ b/lg.go @@ -88,7 +88,7 @@ func (p *Prefix) checkLGState() { upstream2 := "" offset := 2 if len(asPathSplit) < offset+1 { - return + continue } pos := 0 for i, asn := range asPathSplit { @@ -96,7 +96,7 @@ func (p *Prefix) checkLGState() { pos = i - 1 } if pos < 0 { - return + continue } } if pos == 0 { @@ -106,12 +106,12 @@ func (p *Prefix) checkLGState() { Str("expected origin", origin). Msg("correct origin not found, hijack possible") possibleHijack.Inc() - return + continue } upstream = asPathSplit[pos] if err != nil { log.Error().Err(err).Msg("atoi fail") - return + continue } matched := false for _, dbUpstream := range dbUpstreams { @@ -121,14 +121,15 @@ func (p *Prefix) checkLGState() { } } if !matched { - log.Info(). + //change this back to info after stabalizes + log.Debug(). Str("prefix", p.prefix). Str("upstream", upstream). Str("path", peer.AsPath). Int("pos", pos). Msg("expected upstream not found, hijack possible") possibleHijack.Inc() - return + continue } if !slices.Contains(upstreams, upstream) { upstreams = append(upstreams, upstream) @@ -136,12 +137,12 @@ func (p *Prefix) checkLGState() { // second upstream if len(asPathSplit) < offset+2 { - return + continue } upstream2 = asPathSplit[len(asPathSplit)-offset-1] if err != nil { log.Error().Err(err).Msg("atoi fail") - return + continue } if !slices.Contains(upstreams2, upstream2) { upstreams2 = append(upstreams2, upstream2) diff --git a/prefixes.go b/prefixes.go index 2c96f18..91d7807 100644 --- a/prefixes.go +++ b/prefixes.go @@ -35,6 +35,19 @@ var dbUpstreams = []Upstream{ } var monitorState = []Prefix{ + + Prefix{prefix: "104.17.224.0/20", pop: "cf valid4", available: true, origin: 13335}, + Prefix{prefix: "2606:4700::/44", pop: "cf valid6", available: true, origin: 13335}, + + Prefix{prefix: "103.21.244.0/24", pop: "cf invalid4", available: false, origin: 13335}, + Prefix{prefix: "2606:4700:7000::/48", pop: "cf invalid6", available: false, origin: 13335}, + + Prefix{prefix: "1.1.1.0/24", pop: "cf dns 0", available: true, origin: 13335}, + Prefix{prefix: "1.0.0.0/24", pop: "cf dns 1", available: true, origin: 13335}, + + Prefix{prefix: "198.8.58.0/24", pop: "ezri 0", available: true, origin: 206628}, + Prefix{prefix: "198.8.59.0/24", pop: "ezri 1", available: true, origin: 206628}, + Prefix{prefix: "184.164.250.0/24", pop: "rotate", available: true, origin: 47065}, Prefix{prefix: "184.164.251.0/24", pop: "rotate", available: true, origin: 47065}, @@ -391,16 +404,4 @@ var monitorState = []Prefix{ Prefix{prefix: "2804:269c:3d::/48", pop: "unknown", available: false, origin: 61574}, Prefix{prefix: "2804:269c:3e::/48", pop: "unknown", available: false, origin: 61574}, Prefix{prefix: "2804:269c:3f::/48", pop: "unknown", available: false, origin: 61574}, - - Prefix{prefix: "104.17.224.0/20", pop: "cf valid4", available: true, origin: 13335}, - Prefix{prefix: "2606:4700::/44", pop: "cf valid6", available: true, origin: 13335}, - - Prefix{prefix: "103.21.244.0/24", pop: "cf invalid4", available: false, origin: 13335}, - Prefix{prefix: "2606:4700:7000::/48", pop: "cf invalid6", available: false, origin: 13335}, - - Prefix{prefix: "1.1.1.0/24", pop: "cf dns 0", available: true, origin: 13335}, - Prefix{prefix: "1.0.0.0/24", pop: "cf dns 1", available: true, origin: 13335}, - - Prefix{prefix: "198.8.58.0/24", pop: "ezri 0", available: true, origin: 206628}, - Prefix{prefix: "198.8.59.0/24", pop: "ezri 1", available: true, origin: 206628}, }