rename custom client

This commit is contained in:
xvzc 2024-08-18 15:58:11 +09:00
parent 26d69b54db
commit 67bee5a49a

View File

@ -13,17 +13,17 @@ type DNSResult struct {
err error err error
} }
type CustomClient struct { type GeneralClient struct {
server string server string
} }
func NewGeneralClient(server string) *CustomClient { func NewGeneralClient(server string) *GeneralClient {
return &CustomClient{ return &GeneralClient{
server: server, server: server,
} }
} }
func (c *CustomClient) Resolve(ctx context.Context, host string, qTypes []uint16) ([]net.IPAddr, error) { func (c *GeneralClient) Resolve(ctx context.Context, host string, qTypes []uint16) ([]net.IPAddr, error) {
sendMsg := func(ctx context.Context, msg *dns.Msg) (*dns.Msg, error) { sendMsg := func(ctx context.Context, msg *dns.Msg) (*dns.Msg, error) {
clt := &dns.Client{} clt := &dns.Client{}
resp, _, err := clt.Exchange(msg, c.server) resp, _, err := clt.Exchange(msg, c.server)
@ -35,6 +35,6 @@ func (c *CustomClient) Resolve(ctx context.Context, host string, qTypes []uint16
return addrs, err return addrs, err
} }
func (c *CustomClient) String() string { func (c *GeneralClient) String() string {
return fmt.Sprintf("custom client(%s)", c.server) return fmt.Sprintf("custom client(%s)", c.server)
} }