Fix: routing-mark should effect on root

This commit is contained in:
Dreamacro
2022-02-17 14:23:47 +08:00
parent b1a639feae
commit a0221bf897
4 changed files with 17 additions and 10 deletions

View File

@ -38,6 +38,7 @@ func DialContext(ctx context.Context, network, address string, options ...Option
func ListenPacket(ctx context.Context, network, address string, options ...Option) (net.PacketConn, error) {
cfg := &option{
interfaceName: DefaultInterface.Load(),
routingMark: int(DefaultRoutingMark.Load()),
}
for _, o := range DefaultOptions {
@ -69,6 +70,7 @@ func ListenPacket(ctx context.Context, network, address string, options ...Optio
func dialContext(ctx context.Context, network string, destination net.IP, port string, options []Option) (net.Conn, error) {
opt := &option{
interfaceName: DefaultInterface.Load(),
routingMark: int(DefaultRoutingMark.Load()),
}
for _, o := range DefaultOptions {

View File

@ -3,8 +3,9 @@ package dialer
import "go.uber.org/atomic"
var (
DefaultOptions []Option
DefaultInterface = atomic.NewString("")
DefaultOptions []Option
DefaultInterface = atomic.NewString("")
DefaultRoutingMark = atomic.NewInt32(0)
)
type option struct {