Skip to content

Commit bbc5e61

Browse files
reinismuldez
andauthored
Experimental option to force DNS queries to use TCP (#1843)
Co-authored-by: Fernandez Ludovic <[email protected]>
1 parent d4200c6 commit bbc5e61

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

challenge/dns01/nameserver.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"errors"
55
"fmt"
66
"net"
7+
"os"
8+
"strconv"
79
"strings"
810
"sync"
911
"time"
@@ -250,6 +252,13 @@ func createDNSMsg(fqdn string, rtype uint16, recursive bool) *dns.Msg {
250252
}
251253

252254
func sendDNSQuery(m *dns.Msg, ns string) (*dns.Msg, error) {
255+
if ok, _ := strconv.ParseBool(os.Getenv("LEGO_EXPERIMENTAL_DNS_TCP_ONLY")); ok {
256+
tcp := &dns.Client{Net: "tcp", Timeout: dnsTimeout}
257+
in, _, err := tcp.Exchange(m, ns)
258+
259+
return in, err
260+
}
261+
253262
udp := &dns.Client{Net: "udp", Timeout: dnsTimeout}
254263
in, _, err := udp.Exchange(m, ns)
255264

0 commit comments

Comments
 (0)