dns.go 460 B

1234567891011121314151617181920212223
  1. package dns
  2. //go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg dns -path App,DNS
  3. import (
  4. "net"
  5. "v2ray.com/core/app"
  6. )
  7. // A Server is a DNS server for responding DNS queries.
  8. type Server interface {
  9. Get(domain string) []net.IP
  10. }
  11. // FromSpace fetches a DNS server from context.
  12. func FromSpace(space app.Space) Server {
  13. app := space.GetApplication((*Server)(nil))
  14. if app == nil {
  15. return nil
  16. }
  17. return app.(Server)
  18. }