Fix: nullcheck on alternative systemDialer (#752)

* fix: null-check on alternative systemDialer
* delete deprecated option DualStack

Co-authored-by: rurirei <72071920+rurirei@users.noreply.github.com>
This commit is contained in:
yuhan6665 2021-10-12 11:32:45 -04:00 committed by GitHub
parent e50f2af418
commit ef4c63812b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,7 +74,6 @@ func (d *DefaultSystemDialer) Dial(ctx context.Context, src net.Address, dest ne
dialer := &net.Dialer{ dialer := &net.Dialer{
Timeout: time.Second * 16, Timeout: time.Second * 16,
DualStack: true,
LocalAddr: resolveSrcAddr(dest.Network, src), LocalAddr: resolveSrcAddr(dest.Network, src),
} }
@ -174,7 +173,7 @@ func (v *SimpleSystemDialer) Dial(ctx context.Context, src net.Address, dest net
// xray:api:stable // xray:api:stable
func UseAlternativeSystemDialer(dialer SystemDialer) { func UseAlternativeSystemDialer(dialer SystemDialer) {
if dialer == nil { if dialer == nil {
effectiveSystemDialer = &DefaultSystemDialer{} dialer = &DefaultSystemDialer{}
} }
effectiveSystemDialer = dialer effectiveSystemDialer = dialer
} }