mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-13 20:44:12 +08:00
rename
This commit is contained in:
parent
a81a8fee84
commit
67d0a2df71
@ -28,7 +28,7 @@ type DNS struct {
|
||||
ctx context.Context
|
||||
domainMatcher strmatcher.IndexMatcher
|
||||
matcherInfos []*DomainMatcherInfo
|
||||
useSystem bool
|
||||
checkSystem bool
|
||||
}
|
||||
|
||||
// DomainMatcherInfo contains information attached to index returned by Server.domainMatcher
|
||||
@ -48,7 +48,7 @@ func New(ctx context.Context, config *Config) (*DNS, error) {
|
||||
}
|
||||
|
||||
var ipOption dns.IPOption
|
||||
useSystem := false
|
||||
checkSystem := false
|
||||
switch config.QueryStrategy {
|
||||
case QueryStrategy_USE_IP:
|
||||
ipOption = dns.IPOption{
|
||||
@ -62,7 +62,7 @@ func New(ctx context.Context, config *Config) (*DNS, error) {
|
||||
IPv6Enable: true,
|
||||
FakeEnable: false,
|
||||
}
|
||||
useSystem = true
|
||||
checkSystem = true
|
||||
case QueryStrategy_USE_IP4:
|
||||
ipOption = dns.IPOption{
|
||||
IPv4Enable: true,
|
||||
@ -149,7 +149,7 @@ func New(ctx context.Context, config *Config) (*DNS, error) {
|
||||
matcherInfos: matcherInfos,
|
||||
disableFallback: config.DisableFallback,
|
||||
disableFallbackIfMatch: config.DisableFallbackIfMatch,
|
||||
useSystem: useSystem,
|
||||
checkSystem: checkSystem,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ func (s *DNS) LookupIP(domain string, option dns.IPOption) ([]net.IP, uint32, er
|
||||
return nil, 0, errors.New("empty domain name")
|
||||
}
|
||||
|
||||
if s.useSystem {
|
||||
if s.checkSystem {
|
||||
supportIPv4, supportIPv6 := checkSystemNetwork()
|
||||
option.IPv4Enable = option.IPv4Enable && supportIPv4
|
||||
option.IPv6Enable = option.IPv6Enable && supportIPv6
|
||||
|
@ -37,7 +37,7 @@ type Client struct {
|
||||
timeoutMs time.Duration
|
||||
finalQuery bool
|
||||
ipOption *dns.IPOption
|
||||
useSystem bool
|
||||
checkSystem bool
|
||||
}
|
||||
|
||||
// NewServer creates a name server object according to the network destination url.
|
||||
@ -187,7 +187,7 @@ func NewClient(
|
||||
timeoutMs = time.Duration(ns.TimeoutMs) * time.Millisecond
|
||||
}
|
||||
|
||||
useSystem := ns.QueryStrategy == QueryStrategy_USE_SYS
|
||||
checkSystem := ns.QueryStrategy == QueryStrategy_USE_SYS
|
||||
|
||||
client.server = server
|
||||
client.skipFallback = ns.SkipFallback
|
||||
@ -200,7 +200,7 @@ func NewClient(
|
||||
client.timeoutMs = timeoutMs
|
||||
client.finalQuery = ns.FinalQuery
|
||||
client.ipOption = &ipOption
|
||||
client.useSystem = useSystem
|
||||
client.checkSystem = checkSystem
|
||||
return nil
|
||||
})
|
||||
return client, err
|
||||
@ -217,7 +217,7 @@ func (c *Client) IsFinalQuery() bool {
|
||||
|
||||
// QueryIP sends DNS query to the name server with the client's IP.
|
||||
func (c *Client) QueryIP(ctx context.Context, domain string, option dns.IPOption) ([]net.IP, uint32, error) {
|
||||
if c.useSystem {
|
||||
if c.checkSystem {
|
||||
supportIPv4, supportIPv6 := checkSystemNetwork()
|
||||
option.IPv4Enable = option.IPv4Enable && supportIPv4
|
||||
option.IPv6Enable = option.IPv6Enable && supportIPv6
|
||||
|
Loading…
x
Reference in New Issue
Block a user