diff --git a/app/dispatcher/fakednssniffer.go b/app/dispatcher/fakednssniffer.go index 2867eefff..9f9cfbd7d 100644 --- a/app/dispatcher/fakednssniffer.go +++ b/app/dispatcher/fakednssniffer.go @@ -14,7 +14,7 @@ import ( "github.com/v2fly/v2ray-core/v4/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 f9fe4982e..ca7413fcf 100644 --- a/app/dns/dnscommon.go +++ b/app/dns/dnscommon.go @@ -13,7 +13,7 @@ import ( dns_feature "github.com/v2fly/v2ray-core/v4/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 2822e52c2..bd09f5841 100644 --- a/app/dns/fakedns/fake.go +++ b/app/dns/fakedns/fake.go @@ -105,7 +105,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 generate 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)} @@ -128,7 +128,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/observatory/burst/healthping.go b/app/observatory/burst/healthping.go index 6f88cff50..a59a61487 100644 --- a/app/observatory/burst/healthping.go +++ b/app/observatory/burst/healthping.go @@ -175,7 +175,7 @@ func (h *HealthPing) doCheck(tags []string, duration time.Duration, rounds int) } } -// PutResult put a ping rtt to results +// PutResult puts a ping rtt to results func (h *HealthPing) PutResult(tag string, rtt time.Duration) { h.access.Lock() defer h.access.Unlock() diff --git a/common/antireplay/replayfilter.go b/common/antireplay/replayfilter.go index 4e0783d12..241f28822 100644 --- a/common/antireplay/replayfilter.go +++ b/common/antireplay/replayfilter.go @@ -9,7 +9,7 @@ import ( const replayFilterCapacity = 100000 -// ReplayFilter check for replay attacks. +// ReplayFilter checks for replay attacks. type ReplayFilter struct { lock sync.Mutex poolA *cuckoo.Filter @@ -19,7 +19,7 @@ type ReplayFilter struct { interval int64 } -// NewReplayFilter create a new filter with specifying the expiration time interval in seconds. +// NewReplayFilter creates a new filter with specifying the expiration time interval in seconds. func NewReplayFilter(interval int64) *ReplayFilter { filter := &ReplayFilter{} filter.interval = interval @@ -31,7 +31,7 @@ func (filter *ReplayFilter) Interval() int64 { return filter.interval } -// Check determine if there are duplicate records. +// Check determines if there are duplicate records. func (filter *ReplayFilter) Check(sum []byte) bool { filter.lock.Lock() defer filter.lock.Unlock() diff --git a/common/buf/multi_buffer.go b/common/buf/multi_buffer.go index b49f3bbe6..bdfb0d684 100644 --- a/common/buf/multi_buffer.go +++ b/common/buf/multi_buffer.go @@ -53,7 +53,7 @@ func MergeBytes(dest MultiBuffer, src []byte) MultiBuffer { return dest } -// ReleaseMulti release all content of the MultiBuffer, and returns an empty MultiBuffer. +// ReleaseMulti releases all content of the MultiBuffer, and returns an empty MultiBuffer. func ReleaseMulti(mb MultiBuffer) MultiBuffer { for i := range mb { mb[i].Release() @@ -235,7 +235,7 @@ func (mb MultiBuffer) Len() int32 { return size } -// IsEmpty return true if the MultiBuffer has no content. +// IsEmpty returns true if the MultiBuffer has no content. func (mb MultiBuffer) IsEmpty() bool { for _, b := range mb { if !b.IsEmpty() { @@ -283,14 +283,14 @@ func (c *MultiBufferContainer) Write(b []byte) (int, error) { return len(b), nil } -// WriteMultiBuffer implement Writer. +// WriteMultiBuffer implements Writer. func (c *MultiBufferContainer) WriteMultiBuffer(b MultiBuffer) error { mb, _ := MergeMulti(c.MultiBuffer, b) c.MultiBuffer = mb return nil } -// Close implement io.Closer. +// Close implements io.Closer. func (c *MultiBufferContainer) Close() error { c.MultiBuffer = ReleaseMulti(c.MultiBuffer) return nil diff --git a/common/cache/lru.go b/common/cache/lru.go index e1ffae6e7..00dbbc8f3 100644 --- a/common/cache/lru.go +++ b/common/cache/lru.go @@ -25,7 +25,7 @@ type lruElement struct { value interface{} } -// NewLru init a lru cache +// NewLru initializes a lru cache func NewLru(cap int) Lru { return &lru{ capacity: cap,