Fix crash on *bsd

This commit is contained in:
世界 2024-06-03 12:54:54 +08:00
parent 69dc87aa6d
commit 968b9bc217
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -1121,6 +1121,9 @@ func (r *Router) AutoDetectInterfaceFunc() control.Func {
if r.platformInterface != nil && r.platformInterface.UsePlatformAutoDetectInterfaceControl() { if r.platformInterface != nil && r.platformInterface.UsePlatformAutoDetectInterfaceControl() {
return r.platformInterface.AutoDetectInterfaceControl() return r.platformInterface.AutoDetectInterfaceControl()
} else { } else {
if r.interfaceMonitor == nil {
return nil
}
return control.BindToInterfaceFunc(r.InterfaceFinder(), func(network string, address string) (interfaceName string, interfaceIndex int, err error) { return control.BindToInterfaceFunc(r.InterfaceFinder(), func(network string, address string) (interfaceName string, interfaceIndex int, err error) {
remoteAddr := M.ParseSocksaddr(address).Addr remoteAddr := M.ParseSocksaddr(address).Addr
if C.IsLinux { if C.IsLinux {