client.go 659 B

123456789101112131415161718192021222324252627282930
  1. package dns
  2. import (
  3. "v2ray.com/core/common/net"
  4. "v2ray.com/core/features"
  5. )
  6. // Client is a V2Ray feature for querying DNS information.
  7. type Client interface {
  8. features.Feature
  9. LookupIP(host string) ([]net.IP, error)
  10. }
  11. // ClientType returns the type of Client interface. Can be used for implementing common.HasType.
  12. func ClientType() interface{} {
  13. return (*Client)(nil)
  14. }
  15. type LocalClient struct{}
  16. func (LocalClient) Type() interface{} {
  17. return ClientType()
  18. }
  19. func (LocalClient) Start() error { return nil }
  20. func (LocalClient) Close() error { return nil }
  21. func (LocalClient) LookupIP(host string) ([]net.IP, error) {
  22. return net.LookupIP(host)
  23. }