fix: cleanup import

This commit is contained in:
wwqgtxx 2022-11-12 12:31:44 +08:00
parent c0bd4af120
commit 3321ac95ca

View file

@ -21,7 +21,6 @@ import (
"github.com/Dreamacro/clash/log" "github.com/Dreamacro/clash/log"
"github.com/lucas-clemente/quic-go" "github.com/lucas-clemente/quic-go"
"github.com/lucas-clemente/quic-go/http3" "github.com/lucas-clemente/quic-go/http3"
"github.com/miekg/dns"
D "github.com/miekg/dns" D "github.com/miekg/dns"
"golang.org/x/net/http2" "golang.org/x/net/http2"
) )
@ -151,7 +150,7 @@ func (p *dnsOverHTTPS) ExchangeContext(ctx context.Context, m *D.Msg) (msg *D.Ms
} }
// Exchange implements the Upstream interface for *dnsOverHTTPS. // Exchange implements the Upstream interface for *dnsOverHTTPS.
func (p *dnsOverHTTPS) Exchange(m *dns.Msg) (*dns.Msg, error) { func (p *dnsOverHTTPS) Exchange(m *D.Msg) (*D.Msg, error) {
return p.ExchangeContext(context.Background(), m) return p.ExchangeContext(context.Background(), m)
} }
@ -181,7 +180,7 @@ func (p *dnsOverHTTPS) closeClient(client *http.Client) (err error) {
} }
// exchangeHTTPS logs the request and its result and calls exchangeHTTPSClient. // exchangeHTTPS logs the request and its result and calls exchangeHTTPSClient.
func (p *dnsOverHTTPS) exchangeHTTPS(ctx context.Context, client *http.Client, req *dns.Msg) (resp *dns.Msg, err error) { func (p *dnsOverHTTPS) exchangeHTTPS(ctx context.Context, client *http.Client, req *D.Msg) (resp *D.Msg, err error) {
resp, err = p.exchangeHTTPSClient(ctx, client, req) resp, err = p.exchangeHTTPSClient(ctx, client, req)
return resp, err return resp, err
@ -192,8 +191,8 @@ func (p *dnsOverHTTPS) exchangeHTTPS(ctx context.Context, client *http.Client, r
func (p *dnsOverHTTPS) exchangeHTTPSClient( func (p *dnsOverHTTPS) exchangeHTTPSClient(
ctx context.Context, ctx context.Context,
client *http.Client, client *http.Client,
req *dns.Msg, req *D.Msg,
) (resp *dns.Msg, err error) { ) (resp *D.Msg, err error) {
buf, err := req.Pack() buf, err := req.Pack()
if err != nil { if err != nil {
return nil, fmt.Errorf("packing message: %w", err) return nil, fmt.Errorf("packing message: %w", err)
@ -237,7 +236,7 @@ func (p *dnsOverHTTPS) exchangeHTTPSClient(
) )
} }
resp = &dns.Msg{} resp = &D.Msg{}
err = resp.Unpack(body) err = resp.Unpack(body)
if err != nil { if err != nil {
return nil, fmt.Errorf( return nil, fmt.Errorf(
@ -249,7 +248,7 @@ func (p *dnsOverHTTPS) exchangeHTTPSClient(
} }
if resp.Id != req.Id { if resp.Id != req.Id {
err = dns.ErrId err = D.ErrId
} }
return resp, err return resp, err