client.go 861 B

12345678910111213141516171819202122232425262728293031323334353637
  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. //
  8. // v2ray:api:stable
  9. type Client interface {
  10. features.Feature
  11. // LookupIP returns IP address for the given domain. IPs may contain IPv4 and/or IPv6 addresses.
  12. LookupIP(domain string) ([]net.IP, error)
  13. }
  14. // IPv4Lookup is an optional feature for querying IPv4 addresses only.
  15. //
  16. // v2ray:api:beta
  17. type IPv4Lookup interface {
  18. LookupIPv4(domain string) ([]net.IP, error)
  19. }
  20. // IPv6Lookup is an optional feature for querying IPv6 addresses only.
  21. //
  22. // v2ray:api:beta
  23. type IPv6Lookup interface {
  24. LookupIPv6(domain string) ([]net.IP, error)
  25. }
  26. // ClientType returns the type of Client interface. Can be used for implementing common.HasType.
  27. //
  28. // v2ray:api:beta
  29. func ClientType() interface{} {
  30. return (*Client)(nil)
  31. }