diff --git a/common/cache/lrucache.go b/common/cache/lrucache.go index a2e0e903..4269d86b 100644 --- a/common/cache/lrucache.go +++ b/common/cache/lrucache.go @@ -121,7 +121,7 @@ func (c *LruCache) Set(key interface{}, value interface{}) { c.SetWithExpire(key, value, time.Unix(expires, 0)) } -// SetWithExpire stores the interface{} representation of a response for a given key and given exires. +// SetWithExpire stores the interface{} representation of a response for a given key and given expires. // The expires time will round to second. func (c *LruCache) SetWithExpire(key interface{}, value interface{}, expires time.Time) { c.mu.Lock() diff --git a/common/pool/alloc.go b/common/pool/alloc.go index 4f26c036..bf177da8 100644 --- a/common/pool/alloc.go +++ b/common/pool/alloc.go @@ -61,7 +61,7 @@ func (alloc *Allocator) Put(buf []byte) error { return nil } -// msb return the pos of most significiant bit +// msb return the pos of most significant bit func msb(size int) uint16 { return uint16(bits.Len32(uint32(size)) - 1) } diff --git a/common/singledo/singledo.go b/common/singledo/singledo.go index e592343b..f6123fe4 100644 --- a/common/singledo/singledo.go +++ b/common/singledo/singledo.go @@ -24,8 +24,8 @@ type Result struct { Err error } -// Do single.Do likes sync.singleFilght -//lint:ignore ST1008 it likes sync.singleFilght +// Do single.Do likes sync.singleFlight +//lint:ignore ST1008 it likes sync.singleFlight func (s *Single) Do(fn func() (interface{}, error)) (v interface{}, err error, shared bool) { s.mux.Lock() now := time.Now() diff --git a/config/utils.go b/config/utils.go index 74af4a64..b3d198f7 100644 --- a/config/utils.go +++ b/config/utils.go @@ -23,7 +23,7 @@ func proxyGroupsDagSort(groupsConfig []map[string]interface{}) error { indegree int // topological order topo int - // the origional data in `groupsConfig` + // the original data in `groupsConfig` data map[string]interface{} // `outdegree` and `from` are used in loop locating outdegree int @@ -65,7 +65,7 @@ func proxyGroupsDagSort(groupsConfig []map[string]interface{}) error { index := 0 queue := make([]string, 0) for name, node := range graph { - // in the begning, put nodes that have `node.indegree == 0` into queue. + // in the beginning, put nodes that have `node.indegree == 0` into queue. if node.indegree == 0 { queue = append(queue, name) } diff --git a/constant/adapters.go b/constant/adapters.go index a12975ba..4ba891de 100644 --- a/constant/adapters.go +++ b/constant/adapters.go @@ -137,7 +137,7 @@ type UDPPacket interface { // WriteBack writes the payload with source IP/Port equals addr // - variable source IP/Port is important to STUN - // - if addr is not provided, WriteBack will wirte out UDP packet with SourceIP/Prot equals to origional Target, + // - if addr is not provided, WriteBack will write out UDP packet with SourceIP/Port equals to original Target, // this is important when using Fake-IP. WriteBack(b []byte, addr net.Addr) (n int, err error) diff --git a/hub/route/configs.go b/hub/route/configs.go index c551d667..581f2855 100644 --- a/hub/route/configs.go +++ b/hub/route/configs.go @@ -106,7 +106,7 @@ func updateConfigs(w http.ResponseWriter, r *http.Request) { } else { if !filepath.IsAbs(req.Path) { render.Status(r, http.StatusBadRequest) - render.JSON(w, r, newError("path is not a absoluted path")) + render.JSON(w, r, newError("path is not a absolute path")) return } diff --git a/proxy/redir/utils.go b/proxy/redir/utils.go index 46e39b8a..58e30b0c 100644 --- a/proxy/redir/utils.go +++ b/proxy/redir/utils.go @@ -15,7 +15,7 @@ func (c *packet) Data() []byte { return c.buf } -// WriteBack opens a new socket binding `addr` to wirte UDP packet back +// WriteBack opens a new socket binding `addr` to write UDP packet back func (c *packet) WriteBack(b []byte, addr net.Addr) (n int, err error) { tc, err := dialUDP("udp", addr.(*net.UDPAddr), c.lAddr) if err != nil { diff --git a/proxy/socks/utils.go b/proxy/socks/utils.go index d3ab3b78..797e0a22 100644 --- a/proxy/socks/utils.go +++ b/proxy/socks/utils.go @@ -18,7 +18,7 @@ func (c *packet) Data() []byte { return c.payload } -// WriteBack wirtes UDP packet with source(ip, port) = `addr` +// WriteBack write UDP packet with source(ip, port) = `addr` func (c *packet) WriteBack(b []byte, addr net.Addr) (n int, err error) { packet, err := socks5.EncodeUDPPacket(socks5.ParseAddrToSocksAddr(addr), b) if err != nil {