|
@@ -27,9 +27,9 @@ import (
|
|
|
"v2ray.com/core/transport/internet"
|
|
"v2ray.com/core/transport/internet"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
-// DoHNameServer implimented DNS over HTTPS (RFC8484) Wire Format,
|
|
|
|
|
-// which is compatiable with traditional dns over udp(RFC1035),
|
|
|
|
|
-// thus most of the DOH implimentation is copied from udpns.go
|
|
|
|
|
|
|
+// DoHNameServer implemented DNS over HTTPS (RFC8484) Wire Format,
|
|
|
|
|
+// which is compatible with traditional dns over udp(RFC1035),
|
|
|
|
|
+// thus most of the DOH implementation is copied from udpns.go
|
|
|
type DoHNameServer struct {
|
|
type DoHNameServer struct {
|
|
|
sync.RWMutex
|
|
sync.RWMutex
|
|
|
ips map[string]record
|
|
ips map[string]record
|
|
@@ -48,11 +48,11 @@ func NewDoHNameServer(url *url.URL, dispatcher routing.Dispatcher, clientIP net.
|
|
|
newError("DNS: created Remote DOH client for ", url.String()).AtInfo().WriteToLog()
|
|
newError("DNS: created Remote DOH client for ", url.String()).AtInfo().WriteToLog()
|
|
|
s := baseDOHNameServer(url, "DOH", clientIP)
|
|
s := baseDOHNameServer(url, "DOH", clientIP)
|
|
|
|
|
|
|
|
- // Dispatched connection will be closed (interupted) after each request
|
|
|
|
|
- // This makes DOH inefficient without a keeped-alive connection
|
|
|
|
|
|
|
+ // Dispatched connection will be closed (interrupted) after each request
|
|
|
|
|
+ // This makes DOH inefficient without a keep-alived connection
|
|
|
// See: core/app/proxyman/outbound/handler.go:113
|
|
// See: core/app/proxyman/outbound/handler.go:113
|
|
|
// Using mux (https request wrapped in a stream layer) improves the situation.
|
|
// Using mux (https request wrapped in a stream layer) improves the situation.
|
|
|
- // Recommand to use NewDoHLocalNameServer (DOHL:) if v2ray instance is running on
|
|
|
|
|
|
|
+ // Recommend to use NewDoHLocalNameServer (DOHL:) if v2ray instance is running on
|
|
|
// a normal network eg. the server side of v2ray
|
|
// a normal network eg. the server side of v2ray
|
|
|
tr := &http.Transport{
|
|
tr := &http.Transport{
|
|
|
MaxIdleConns: 30,
|
|
MaxIdleConns: 30,
|
|
@@ -191,7 +191,7 @@ func (s *DoHNameServer) updateIP(req *dnsRequest, ipRec *IPRecord) {
|
|
|
updated = true
|
|
updated = true
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- newError(s.name, " got answere: ", req.domain, " ", req.reqType, " -> ", ipRec.IP, " ", elapsed).AtInfo().WriteToLog()
|
|
|
|
|
|
|
+ newError(s.name, " got answer: ", req.domain, " ", req.reqType, " -> ", ipRec.IP, " ", elapsed).AtInfo().WriteToLog()
|
|
|
|
|
|
|
|
if updated {
|
|
if updated {
|
|
|
s.ips[req.domain] = rec
|
|
s.ips[req.domain] = rec
|