v2ray-core/app/dns/config.go

21 lines
432 B
Go
Raw Normal View History

2016-05-16 07:25:34 +00:00
package dns
2015-12-06 10:00:10 +00:00
2016-01-15 14:23:12 +00:00
import (
2016-05-22 20:30:08 +00:00
"net"
2017-02-01 20:35:40 +00:00
"v2ray.com/core/app/log"
2016-01-15 14:23:12 +00:00
)
2017-04-23 17:16:56 +00:00
func (c *Config) GetInternalHosts() map[string]net.IP {
2016-09-20 14:05:35 +00:00
hosts := make(map[string]net.IP)
2017-04-23 17:16:56 +00:00
for domain, ipOrDomain := range c.GetHosts() {
2016-10-12 16:43:55 +00:00
address := ipOrDomain.AsAddress()
2016-09-20 14:05:35 +00:00
if address.Family().IsDomain() {
2017-04-08 23:43:25 +00:00
log.Trace(newError("ignoring domain address in static hosts: ", address.Domain()).AtWarning())
2016-09-20 14:05:35 +00:00
continue
}
hosts[domain] = address.IP()
}
return hosts
2015-12-06 10:00:10 +00:00
}