2015-12-06 11:00:10 +01:00
|
|
|
package dns
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
2015-12-10 23:55:39 +01:00
|
|
|
|
2016-08-20 20:55:45 +02:00
|
|
|
"v2ray.com/core/app"
|
2017-01-06 15:32:36 +01:00
|
|
|
"v2ray.com/core/common/serial"
|
2016-01-31 17:01:28 +01:00
|
|
|
)
|
2015-12-06 11:00:10 +01:00
|
|
|
|
2016-01-31 17:01:28 +01:00
|
|
|
// A DnsCache is an internal cache of DNS resolutions.
|
2016-05-15 23:09:28 -07:00
|
|
|
type Server interface {
|
|
|
|
Get(domain string) []net.IP
|
2015-12-06 11:00:10 +01:00
|
|
|
}
|
2017-01-06 15:32:36 +01:00
|
|
|
|
|
|
|
func FromSpace(space app.Space) Server {
|
|
|
|
app := space.(app.AppGetter).GetApp(serial.GetMessageType((*Config)(nil)))
|
|
|
|
if app == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return app.(Server)
|
|
|
|
}
|