当请求本地回环地址时,不能指定出口IP地址
This commit is contained in:
parent
737b77981a
commit
7f2d5907b0
3
chain.go
3
chain.go
@ -372,6 +372,9 @@ func ResolverChainOption(resolver Resolver) ChainOption {
|
|||||||
// BindChainOption specifies tcp bind address used by Chain.Dial.
|
// BindChainOption specifies tcp bind address used by Chain.Dial.
|
||||||
func BindChainOption(bindAddr net.IP) ChainOption {
|
func BindChainOption(bindAddr net.IP) ChainOption {
|
||||||
return func(opts *ChainOptions) {
|
return func(opts *ChainOptions) {
|
||||||
|
if !bindAddr.IsLoopback(){
|
||||||
|
//只要非本地回环地址才能指定,否则会无法连接网络。当为空的时候,自动使用主网卡。
|
||||||
opts.BindAddr = bindAddr
|
opts.BindAddr = bindAddr
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user