Chore: use custom dialer
This commit is contained in:
@ -3,6 +3,8 @@ package dns
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/Dreamacro/clash/component/dialer"
|
||||
|
||||
D "github.com/miekg/dns"
|
||||
)
|
||||
|
||||
@ -16,6 +18,8 @@ func (c *client) Exchange(m *D.Msg) (msg *D.Msg, err error) {
|
||||
}
|
||||
|
||||
func (c *client) ExchangeContext(ctx context.Context, m *D.Msg) (msg *D.Msg, err error) {
|
||||
c.Client.Dialer = dialer.Dialer()
|
||||
|
||||
// Please note that miekg/dns ExchangeContext doesn't respond to context cancel.
|
||||
msg, _, err = c.Client.ExchangeContext(ctx, m, c.Address)
|
||||
return
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
"github.com/Dreamacro/clash/component/dialer"
|
||||
|
||||
D "github.com/miekg/dns"
|
||||
)
|
||||
|
||||
@ -17,6 +19,7 @@ const (
|
||||
|
||||
var dohTransport = &http.Transport{
|
||||
TLSClientConfig: &tls.Config{ClientSessionCache: globalSessionCache},
|
||||
DialContext: dialer.DialContext,
|
||||
}
|
||||
|
||||
type dohClient struct {
|
||||
|
Reference in New Issue
Block a user