Browse Source

Fix domain resolver on direct outbound

世界 7 months ago
parent
commit
4975c3acac
2 changed files with 3 additions and 1 deletions
  1. 2 0
      common/dialer/default.go
  2. 1 1
      protocol/direct/outbound.go

+ 2 - 0
common/dialer/default.go

@@ -210,6 +210,8 @@ func NewDefault(ctx context.Context, options option.DialerOptions) (*DefaultDial
 func (d *DefaultDialer) DialContext(ctx context.Context, network string, address M.Socksaddr) (net.Conn, error) {
 	if !address.IsValid() {
 		return nil, E.New("invalid address")
+	} else if address.IsFqdn() {
+		return nil, E.New("domain not resolved")
 	}
 	if d.networkStrategy == nil {
 		switch N.NetworkName(network) {

+ 1 - 1
protocol/direct/outbound.go

@@ -45,7 +45,7 @@ func NewOutbound(ctx context.Context, router adapter.Router, logger log.ContextL
 	if options.Detour != "" {
 		return nil, E.New("`detour` is not supported in direct context")
 	}
-	outboundDialer, err := dialer.New(ctx, options.DialerOptions, false)
+	outboundDialer, err := dialer.New(ctx, options.DialerOptions, true)
 	if err != nil {
 		return nil, err
 	}