fix(router): close httpLoader on shutdown, log parse errors, default nil logger
- Add missing httpLoader.Close() in localRouter.Close() to prevent resource leak - Log parse errors from file/redis/http loaders instead of silently discarding them - Add nil reader guards before calling parseRoutes in load() - Default nil logger to xlogger.Nop() to prevent nil panics - Use context.Background() instead of context.TODO() for root context - Use strings.ReplaceAll instead of deprecated strings.Replace with -1 - Add doc comments to all exported symbols - Add 27 unit tests + 1 benchmark
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/vishvananda/netlink"
|
||||
)
|
||||
|
||||
// setSysRoutes applies the given routes as system-level network routes using netlink.
|
||||
func (p *localRouter) setSysRoutes(routes ...*router.Route) error {
|
||||
for _, route := range routes {
|
||||
if route.Net == nil {
|
||||
|
||||
Reference in New Issue
Block a user