0
mirror of https://github.com/XTLS/Xray-core.git synced 2025-06-19 14:48:03 +03:00

Feat: add disableFallback & skipFallback option for DNS client (#489)

This commit is contained in:
秋のかえで
2021-04-10 00:07:08 +08:00
committed by GitHub
parent 70b63e21a5
commit 6e902b24ae
6 changed files with 191 additions and 145 deletions

View File

@ -69,6 +69,7 @@ func TestDNSConfigParsing(t *testing.T) {
"address": "8.8.8.8",
"clientIp": "10.0.0.1",
"port": 5353,
"skipFallback": true,
"domains": ["domain:example.com"]
}],
"hosts": {
@ -80,7 +81,8 @@ func TestDNSConfigParsing(t *testing.T) {
},
"clientIp": "10.0.0.1",
"queryStrategy": "UseIPv4",
"disableCache": true
"disableCache": true,
"disableFallback": true
}`,
Parser: parserCreator(),
Output: &dns.Config{
@ -95,7 +97,8 @@ func TestDNSConfigParsing(t *testing.T) {
Network: net.Network_UDP,
Port: 5353,
},
ClientIp: []byte{10, 0, 0, 1},
ClientIp: []byte{10, 0, 0, 1},
SkipFallback: true,
PrioritizedDomain: []*dns.NameServer_PriorityDomain{
{
Type: dns.DomainMatchingType_Subdomain,
@ -137,9 +140,10 @@ func TestDNSConfigParsing(t *testing.T) {
Ip: [][]byte{{8, 8, 4, 4}},
},
},
ClientIp: []byte{10, 0, 0, 1},
QueryStrategy: dns.QueryStrategy_USE_IP4,
CacheStrategy: dns.CacheStrategy_Cache_DISABLE,
ClientIp: []byte{10, 0, 0, 1},
QueryStrategy: dns.QueryStrategy_USE_IP4,
CacheStrategy: dns.CacheStrategy_Cache_DISABLE,
DisableFallback: true,
},
},
})