add resolver for cmd
This commit is contained in:
@ -71,6 +71,8 @@ type exchanger struct {
|
||||
}
|
||||
|
||||
// NewExchanger create an Exchanger.
|
||||
// The addr should be URL-like format,
|
||||
// e.g. udp://1.1.1.1:53, tls://1.1.1.1:853, https://1.0.0.1/dns-query
|
||||
func NewExchanger(addr string, opts ...Option) (Exchanger, error) {
|
||||
var options Options
|
||||
for _, opt := range opts {
|
||||
@ -85,6 +87,10 @@ func NewExchanger(addr string, opts ...Option) (Exchanger, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if options.timeout <= 0 {
|
||||
options.timeout = 5 * time.Second
|
||||
}
|
||||
|
||||
ex := &exchanger{
|
||||
network: u.Scheme,
|
||||
addr: u.Host,
|
||||
|
Reference in New Issue
Block a user