mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-06-08 11:44:13 +08:00
test
This commit is contained in:
parent
99c6ef0ee3
commit
ad7275d777
4
go.mod
4
go.mod
@ -10,6 +10,7 @@ require (
|
|||||||
github.com/cretz/bine v0.2.0
|
github.com/cretz/bine v0.2.0
|
||||||
github.com/go-chi/chi/v5 v5.2.1
|
github.com/go-chi/chi/v5 v5.2.1
|
||||||
github.com/go-chi/render v1.0.3
|
github.com/go-chi/render v1.0.3
|
||||||
|
github.com/godbus/dbus/v5 v5.1.1-0.20230522191255-76236955d466
|
||||||
github.com/gofrs/uuid/v5 v5.3.2
|
github.com/gofrs/uuid/v5 v5.3.2
|
||||||
github.com/insomniacslk/dhcp v0.0.0-20250417080101-5f8cf70e8c5f
|
github.com/insomniacslk/dhcp v0.0.0-20250417080101-5f8cf70e8c5f
|
||||||
github.com/libdns/alidns v1.0.4-libdns.v1.beta1
|
github.com/libdns/alidns v1.0.4-libdns.v1.beta1
|
||||||
@ -27,7 +28,7 @@ require (
|
|||||||
github.com/sagernet/gomobile v0.1.6
|
github.com/sagernet/gomobile v0.1.6
|
||||||
github.com/sagernet/gvisor v0.0.0-20250325023245-7a9c0f5725fb
|
github.com/sagernet/gvisor v0.0.0-20250325023245-7a9c0f5725fb
|
||||||
github.com/sagernet/quic-go v0.51.0-beta.5
|
github.com/sagernet/quic-go v0.51.0-beta.5
|
||||||
github.com/sagernet/sing v0.6.10-0.20250520114755-0e0545dd92c4
|
github.com/sagernet/sing v0.6.10-0.20250521033217-30d675ea099b
|
||||||
github.com/sagernet/sing-mux v0.3.2
|
github.com/sagernet/sing-mux v0.3.2
|
||||||
github.com/sagernet/sing-quic v0.4.1-0.20250511050139-d459f561c9c3
|
github.com/sagernet/sing-quic v0.4.1-0.20250511050139-d459f561c9c3
|
||||||
github.com/sagernet/sing-shadowsocks v0.2.7
|
github.com/sagernet/sing-shadowsocks v0.2.7
|
||||||
@ -78,7 +79,6 @@ require (
|
|||||||
github.com/go-ole/go-ole v1.3.0 // indirect
|
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||||
github.com/gobwas/httphead v0.1.0 // indirect
|
github.com/gobwas/httphead v0.1.0 // indirect
|
||||||
github.com/gobwas/pool v0.2.1 // indirect
|
github.com/gobwas/pool v0.2.1 // indirect
|
||||||
github.com/godbus/dbus/v5 v5.1.1-0.20230522191255-76236955d466 // indirect
|
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||||
github.com/google/btree v1.1.3 // indirect
|
github.com/google/btree v1.1.3 // indirect
|
||||||
github.com/google/go-cmp v0.6.0 // indirect
|
github.com/google/go-cmp v0.6.0 // indirect
|
||||||
|
4
go.sum
4
go.sum
@ -168,8 +168,8 @@ github.com/sagernet/nftables v0.3.0-beta.4/go.mod h1:OQXAjvjNGGFxaTgVCSTRIhYB5/l
|
|||||||
github.com/sagernet/quic-go v0.51.0-beta.5 h1:/mME3sJvQ8k/JKP0oC/9XoWrm0znO7hWXviB5yiipJY=
|
github.com/sagernet/quic-go v0.51.0-beta.5 h1:/mME3sJvQ8k/JKP0oC/9XoWrm0znO7hWXviB5yiipJY=
|
||||||
github.com/sagernet/quic-go v0.51.0-beta.5/go.mod h1:OV+V5kEBb8kJS7k29MzDu6oj9GyMc7HA07sE1tedxz4=
|
github.com/sagernet/quic-go v0.51.0-beta.5/go.mod h1:OV+V5kEBb8kJS7k29MzDu6oj9GyMc7HA07sE1tedxz4=
|
||||||
github.com/sagernet/sing v0.6.9/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
|
github.com/sagernet/sing v0.6.9/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
|
||||||
github.com/sagernet/sing v0.6.10-0.20250520114755-0e0545dd92c4 h1:mP53fzZ9GIFaT1pZ2brV1BhbaDwN8kG8ZR0OYr11EBc=
|
github.com/sagernet/sing v0.6.10-0.20250521033217-30d675ea099b h1:E9zgBma90grCIC1Rber6UgGw3CzbpeizJdavNu1Fy8M=
|
||||||
github.com/sagernet/sing v0.6.10-0.20250520114755-0e0545dd92c4/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
|
github.com/sagernet/sing v0.6.10-0.20250521033217-30d675ea099b/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
|
||||||
github.com/sagernet/sing-mux v0.3.2 h1:meZVFiiStvHThb/trcpAkCrmtJOuItG5Dzl1RRP5/NE=
|
github.com/sagernet/sing-mux v0.3.2 h1:meZVFiiStvHThb/trcpAkCrmtJOuItG5Dzl1RRP5/NE=
|
||||||
github.com/sagernet/sing-mux v0.3.2/go.mod h1:pht8iFY4c9Xltj7rhVd208npkNaeCxzyXCgulDPLUDA=
|
github.com/sagernet/sing-mux v0.3.2/go.mod h1:pht8iFY4c9Xltj7rhVd208npkNaeCxzyXCgulDPLUDA=
|
||||||
github.com/sagernet/sing-quic v0.4.1-0.20250511050139-d459f561c9c3 h1:1J+s1yyZ8+YAYaClI+az8YuFgV9NGXUUCZnriKmos6w=
|
github.com/sagernet/sing-quic v0.4.1-0.20250511050139-d459f561c9c3 h1:1J+s1yyZ8+YAYaClI+az8YuFgV9NGXUUCZnriKmos6w=
|
||||||
|
@ -3,6 +3,7 @@ package route
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
"os"
|
"os"
|
||||||
@ -313,10 +314,14 @@ func (r *NetworkManager) AutoDetectInterfaceFunc() control.Func {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
bindFunc := control.BindToInterfaceFunc(r.interfaceFinder, func(network string, address string) (interfaceName string, interfaceIndex int, err error) {
|
bindFunc := control.BindToInterfaceFunc(r.interfaceFinder, func(network string, address string) (interfaceName string, interfaceIndex int, err error) {
|
||||||
|
for _, iif := range r.interfaceFinder.Interfaces() {
|
||||||
|
r.logger.Warn("iif ", iif.Name, ": ", fmt.Sprint(iif.Addresses))
|
||||||
|
}
|
||||||
remoteAddr := M.ParseSocksaddr(address).Addr
|
remoteAddr := M.ParseSocksaddr(address).Addr
|
||||||
if remoteAddr.IsValid() {
|
if remoteAddr.IsValid() {
|
||||||
iif, err := r.interfaceFinder.ByAddr(remoteAddr)
|
iif, err := r.interfaceFinder.ByAddr(remoteAddr)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
r.logger.Warn("bind to interface ", iif.Name, " (", iif.Index, "): ", remoteAddr)
|
||||||
return iif.Name, iif.Index, nil
|
return iif.Name, iif.Index, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -324,6 +329,7 @@ func (r *NetworkManager) AutoDetectInterfaceFunc() control.Func {
|
|||||||
if defaultInterface == nil {
|
if defaultInterface == nil {
|
||||||
return "", -1, tun.ErrNoRoute
|
return "", -1, tun.ErrNoRoute
|
||||||
}
|
}
|
||||||
|
r.logger.Warn("bind to default interface ", defaultInterface.Name, " (", defaultInterface.Index, "): ", remoteAddr)
|
||||||
return defaultInterface.Name, defaultInterface.Index, nil
|
return defaultInterface.Name, defaultInterface.Index, nil
|
||||||
})
|
})
|
||||||
return func(network, address string, conn syscall.RawConn) error {
|
return func(network, address string, conn syscall.RawConn) error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user