mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-09 21:58:41 +00:00
Merge branch 'dns' into dns-geo
This commit is contained in:
commit
8a7cd65fc2
35 changed files with 458 additions and 180 deletions
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
func TestLocalNameServer(t *testing.T) {
|
||||
s := NewLocalNameServer()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*2)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
|
||||
ips, err := s.QueryIP(ctx, "google.com", net.IP{}, dns.IPOption{
|
||||
IPv4Enable: true,
|
||||
IPv6Enable: true,
|
||||
|
|
|
@ -27,8 +27,6 @@ import (
|
|||
// by selecting the ALPN token "dq" in the crypto handshake.
|
||||
const NextProtoDQ = "doq-i00"
|
||||
|
||||
const handshakeTimeout = time.Second * 8
|
||||
|
||||
// QUICNameServer implemented DNS over QUIC
|
||||
type QUICNameServer struct {
|
||||
sync.RWMutex
|
||||
|
@ -373,9 +371,7 @@ func (s *QUICNameServer) getSession() (quic.Session, error) {
|
|||
|
||||
func (s *QUICNameServer) openSession() (quic.Session, error) {
|
||||
tlsConfig := tls.Config{}
|
||||
quicConfig := &quic.Config{
|
||||
HandshakeTimeout: handshakeTimeout,
|
||||
}
|
||||
quicConfig := &quic.Config{}
|
||||
|
||||
session, err := quic.DialAddrContext(context.Background(), s.destination.NetAddr(), tlsConfig.GetTLSConfig(tls.WithNextProto("http/1.1", http2.NextProtoTLS, NextProtoDQ)), quicConfig)
|
||||
if err != nil {
|
||||
|
|
|
@ -19,7 +19,7 @@ func TestQUICNameServer(t *testing.T) {
|
|||
common.Must(err)
|
||||
s, err := NewQUICNameServer(url)
|
||||
common.Must(err)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*2)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
|
||||
ips, err := s.QueryIP(ctx, "google.com", net.IP(nil), dns_feature.IPOption{
|
||||
IPv4Enable: true,
|
||||
IPv6Enable: true,
|
||||
|
@ -36,7 +36,7 @@ func TestQUICNameServerWithCache(t *testing.T) {
|
|||
common.Must(err)
|
||||
s, err := NewQUICNameServer(url)
|
||||
common.Must(err)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*2)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
|
||||
ips, err := s.QueryIP(ctx, "google.com", net.IP(nil), dns_feature.IPOption{
|
||||
IPv4Enable: true,
|
||||
IPv6Enable: true,
|
||||
|
@ -47,7 +47,7 @@ func TestQUICNameServerWithCache(t *testing.T) {
|
|||
t.Error("expect some ips, but got 0")
|
||||
}
|
||||
|
||||
ctx2, cancel := context.WithTimeout(context.Background(), time.Second*2)
|
||||
ctx2, cancel := context.WithTimeout(context.Background(), time.Second*5)
|
||||
ips2, err := s.QueryIP(ctx2, "google.com", net.IP(nil), dns_feature.IPOption{
|
||||
IPv4Enable: true,
|
||||
IPv6Enable: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue