From 800b3bd3fe382d6794ec9e99d1689fa9f71e9ba6 Mon Sep 17 00:00:00 2001 From: Machtergreifung <30045531+Machtergreifung@users.noreply.github.com> Date: Tue, 11 Jan 2022 12:39:58 +0800 Subject: [PATCH] chore fixed (#895) * chore fixed --- app/commander/outbound.go | 2 +- app/dispatcher/fakednssniffer.go | 2 +- app/dns/dnscommon.go | 4 ++-- app/dns/fakedns/fake.go | 4 ++-- app/dns/nameserver.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/commander/outbound.go b/app/commander/outbound.go index 0616933f..aa60bd1c 100644 --- a/app/commander/outbound.go +++ b/app/commander/outbound.go @@ -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: diff --git a/app/dispatcher/fakednssniffer.go b/app/dispatcher/fakednssniffer.go index 9f91e7f0..2275e502 100644 --- a/app/dispatcher/fakednssniffer.go +++ b/app/dispatcher/fakednssniffer.go @@ -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) { diff --git a/app/dns/dnscommon.go b/app/dns/dnscommon.go index c48045ce..9f5e3795 100644 --- a/app/dns/dnscommon.go +++ b/app/dns/dnscommon.go @@ -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) diff --git a/app/dns/fakedns/fake.go b/app/dns/fakedns/fake.go index 01cee465..52918fbc 100644 --- a/app/dns/fakedns/fake.go +++ b/app/dns/fakedns/fake.go @@ -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 "" diff --git a/app/dns/nameserver.go b/app/dns/nameserver.go index b15803e6..d6f9b272 100644 --- a/app/dns/nameserver.go +++ b/app/dns/nameserver.go @@ -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)