mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-09-29 13:51:51 +02:00
Lock while getting doh/doh3 transport
This commit is contained in:
1 parent
704bc27dba
commit
4c45e6cf3d
3 files changed
+4
-5
No files matched your search
@@ -380,6 +380,8 @@ func (uc *UpstreamConfig) isControlD() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (uc *UpstreamConfig) dohTransport(dnsType uint16) http.RoundTripper {
|
func (uc *UpstreamConfig) dohTransport(dnsType uint16) http.RoundTripper {
|
||||||
|
uc.mu.Lock()
|
||||||
|
defer uc.mu.Unlock()
|
||||||
switch uc.IPStack {
|
switch uc.IPStack {
|
||||||
case IpStackBoth, IpStackV4, IpStackV6:
|
case IpStackBoth, IpStackV4, IpStackV6:
|
||||||
return uc.transport
|
return uc.transport
|
||||||
|
|||||||
@@ -82,6 +82,8 @@ func (uc *UpstreamConfig) setupDOH3TransportWithoutPingUpstream() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (uc *UpstreamConfig) doh3Transport(dnsType uint16) http.RoundTripper {
|
func (uc *UpstreamConfig) doh3Transport(dnsType uint16) http.RoundTripper {
|
||||||
|
uc.mu.Lock()
|
||||||
|
defer uc.mu.Unlock()
|
||||||
switch uc.IPStack {
|
switch uc.IPStack {
|
||||||
case IpStackBoth, IpStackV4, IpStackV6:
|
case IpStackBoth, IpStackV4, IpStackV6:
|
||||||
return uc.http3RoundTripper
|
return uc.http3RoundTripper
|
||||||
|
|||||||
@@ -21,13 +21,9 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func newDohResolver(uc *UpstreamConfig) *dohResolver {
|
func newDohResolver(uc *UpstreamConfig) *dohResolver {
|
||||||
uc.mu.Lock()
|
|
||||||
transport := uc.transport
|
|
||||||
uc.mu.Unlock()
|
|
||||||
r := &dohResolver{
|
r := &dohResolver{
|
||||||
endpoint: uc.u,
|
endpoint: uc.u,
|
||||||
isDoH3: uc.Type == ResolverTypeDOH3,
|
isDoH3: uc.Type == ResolverTypeDOH3,
|
||||||
transport: transport,
|
|
||||||
http3RoundTripper: uc.http3RoundTripper,
|
http3RoundTripper: uc.http3RoundTripper,
|
||||||
sendClientInfo: uc.UpstreamSendClientInfo(),
|
sendClientInfo: uc.UpstreamSendClientInfo(),
|
||||||
uc: uc,
|
uc: uc,
|
||||||
@@ -39,7 +35,6 @@ type dohResolver struct {
|
|||||||
uc *UpstreamConfig
|
uc *UpstreamConfig
|
||||||
endpoint *url.URL
|
endpoint *url.URL
|
||||||
isDoH3 bool
|
isDoH3 bool
|
||||||
transport *http.Transport
|
|
||||||
http3RoundTripper http.RoundTripper
|
http3RoundTripper http.RoundTripper
|
||||||
sendClientInfo bool
|
sendClientInfo bool
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user