From 9ad26fa049bf8a02c4cb5ad472d6409615da5826 Mon Sep 17 00:00:00 2001 From: Machtergreifung <30045531+Machtergreifung@users.noreply.github.com> Date: Thu, 13 Jan 2022 10:51:47 +0800 Subject: [PATCH] chore fixed (#897) * chore fixed --- app/proxyman/outbound/handler.go | 2 +- app/router/router.go | 2 +- common/antireplay/replayfilter.go | 4 ++-- common/buf/multi_buffer.go | 8 ++++---- common/cache/lru.go | 2 +- common/log/log.go | 2 +- common/platform/others.go | 2 +- common/platform/windows.go | 2 +- common/protocol/http/headers.go | 2 +- common/protocol/tls/cert/privateKey.go | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/proxyman/outbound/handler.go b/app/proxyman/outbound/handler.go index 37f0eccc..3f9bc848 100644 --- a/app/proxyman/outbound/handler.go +++ b/app/proxyman/outbound/handler.go @@ -58,7 +58,7 @@ type Handler struct { downlinkCounter stats.Counter } -// NewHandler create a new Handler based on the given configuration. +// NewHandler creates a new Handler based on the given configuration. func NewHandler(ctx context.Context, config *core.OutboundHandlerConfig) (outbound.Handler, error) { v := core.MustFromContext(ctx) uplinkCounter, downlinkCounter := getStatCounter(v, config.Tag) diff --git a/app/router/router.go b/app/router/router.go index 99b42c49..010f8d0a 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -122,7 +122,7 @@ func (*Router) Close() error { return nil } -// Type implement common.HasType. +// Type implements common.HasType. func (*Router) Type() interface{} { return routing.RouterType() } diff --git a/common/antireplay/replayfilter.go b/common/antireplay/replayfilter.go index 4e0783d1..ffd7d68d 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 @@ -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 636eeb3a..478d0c63 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 7c427ace..9eb760d6 100644 --- a/common/cache/lru.go +++ b/common/cache/lru.go @@ -26,7 +26,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, diff --git a/common/log/log.go b/common/log/log.go index e67e11ec..fbc2a509 100644 --- a/common/log/log.go +++ b/common/log/log.go @@ -34,7 +34,7 @@ func Record(msg Message) { var logHandler syncHandler -// RegisterHandler register a new handler as current log handler. Previous registered handler will be discarded. +// RegisterHandler registers a new handler as current log handler. Previous registered handler will be discarded. func RegisterHandler(handler Handler) { if handler == nil { panic("Log handler is nil") diff --git a/common/platform/others.go b/common/platform/others.go index a4465794..ff45a054 100644 --- a/common/platform/others.go +++ b/common/platform/others.go @@ -22,7 +22,7 @@ func GetToolLocation(file string) string { return filepath.Join(toolPath, file) } -// GetAssetLocation search for `file` in certain locations +// GetAssetLocation searches for `file` in certain locations func GetAssetLocation(file string) string { const name = "xray.location.asset" assetPath := NewEnvFlag(name).GetValue(getExecutableDir) diff --git a/common/platform/windows.go b/common/platform/windows.go index aa912cf6..a568d5ae 100644 --- a/common/platform/windows.go +++ b/common/platform/windows.go @@ -20,7 +20,7 @@ func GetToolLocation(file string) string { return filepath.Join(toolPath, file+".exe") } -// GetAssetLocation search for `file` in the excutable dir +// GetAssetLocation searches for `file` in the excutable dir func GetAssetLocation(file string) string { const name = "xray.location.asset" assetPath := NewEnvFlag(name).GetValue(getExecutableDir) diff --git a/common/protocol/http/headers.go b/common/protocol/http/headers.go index e0346426..db3aa670 100644 --- a/common/protocol/http/headers.go +++ b/common/protocol/http/headers.go @@ -22,7 +22,7 @@ func ParseXForwardedFor(header http.Header) []net.Address { return addrs } -// RemoveHopByHopHeaders remove hop by hop headers in http header list. +// RemoveHopByHopHeaders removes hop by hop headers in http header list. func RemoveHopByHopHeaders(header http.Header) { // Strip hop-by-hop header based on RFC: // http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.5.1 diff --git a/common/protocol/tls/cert/privateKey.go b/common/protocol/tls/cert/privateKey.go index 52a8e68c..e5e8bd0b 100644 --- a/common/protocol/tls/cert/privateKey.go +++ b/common/protocol/tls/cert/privateKey.go @@ -17,7 +17,7 @@ type pkcs8 struct { Version int Algo pkix.AlgorithmIdentifier PrivateKey []byte - // optional attributes omitted. + // Optional attributes omitted. } type pkcs1AdditionalRSAPrime struct {