mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-10 02:53:12 +00:00
20 lines
440 B
Go
20 lines
440 B
Go
|
package dialer
|
||
|
|
||
|
import (
|
||
|
"syscall"
|
||
|
|
||
|
"github.com/sagernet/sing/common/control"
|
||
|
M "github.com/sagernet/sing/common/metadata"
|
||
|
N "github.com/sagernet/sing/common/network"
|
||
|
)
|
||
|
|
||
|
func skipIfPrivate(next control.Func) control.Func {
|
||
|
return func(network, address string, conn syscall.RawConn) error {
|
||
|
destination := M.ParseSocksaddr(address)
|
||
|
if !N.IsPublicAddr(destination.Addr) {
|
||
|
return nil
|
||
|
}
|
||
|
return next(network, address, conn)
|
||
|
}
|
||
|
}
|