This commit is contained in:
世界
2024-11-23 22:34:02 +08:00
parent 68781387fe
commit 0c66888691
32 changed files with 263 additions and 267 deletions

View File

@@ -202,7 +202,7 @@ func (r *NetworkManager) Close() error {
})
monitor.Finish()
}
return nil
return err
}
func (r *NetworkManager) InterfaceFinder() control.InterfaceFinder {

View File

@@ -53,6 +53,7 @@ func (r *Router) routeConnection(ctx context.Context, conn net.Conn, metadata ad
return E.New("reject connection to ", metadata.Destination, " while device paused")
}
//nolint:staticcheck
if metadata.InboundDetour != "" {
if metadata.LastInbound == metadata.InboundDetour {
return E.New("routing loop on detour: ", metadata.InboundDetour)
@@ -182,6 +183,7 @@ func (r *Router) routePacketConnection(ctx context.Context, conn N.PacketConn, m
if r.pauseManager.IsDevicePaused() {
return E.New("reject packet connection to ", metadata.Destination, " while device paused")
}
//nolint:staticcheck
if metadata.InboundDetour != "" {
if metadata.LastInbound == metadata.InboundDetour {
return E.New("routing loop on detour: ", metadata.InboundDetour)
@@ -281,7 +283,7 @@ func (r *Router) PreMatch(metadata adapter.InboundContext) error {
if !isReject {
return nil
}
return rejectAction.Error(nil)
return rejectAction.Error(context.Background())
}
func (r *Router) matchRule(