mirror of https://github.com/status-im/go-waku.git
21 lines
403 B
Go
21 lines
403 B
Go
package discovery
|
|
|
|
import (
|
|
"context"
|
|
"net"
|
|
)
|
|
|
|
func GetResolver(ctx context.Context, nameserver string) *net.Resolver {
|
|
if nameserver == "" {
|
|
return net.DefaultResolver
|
|
}
|
|
|
|
return &net.Resolver{
|
|
PreferGo: true,
|
|
Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
|
|
d := net.Dialer{}
|
|
return d.DialContext(ctx, network, net.JoinHostPort(nameserver, "53"))
|
|
},
|
|
}
|
|
}
|