1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-02 09:17:55 -04:00
v2fly/app/dns/dns.go

24 lines
455 B
Go
Raw Normal View History

2015-12-06 05:00:10 -05:00
package dns
2017-04-08 19:43:25 -04:00
//go:generate go run $GOPATH/src/v2ray.com/core/tools/generrorgen/main.go -pkg dns -path App,DNS
2015-12-06 05:00:10 -05:00
import (
"net"
2015-12-10 17:55:39 -05:00
2016-08-20 14:55:45 -04:00
"v2ray.com/core/app"
2016-01-31 11:01:28 -05:00
)
2015-12-06 05:00:10 -05:00
2017-01-13 08:33:32 -05:00
// A Server is a DNS server for responding DNS queries.
2016-05-16 02:09:28 -04:00
type Server interface {
Get(domain string) []net.IP
2015-12-06 05:00:10 -05:00
}
2017-01-06 09:32:36 -05:00
2017-04-09 08:49:40 -04:00
// FromSpace fetches a DNS server from context.
2017-01-06 09:32:36 -05:00
func FromSpace(space app.Space) Server {
2017-01-13 07:41:40 -05:00
app := space.GetApplication((*Server)(nil))
2017-01-06 09:32:36 -05:00
if app == nil {
return nil
}
return app.(Server)
}