diff --git a/config.go b/config.go index f3e28fc..454ffec 100644 --- a/config.go +++ b/config.go @@ -380,6 +380,8 @@ func (uc *UpstreamConfig) isControlD() bool { } func (uc *UpstreamConfig) dohTransport(dnsType uint16) http.RoundTripper { + uc.mu.Lock() + defer uc.mu.Unlock() switch uc.IPStack { case IpStackBoth, IpStackV4, IpStackV6: return uc.transport diff --git a/config_quic.go b/config_quic.go index 8c0fb97..ad695a8 100644 --- a/config_quic.go +++ b/config_quic.go @@ -82,6 +82,8 @@ func (uc *UpstreamConfig) setupDOH3TransportWithoutPingUpstream() { } func (uc *UpstreamConfig) doh3Transport(dnsType uint16) http.RoundTripper { + uc.mu.Lock() + defer uc.mu.Unlock() switch uc.IPStack { case IpStackBoth, IpStackV4, IpStackV6: return uc.http3RoundTripper diff --git a/doh.go b/doh.go index e831feb..155361e 100644 --- a/doh.go +++ b/doh.go @@ -21,13 +21,9 @@ const ( ) func newDohResolver(uc *UpstreamConfig) *dohResolver { - uc.mu.Lock() - transport := uc.transport - uc.mu.Unlock() r := &dohResolver{ endpoint: uc.u, isDoH3: uc.Type == ResolverTypeDOH3, - transport: transport, http3RoundTripper: uc.http3RoundTripper, sendClientInfo: uc.UpstreamSendClientInfo(), uc: uc, @@ -39,7 +35,6 @@ type dohResolver struct { uc *UpstreamConfig endpoint *url.URL isDoH3 bool - transport *http.Transport http3RoundTripper http.RoundTripper sendClientInfo bool }