Use the relay for cert retrieval over TCP, tooo

But don't use a relay if a proxy has been specified already
This commit is contained in:
Frank Denis 2019-10-20 21:45:19 +02:00
parent fc9509a8c8
commit 74c1f4a00d
2 changed files with 7 additions and 2 deletions

View File

@ -248,11 +248,16 @@ func _dnsExchange(proxy *Proxy, proto string, query *dns.Msg, serverAddress stri
if err != nil { if err != nil {
return nil, 0, err return nil, 0, err
} }
upstreamAddr := tcpAddr
if relayUDPAddr != nil {
proxy.prepareForRelay(tcpAddr.IP, tcpAddr.Port, &binQuery)
upstreamAddr = relayTCPAddr
}
now := time.Now() now := time.Now()
var pc net.Conn var pc net.Conn
proxyDialer := proxy.xTransport.proxyDialer proxyDialer := proxy.xTransport.proxyDialer
if proxyDialer == nil { if proxyDialer == nil {
pc, err = net.DialTCP("tcp", nil, tcpAddr) pc, err = net.DialTCP("tcp", nil, upstreamAddr)
} else { } else {
pc, err = (*proxyDialer).Dial("tcp", tcpAddr.String()) pc, err = (*proxyDialer).Dial("tcp", tcpAddr.String())
} }

View File

@ -325,7 +325,7 @@ func (proxy *Proxy) exchangeWithTCPServer(serverInfo *ServerInfo, sharedKey *[32
if proxyDialer == nil { if proxyDialer == nil {
pc, err = net.DialTCP("tcp", nil, upstreamAddr) pc, err = net.DialTCP("tcp", nil, upstreamAddr)
} else { } else {
pc, err = (*proxyDialer).Dial("tcp", upstreamAddr.String()) pc, err = (*proxyDialer).Dial("tcp", serverInfo.TCPAddr.String())
} }
if err != nil { if err != nil {
return nil, err return nil, err