internal/controld: connect to API using ipv4 only

Connecting to API using ipv6 sometimes hang at TLS handshake, using ipv4
only so we can fetch the config more reliably.

Fixed #53
This commit is contained in:
Cuong Manh Le
2023-02-10 00:06:32 +07:00
committed by Cuong Manh Le
parent 3218b5fac1
commit 45f827a2c5
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ func FetchResolverConfig(uid string) (*ResolverConfig, error) {
req.Header.Add("Content-Type", "application/json")
transport := http.DefaultTransport.(*http.Transport).Clone()
transport.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
return Dialer.DialContext(ctx, network, addr)
return Dialer.DialContext(ctx, "tcp4", addr)
}
client := http.Client{
Timeout: 10 * time.Second,