dns.go 371 B

123456789101112131415161718192021
  1. package dns
  2. import (
  3. "net"
  4. "v2ray.com/core/app"
  5. "v2ray.com/core/common/serial"
  6. )
  7. // A DnsCache is an internal cache of DNS resolutions.
  8. type Server interface {
  9. Get(domain string) []net.IP
  10. }
  11. func FromSpace(space app.Space) Server {
  12. app := space.(app.AppGetter).GetApp(serial.GetMessageType((*Config)(nil)))
  13. if app == nil {
  14. return nil
  15. }
  16. return app.(Server)
  17. }