clash/dns/client.go

22 lines
389 B
Go
Raw Normal View History

2018-12-05 13:13:29 +00:00
package dns
import (
"context"
D "github.com/miekg/dns"
)
2019-06-28 04:29:08 +00:00
type client struct {
*D.Client
2018-12-05 13:13:29 +00:00
Address string
}
2019-06-28 04:29:08 +00:00
func (c *client) Exchange(m *D.Msg) (msg *D.Msg, err error) {
return c.ExchangeContext(context.Background(), m)
2018-12-05 13:13:29 +00:00
}
2019-06-28 04:29:08 +00:00
func (c *client) ExchangeContext(ctx context.Context, m *D.Msg) (msg *D.Msg, err error) {
msg, _, err = c.Client.ExchangeContext(ctx, m, c.Address)
return
2018-12-05 13:13:29 +00:00
}