chore: rename dns constructors for dns resolver

This commit is contained in:
xvzc 2024-08-19 10:45:01 +09:00
parent 442ae6840b
commit f862e3efc7
4 changed files with 6 additions and 6 deletions

View File

@ -28,9 +28,9 @@ func NewResolver(config *util.Config) *Dns {
return &Dns{
host: *config.DnsAddr,
port: port,
systemClient: client.NewSystemClient(),
generalClient: client.NewGeneralClient(net.JoinHostPort(addr, port)),
dohClient: client.NewDOHClient(addr),
systemClient: client.NewSystemResolver(),
generalClient: client.NewGeneralResolver(net.JoinHostPort(addr, port)),
dohClient: client.NewDOHResolver(addr),
}
}

View File

@ -19,7 +19,7 @@ type DOHResolver struct {
client *http.Client
}
func NewDOHClient(host string) *DOHResolver {
func NewDOHResolver(host string) *DOHResolver {
c := &http.Client{
Timeout: 5 * time.Second,
Transport: &http.Transport{

View File

@ -18,7 +18,7 @@ type GeneralResolver struct {
server string
}
func NewGeneralClient(server string) *GeneralResolver {
func NewGeneralResolver(server string) *GeneralResolver {
return &GeneralResolver{
client: &dns.Client{},
server: server,

View File

@ -9,7 +9,7 @@ type SystemResolver struct {
*net.Resolver
}
func NewSystemClient() *SystemResolver {
func NewSystemResolver() *SystemResolver {
return &SystemResolver{
&net.Resolver{PreferGo: true},
}