add resolver

This commit is contained in:
ginuerzh
2021-12-30 19:12:42 +08:00
parent 9b3d7e1110
commit a6671a468e
8 changed files with 343 additions and 50 deletions

View File

@ -107,7 +107,7 @@ func NewExchanger(addr string, opts ...Option) (Exchanger, error) {
}
}
ex.network = "tcp"
case "doh":
case "https":
ex.addr = addr
if ex.options.tlsConfig == nil {
ex.options.tlsConfig = &tls.Config{
@ -134,7 +134,7 @@ func NewExchanger(addr string, opts ...Option) (Exchanger, error) {
}
func (ex *exchanger) Exchange(ctx context.Context, msg []byte) ([]byte, error) {
if ex.network == "doh" {
if ex.network == "https" {
return ex.dohExchange(ctx, msg)
}
return ex.exchange(ctx, msg)