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{ return &Dns{
host: *config.DnsAddr, host: *config.DnsAddr,
port: port, port: port,
systemClient: client.NewSystemClient(), systemClient: client.NewSystemResolver(),
generalClient: client.NewGeneralClient(net.JoinHostPort(addr, port)), generalClient: client.NewGeneralResolver(net.JoinHostPort(addr, port)),
dohClient: client.NewDOHClient(addr), dohClient: client.NewDOHResolver(addr),
} }
} }

View File

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

View File

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

View File

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