Fix: nil options panic

This commit is contained in:
xjasonlyu
2022-03-29 13:22:50 +08:00
parent a4bedf6080
commit 201e79ac71
2 changed files with 2 additions and 2 deletions

View File

@@ -23,7 +23,7 @@ func resolveInterfaceByName(name string) (*net.Interface, error) {
} }
func setSocketOptions(network, address string, c syscall.RawConn, opts *Options) (err 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 return
} }

View File

@@ -8,7 +8,7 @@ import (
) )
func setSocketOptions(network, address string, c syscall.RawConn, opts *Options) (err 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 return
} }