mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-14 02:53:02 +00:00
25 lines
495 B
Go
25 lines
495 B
Go
|
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 {
|
||
|
return o.IPv4Enable || o.IPv6Enable
|
||
|
}
|
||
|
|
||
|
func canQueryOnClient(o dns.IPOption, c *Client) bool {
|
||
|
isIPClient := !(c.Name() == FakeDNSName)
|
||
|
return isIPClient && isIPQuery(o)
|
||
|
}
|
||
|
|
||
|
func isQuery(o dns.IPOption) bool {
|
||
|
return !(o.IPv4Enable || o.IPv6Enable || o.FakeEnable)
|
||
|
}
|