1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-27 06:10:26 +08:00

chore: remove debug log at build

This commit is contained in:
源文雨
2024-08-03 15:32:31 +08:00
parent 08688b584b
commit fa9abff1a8
13 changed files with 218 additions and 78 deletions

View File

@@ -7,6 +7,8 @@ import (
"github.com/FloatTech/ttl"
"github.com/sirupsen/logrus"
"github.com/fumiama/WireGold/config"
)
type Router struct {
@@ -45,7 +47,9 @@ func (r *Router) SetDefault(l *Link) {
func (r *Router) NextHop(ip string) (l *Link) {
l = r.cache.Get(ip)
if l != nil {
logrus.Debugln("[router] get cached nexthop to", ip, "link", l)
if config.ShowDebugLog {
logrus.Debugln("[router] get cached nexthop to", ip, "link", l)
}
return
}
ipb := net.ParseIP(ip)
@@ -62,7 +66,9 @@ func (r *Router) NextHop(ip string) (l *Link) {
for _, c := range r.list {
if c.Contains(ipb) {
l = r.table[c.String()]
logrus.Debugln("[router] get nexthop to", ipb, "-->", c, "link", l)
if config.ShowDebugLog {
logrus.Debugln("[router] get nexthop to", ipb, "-->", c, "link", l)
}
r.cache.Set(ip, l)
return l
}