mirror of
https://github.com/sigcn/pg.git
synced 2025-10-08 12:50:05 +08:00
netlink: fix RouteUpdate on win and linux
This commit is contained in:
@@ -3,6 +3,7 @@ package netlink
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"slices"
|
||||
|
||||
"github.com/vishvananda/netlink"
|
||||
)
|
||||
@@ -29,14 +30,13 @@ func RouteSubscribe(ctx context.Context, ch chan<- RouteUpdate) error {
|
||||
Dst: e.Dst,
|
||||
Via: e.Gw,
|
||||
}
|
||||
if e.Type == 24 {
|
||||
ru.Type = 1
|
||||
} else if e.Type == 25 {
|
||||
ru.Type = 2
|
||||
} else {
|
||||
if !slices.Contains([]uint16{24, 25}, e.Type) {
|
||||
slog.Debug("DropUnsupportRouteEvent")
|
||||
continue
|
||||
}
|
||||
if e.Type == 24 {
|
||||
ru.New = true
|
||||
}
|
||||
ch <- ru
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user