mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-19 15:14:56 +08:00
Feature: add fwmark support
This commit is contained in:
@@ -11,20 +11,12 @@ func Dial(network, address string) (net.Conn, error) {
|
||||
|
||||
func DialContext(ctx context.Context, network, address string) (net.Conn, error) {
|
||||
d := &net.Dialer{}
|
||||
|
||||
if _boundInterface != nil {
|
||||
d.Control = bindToInterface
|
||||
}
|
||||
|
||||
setControl(d)
|
||||
return d.DialContext(ctx, network, address)
|
||||
}
|
||||
|
||||
func ListenPacket(network, address string) (net.PacketConn, error) {
|
||||
lc := &net.ListenConfig{}
|
||||
|
||||
if _boundInterface != nil {
|
||||
lc.Control = bindToInterface
|
||||
}
|
||||
|
||||
setControl(lc)
|
||||
return lc.ListenPacket(context.Background(), network, address)
|
||||
}
|
||||
|
Reference in New Issue
Block a user