diff --git a/component/dialer/sockopt_darwin.go b/component/dialer/sockopt_darwin.go index 7aea95a..659a963 100644 --- a/component/dialer/sockopt_darwin.go +++ b/component/dialer/sockopt_darwin.go @@ -23,7 +23,7 @@ func resolveInterfaceByName(name string) (*net.Interface, error) { } func setSocketOptions(network, address string, c syscall.RawConn, opts *Options) (err error) { - if !isTCPSocket(network) && !isUDPSocket(network) { + if opts == nil || !isTCPSocket(network) && !isUDPSocket(network) { return } diff --git a/component/dialer/sockopt_linux.go b/component/dialer/sockopt_linux.go index 0dd5217..f3eb849 100644 --- a/component/dialer/sockopt_linux.go +++ b/component/dialer/sockopt_linux.go @@ -8,7 +8,7 @@ import ( ) func setSocketOptions(network, address string, c syscall.RawConn, opts *Options) (err error) { - if !isTCPSocket(network) && !isUDPSocket(network) { + if opts == nil || !isTCPSocket(network) && !isUDPSocket(network) { return }