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

Refine DNS Options

This commit is contained in:
JimhHan
2021-04-10 11:36:58 +08:00
parent f20c445974
commit 217844cc37
10 changed files with 82 additions and 55 deletions

View File

@ -2,23 +2,15 @@ package dns
import "github.com/xtls/xray-core/features/dns"
type Option interface {
queryIPv4() bool
queryIPv6() bool
queryIP() bool
queryFake() bool
canDoQuery(c *Client) bool
}
func isIPQuery(o dns.IPOption) bool {
func isIPQuery(o *dns.IPOption) bool {
return o.IPv4Enable || o.IPv6Enable
}
func canQueryOnClient(o dns.IPOption, c *Client) bool {
func canQueryOnClient(o *dns.IPOption, c *Client) bool {
isIPClient := !(c.Name() == FakeDNSName)
return isIPClient && isIPQuery(o)
}
func isQuery(o dns.IPOption) bool {
func isQuery(o *dns.IPOption) bool {
return !(o.IPv4Enable || o.IPv6Enable || o.FakeEnable)
}