1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-07-01 03:25:23 +00:00
v2fly/app/dns/nameserver.go

33 lines
563 B
Go
Raw Normal View History

2017-12-19 22:55:09 +00:00
package dns
2016-05-16 06:09:28 +00:00
import (
"context"
2016-05-16 06:09:28 +00:00
"time"
"v2ray.com/core/common/net"
2016-05-16 06:09:28 +00:00
)
2016-06-01 20:09:24 +00:00
var (
2017-11-19 20:43:20 +00:00
multiQuestionDNS = map[net.Address]bool{
net.IPAddress([]byte{8, 8, 8, 8}): true,
net.IPAddress([]byte{8, 8, 4, 4}): true,
net.IPAddress([]byte{9, 9, 9, 9}): true,
}
2016-06-01 20:09:24 +00:00
)
2016-05-16 06:09:28 +00:00
type ARecord struct {
IPs []net.IP
Expire time.Time
}
type NameServer interface {
2018-06-26 13:04:47 +00:00
QueryIP(ctx context.Context, domain string) ([]net.IP, error)
2016-05-16 06:09:28 +00:00
}
2016-05-16 16:05:01 +00:00
type LocalNameServer struct {
}
2018-06-26 13:04:47 +00:00
func (*LocalNameServer) QueryIP(ctx context.Context, domain string) ([]net.IP, error) {
return net.LookupIP(domain)
2016-05-16 16:05:01 +00:00
}