mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-24 09:31:29 +00:00
parent
1447615f3a
commit
800b3bd3fe
|
@ -37,7 +37,7 @@ func (l *OutboundListener) Accept() (net.Conn, error) {
|
|||
}
|
||||
}
|
||||
|
||||
// Close implement net.Listener.
|
||||
// Close implements net.Listener.
|
||||
func (l *OutboundListener) Close() error {
|
||||
common.Must(l.done.Close())
|
||||
L:
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/xtls/xray-core/features/dns"
|
||||
)
|
||||
|
||||
// newFakeDNSSniffer Create a Fake DNS metadata sniffer
|
||||
// newFakeDNSSniffer Creates a Fake DNS metadata sniffer
|
||||
func newFakeDNSSniffer(ctx context.Context) (protocolSnifferWithMetadata, error) {
|
||||
var fakeDNSEngine dns.FakeDNSEngine
|
||||
err := core.RequireFeatures(ctx, func(fdns dns.FakeDNSEngine) {
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
dns_feature "github.com/xtls/xray-core/features/dns"
|
||||
)
|
||||
|
||||
// Fqdn normalize domain make sure it ends with '.'
|
||||
// Fqdn normalizes domain make sure it ends with '.'
|
||||
func Fqdn(domain string) string {
|
||||
if len(domain) > 0 && strings.HasSuffix(domain, ".") {
|
||||
return domain
|
||||
|
@ -163,7 +163,7 @@ func buildReqMsgs(domain string, option dns_feature.IPOption, reqIDGen func() ui
|
|||
return reqs
|
||||
}
|
||||
|
||||
// parseResponse parse DNS answers from the returned payload
|
||||
// parseResponse parses DNS answers from the returned payload
|
||||
func parseResponse(payload []byte) (*IPRecord, error) {
|
||||
var parser dnsmessage.Parser
|
||||
h, err := parser.Start(payload)
|
||||
|
|
|
@ -92,7 +92,7 @@ func (fkdns *Holder) initialize(ipPoolCidr string, lruSize int) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// GetFakeIPForDomain check and generate a fake IP for a domain name
|
||||
// GetFakeIPForDomain checks and generates a fake IP for a domain name
|
||||
func (fkdns *Holder) GetFakeIPForDomain(domain string) []net.Address {
|
||||
if v, ok := fkdns.domainToIP.Get(domain); ok {
|
||||
return []net.Address{v.(net.Address)}
|
||||
|
@ -123,7 +123,7 @@ func (fkdns *Holder) GetFakeIPForDomain(domain string) []net.Address {
|
|||
return []net.Address{ip}
|
||||
}
|
||||
|
||||
// GetDomainFromFakeDNS check if an IP is a fake IP and have corresponding domain name
|
||||
// GetDomainFromFakeDNS checks if an IP is a fake IP and have corresponding domain name
|
||||
func (fkdns *Holder) GetDomainFromFakeDNS(ip net.Address) string {
|
||||
if !ip.Family().IsIP() || !fkdns.ipRange.Contains(ip.IP()) {
|
||||
return ""
|
||||
|
|
|
@ -186,7 +186,7 @@ func (c *Client) Name() string {
|
|||
return c.server.Name()
|
||||
}
|
||||
|
||||
// QueryIP send DNS query to the name server with the client's IP.
|
||||
// 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, disableCache bool) ([]net.IP, error) {
|
||||
ctx, cancel := context.WithTimeout(ctx, 4*time.Second)
|
||||
ips, err := c.server.QueryIP(ctx, domain, c.clientIP, option, disableCache)
|
||||
|
|
Loading…
Reference in a new issue