add router handler & connector

This commit is contained in:
ginuerzh
2025-02-07 15:44:31 +08:00
parent 379d9a73ad
commit 355c72477a
25 changed files with 1265 additions and 110 deletions
+5 -3
View File
@@ -250,10 +250,11 @@ func (p *localRouter) Close() error {
}
func ParseRoute(dst string, gateway string) *router.Route {
_, ipNet, _ := net.ParseCIDR(dst)
if ipNet == nil {
if dst == "" {
return nil
}
_, ipNet, _ := net.ParseCIDR(dst)
gw := net.ParseIP(gateway)
if gw == nil {
return nil
@@ -261,6 +262,7 @@ func ParseRoute(dst string, gateway string) *router.Route {
return &router.Route{
Net: ipNet,
Gateway: gw,
Dst: dst,
Gateway: gateway,
}
}