File tree Expand file tree Collapse file tree 3 files changed +11
-4
lines changed
Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,14 @@ func getCache() (*ifaceCache, error) {
8484 continue // interface down
8585 }
8686 for _ , prefix := range ipNets {
87- cache .ifTable .Insert (prefix , ifaceObj )
87+ if _ , ok := cache .ifTable .Get (prefix ); ok {
88+ // maybe two interfaces have the same prefix but different address,
89+ // so we add a special /32(ipv4) or /128(ipv6) item to let ResolveInterfaceByAddr
90+ // could find the correct interface
91+ cache .ifTable .Insert (netip .PrefixFrom (prefix .Addr (), prefix .Addr ().BitLen ()), ifaceObj )
92+ } else {
93+ cache .ifTable .Insert (prefix , ifaceObj )
94+ }
8895 }
8996 }
9097
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ require (
2525 github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759
2626 github.com/metacubex/quic-go v0.52.1-0.20250522021943-aef454b9e639
2727 github.com/metacubex/randv2 v0.2.0
28- github.com/metacubex/sing v0.5.3-0.20250504031621-1f99e54c15b7
28+ github.com/metacubex/sing v0.5.3
2929 github.com/metacubex/sing-mux v0.3.2
3030 github.com/metacubex/sing-quic v0.0.0-20250523120938-f1a248e5ec7f
3131 github.com/metacubex/sing-shadowsocks v0.2.9
Original file line number Diff line number Diff line change @@ -116,8 +116,8 @@ github.com/metacubex/quic-go v0.52.1-0.20250522021943-aef454b9e639/go.mod h1:Kc6
116116github.com/metacubex/randv2 v0.2.0 h1:uP38uBvV2SxYfLj53kuvAjbND4RUDfFJjwr4UigMiLs =
117117github.com/metacubex/randv2 v0.2.0 /go.mod h1:kFi2SzrQ5WuneuoLLCMkABtiBu6VRrMrWFqSPyj2cxY =
118118github.com/metacubex/sing v0.5.2 /go.mod h1:ypf0mjwlZm0sKdQSY+yQvmsbWa0hNPtkeqyRMGgoN+w =
119- github.com/metacubex/sing v0.5.3-0.20250504031621-1f99e54c15b7 h1:m4nSxvw46JEgxMzzmnXams+ebwabcry4Ydep/zNiesQ =
120- github.com/metacubex/sing v0.5.3-0.20250504031621-1f99e54c15b7 /go.mod h1:ypf0mjwlZm0sKdQSY+yQvmsbWa0hNPtkeqyRMGgoN+w =
119+ github.com/metacubex/sing v0.5.3 h1:QWdN16WFKMk06x4nzkc8SvZ7y2x+TLQrpkPoHs+WSVM =
120+ github.com/metacubex/sing v0.5.3 /go.mod h1:ypf0mjwlZm0sKdQSY+yQvmsbWa0hNPtkeqyRMGgoN+w =
121121github.com/metacubex/sing-mux v0.3.2 h1:nJv52pyRivHcaZJKk2JgxpaVvj1GAXG81scSa9N7ncw =
122122github.com/metacubex/sing-mux v0.3.2 /go.mod h1:3rt1soewn0O6j89GCLmwAQFsq257u0jf2zQSPhTL3Bw =
123123github.com/metacubex/sing-quic v0.0.0-20250523120938-f1a248e5ec7f h1:mP3vIm+9hRFI0C0Vl3pE0NESF/L85FDbuB0tGgUii6I =
You can’t perform that action at this time.
0 commit comments