diff --git a/client/proxy/udp.go b/client/proxy/udp.go index 0a5cefcc..d7a790c1 100644 --- a/client/proxy/udp.go +++ b/client/proxy/udp.go @@ -89,7 +89,7 @@ func (pxy *UDPProxy) Close() { func (pxy *UDPProxy) InWorkConn(conn net.Conn, _ *msg.StartWorkConn) { xl := pxy.xl xl.Info("incoming a new work connection for udp proxy, %s", conn.RemoteAddr().String()) - // close resources releated with old workConn + // close resources related with old workConn pxy.Close() var rwc io.ReadWriteCloser = conn diff --git a/client/visitor/visitor.go b/client/visitor/visitor.go index dcd1f7b3..4cfd6106 100644 --- a/client/visitor/visitor.go +++ b/client/visitor/visitor.go @@ -25,7 +25,7 @@ import ( "github.com/fatedier/frp/pkg/util/xlog" ) -// Helper wrapps some functions for visitor to use. +// Helper wraps some functions for visitor to use. type Helper interface { // ConnectServer directly connects to the frp server. ConnectServer() (net.Conn, error) diff --git a/cmd/frps/root.go b/cmd/frps/root.go index 1fa57d95..5f32fe9c 100644 --- a/cmd/frps/root.go +++ b/cmd/frps/root.go @@ -40,7 +40,7 @@ var ( func init() { rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", "", "config file of frps") rootCmd.PersistentFlags().BoolVarP(&showVersion, "version", "v", false, "version of frps") - rootCmd.PersistentFlags().BoolVarP(&strictConfigMode, "strict_config", "", false, "strict config parsing mode, unknown fileds will cause error") + rootCmd.PersistentFlags().BoolVarP(&strictConfigMode, "strict_config", "", false, "strict config parsing mode, unknown fields will cause error") RegisterServerConfigFlags(rootCmd, &serverCfg) } diff --git a/conf/frpc_full_example.toml b/conf/frpc_full_example.toml index bdfc5643..247d0a6a 100644 --- a/conf/frpc_full_example.toml +++ b/conf/frpc_full_example.toml @@ -38,7 +38,7 @@ auth.token = "12345678" # auth.oidc.clientSecret = "" # oidc.audience specifies the audience of the token in OIDC authentication. # auth.oidc.audience = "" -# oidc.scope specifies the permisssions of the token in OIDC authentication if AuthenticationMethod == "oidc". By default, this value is "". +# oidc.scope specifies the permissions of the token in OIDC authentication if AuthenticationMethod == "oidc". By default, this value is "". # auth.oidc.scope = "" # oidc.tokenEndpointURL specifies the URL which implements OIDC Token Endpoint. # It will be used to get an OIDC token. diff --git a/conf/legacy/frpc_legacy_full.ini b/conf/legacy/frpc_legacy_full.ini index f8eca6b7..51ac9c47 100644 --- a/conf/legacy/frpc_legacy_full.ini +++ b/conf/legacy/frpc_legacy_full.ini @@ -56,7 +56,7 @@ oidc_client_secret = # oidc_audience specifies the audience of the token in OIDC authentication if AuthenticationMethod == "oidc". By default, this value is "". oidc_audience = -# oidc_scope specifies the permisssions of the token in OIDC authentication if AuthenticationMethod == "oidc". By default, this value is "". +# oidc_scope specifies the permissions of the token in OIDC authentication if AuthenticationMethod == "oidc". By default, this value is "". oidc_scope = # oidc_token_endpoint_url specifies the URL which implements OIDC Token Endpoint. diff --git a/pkg/config/legacy/client.go b/pkg/config/legacy/client.go index f7257cb5..50f62bef 100644 --- a/pkg/config/legacy/client.go +++ b/pkg/config/legacy/client.go @@ -99,7 +99,7 @@ type ClientCommonConf struct { // the server must have TCP multiplexing enabled as well. By default, this // value is true. TCPMux bool `ini:"tcp_mux" json:"tcp_mux"` - // TCPMuxKeepaliveInterval specifies the keep alive interval for TCP stream multipler. + // TCPMuxKeepaliveInterval specifies the keep alive interval for TCP stream multiplier. // If TCPMux is true, heartbeat of application layer is unnecessary because it can only rely on heartbeat in TCPMux. TCPMuxKeepaliveInterval int64 `ini:"tcp_mux_keepalive_interval" json:"tcp_mux_keepalive_interval"` // User specifies a prefix for proxy names to distinguish them from other diff --git a/pkg/config/legacy/server.go b/pkg/config/legacy/server.go index 797770a3..1279a499 100644 --- a/pkg/config/legacy/server.go +++ b/pkg/config/legacy/server.go @@ -139,7 +139,7 @@ type ServerCommonConf struct { // from a client to share a single TCP connection. By default, this value // is true. TCPMux bool `ini:"tcp_mux" json:"tcp_mux"` - // TCPMuxKeepaliveInterval specifies the keep alive interval for TCP stream multipler. + // TCPMuxKeepaliveInterval specifies the keep alive interval for TCP stream multiplier. // If TCPMux is true, heartbeat of application layer is unnecessary because it can only rely on heartbeat in TCPMux. TCPMuxKeepaliveInterval int64 `ini:"tcp_mux_keepalive_interval" json:"tcp_mux_keepalive_interval"` // TCPKeepAlive specifies the interval between keep-alive probes for an active network connection between frpc and frps. diff --git a/pkg/config/load.go b/pkg/config/load.go index 41d1a231..3014eb35 100644 --- a/pkg/config/load.go +++ b/pkg/config/load.go @@ -221,7 +221,7 @@ func LoadClientConfig(path string, strict bool) ( } // Load additional config from includes. - // legacy ini format alredy handle this in ParseClientConfig. + // legacy ini format already handle this in ParseClientConfig. if len(cliCfg.IncludeConfigFiles) > 0 && !isLegacyFormat { extPxyCfgs, extVisitorCfgs, err := LoadAdditionalClientConfigs(cliCfg.IncludeConfigFiles, isLegacyFormat, strict) if err != nil { diff --git a/pkg/config/v1/client.go b/pkg/config/v1/client.go index 9029aa73..52b87690 100644 --- a/pkg/config/v1/client.go +++ b/pkg/config/v1/client.go @@ -111,7 +111,7 @@ type ClientTransportConfig struct { // the server must have TCP multiplexing enabled as well. By default, this // value is true. TCPMux *bool `json:"tcpMux,omitempty"` - // TCPMuxKeepaliveInterval specifies the keep alive interval for TCP stream multipler. + // TCPMuxKeepaliveInterval specifies the keep alive interval for TCP stream multiplier. // If TCPMux is true, heartbeat of application layer is unnecessary because it can only rely on heartbeat in TCPMux. TCPMuxKeepaliveInterval int64 `json:"tcpMuxKeepaliveInterval,omitempty"` // QUIC protocol options. diff --git a/pkg/config/v1/common.go b/pkg/config/v1/common.go index 422a8082..72c9d036 100644 --- a/pkg/config/v1/common.go +++ b/pkg/config/v1/common.go @@ -83,7 +83,7 @@ type TLSConfig struct { } type LogConfig struct { - // This is destination where frp should wirte the logs. + // This is destination where frp should write the logs. // If "console" is used, logs will be printed to stdout, otherwise, // logs will be written to the specified file. // By default, this value is "console". diff --git a/pkg/config/v1/server.go b/pkg/config/v1/server.go index c42c3eca..e49921e9 100644 --- a/pkg/config/v1/server.go +++ b/pkg/config/v1/server.go @@ -152,7 +152,7 @@ type ServerTransportConfig struct { // is true. // $HideFromDoc TCPMux *bool `json:"tcpMux,omitempty"` - // TCPMuxKeepaliveInterval specifies the keep alive interval for TCP stream multipler. + // TCPMuxKeepaliveInterval specifies the keep alive interval for TCP stream multiplier. // If TCPMux is true, heartbeat of application layer is unnecessary because it can only rely on heartbeat in TCPMux. TCPMuxKeepaliveInterval int64 `json:"tcpMuxKeepaliveInterval,omitempty"` // TCPKeepAlive specifies the interval between keep-alive probes for an active network connection between frpc and frps. diff --git a/pkg/transport/message.go b/pkg/transport/message.go index 7163a8ad..dd43fbdc 100644 --- a/pkg/transport/message.go +++ b/pkg/transport/message.go @@ -29,7 +29,7 @@ type MessageTransporter interface { // Recv(ctx context.Context, laneKey string, msgType string) (Message, error) // Do will first send msg, then recv msg with the same laneKey and specified msgType. Do(ctx context.Context, req msg.Message, laneKey, recvMsgType string) (msg.Message, error) - // Dispatch will dispatch message to releated channel registered in Do function by its message type and laneKey. + // Dispatch will dispatch message to related channel registered in Do function by its message type and laneKey. Dispatch(m msg.Message, laneKey string) bool // Same with Dispatch but with specified message type. DispatchWithType(m msg.Message, msgType, laneKey string) bool @@ -46,7 +46,7 @@ type transporterImpl struct { sendCh chan msg.Message // First key is message type and second key is lane key. - // Dispatch will dispatch message to releated channel by its message type + // Dispatch will dispatch message to related channel by its message type // and lane key. registry map[string]map[string]chan msg.Message mu sync.RWMutex diff --git a/pkg/util/net/http.go b/pkg/util/net/http.go index 1a7da23f..642d1590 100644 --- a/pkg/util/net/http.go +++ b/pkg/util/net/http.go @@ -24,21 +24,21 @@ import ( "github.com/fatedier/frp/pkg/util/util" ) -type HTTPAuthWraper struct { +type HTTPAuthWrapper struct { h http.Handler user string passwd string } -func NewHTTPBasicAuthWraper(h http.Handler, user, passwd string) http.Handler { - return &HTTPAuthWraper{ +func NewHTTPBasicAuthWrapper(h http.Handler, user, passwd string) http.Handler { + return &HTTPAuthWrapper{ h: h, user: user, passwd: passwd, } } -func (aw *HTTPAuthWraper) ServeHTTP(w http.ResponseWriter, r *http.Request) { +func (aw *HTTPAuthWrapper) ServeHTTP(w http.ResponseWriter, r *http.Request) { user, passwd, hasAuth := r.BasicAuth() if (aw.user == "" && aw.passwd == "") || (hasAuth && user == aw.user && passwd == aw.passwd) { aw.h.ServeHTTP(w, r) @@ -83,11 +83,11 @@ func (authMid *HTTPAuthMiddleware) Middleware(next http.Handler) http.Handler { }) } -type HTTPGzipWraper struct { +type HTTPGzipWrapper struct { h http.Handler } -func (gw *HTTPGzipWraper) ServeHTTP(w http.ResponseWriter, r *http.Request) { +func (gw *HTTPGzipWrapper) ServeHTTP(w http.ResponseWriter, r *http.Request) { if !strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") { gw.h.ServeHTTP(w, r) return @@ -100,7 +100,7 @@ func (gw *HTTPGzipWraper) ServeHTTP(w http.ResponseWriter, r *http.Request) { } func MakeHTTPGzipHandler(h http.Handler) http.Handler { - return &HTTPGzipWraper{ + return &HTTPGzipWrapper{ h: h, } } diff --git a/pkg/util/version/version_test.go b/pkg/util/version/version_test.go index 73b96a85..2b4077cf 100644 --- a/pkg/util/version/version_test.go +++ b/pkg/util/version/version_test.go @@ -47,7 +47,7 @@ func TestVersion(t *testing.T) { proto := Proto(Full()) major := Major(Full()) minor := Minor(Full()) - parseVerion := fmt.Sprintf("%d.%d.%d", proto, major, minor) + parseVersion := fmt.Sprintf("%d.%d.%d", proto, major, minor) version := Full() - assert.Equal(parseVerion, version) + assert.Equal(parseVersion, version) } diff --git a/pkg/util/vhost/http.go b/pkg/util/vhost/http.go index 7b914ce9..1a5bea0b 100644 --- a/pkg/util/vhost/http.go +++ b/pkg/util/vhost/http.go @@ -188,7 +188,7 @@ func (rp *HTTPReverseProxy) CheckAuth(domain, location, routeByHTTPUser, user, p return true } -// getVhost trys to get vhost router by route policy. +// getVhost tries to get vhost router by route policy. func (rp *HTTPReverseProxy) getVhost(domain, location, routeByHTTPUser string) (*Router, bool) { findRouter := func(inDomain, inLocation, inRouteByHTTPUser string) (*Router, bool) { vr, ok := rp.vhostRouter.Get(inDomain, inLocation, inRouteByHTTPUser) diff --git a/server/service.go b/server/service.go index 2629b345..7478b97b 100644 --- a/server/service.go +++ b/server/service.go @@ -543,7 +543,7 @@ func (svr *Service) RegisterControl(ctlConn net.Conn, loginMsg *msg.Login) error if err != nil { xl.Warn("create new controller error: %v", err) // don't return detailed errors to client - return fmt.Errorf("unexpect error when creating new controller") + return fmt.Errorf("unexpected error when creating new controller") } if oldCtl := svr.ctlManager.Add(loginMsg.RunID, ctl); oldCtl != nil { oldCtl.WaitClosed() diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index 6a7a655f..f8b8aa03 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -29,8 +29,8 @@ type Framework struct { // ports used in this framework indexed by port name. usedPorts map[string]int - // record ports alloced by this framework and release them after each test - allocedPorts []int + // record ports allocated by this framework and release them after each test + allocatedPorts []int // portAllocator to alloc port for this test case. portAllocator *port.Allocator @@ -153,11 +153,11 @@ func (f *Framework) AfterEach() { } f.usedPorts = make(map[string]int) - // release alloced ports - for _, port := range f.allocedPorts { + // release allocated ports + for _, port := range f.allocatedPorts { f.portAllocator.Release(port) } - f.allocedPorts = make([]int, 0) + f.allocatedPorts = make([]int, 0) // clear os envs f.osEnvs = make([]string, 0) @@ -237,7 +237,7 @@ func (f *Framework) PortByName(name string) int { func (f *Framework) AllocPort() int { port := f.portAllocator.Get() ExpectTrue(port > 0, "alloc port failed") - f.allocedPorts = append(f.allocedPorts, port) + f.allocatedPorts = append(f.allocatedPorts, port) return port } diff --git a/test/e2e/legacy/plugin/server.go b/test/e2e/legacy/plugin/server.go index 3f14a42d..cf600be2 100644 --- a/test/e2e/legacy/plugin/server.go +++ b/test/e2e/legacy/plugin/server.go @@ -124,7 +124,7 @@ var _ = ginkgo.Describe("[Feature: Server-Plugins]", func() { framework.NewRequestExpect(f).Port(remotePort).Ensure() }) - ginkgo.It("Mofify RemotePort", func() { + ginkgo.It("Modify RemotePort", func() { localPort := f.AllocPort() remotePort := f.AllocPort() handler := func(req *plugin.Request) *plugin.Response { diff --git a/test/e2e/v1/plugin/server.go b/test/e2e/v1/plugin/server.go index 66456f57..b043c57f 100644 --- a/test/e2e/v1/plugin/server.go +++ b/test/e2e/v1/plugin/server.go @@ -129,7 +129,7 @@ var _ = ginkgo.Describe("[Feature: Server-Plugins]", func() { framework.NewRequestExpect(f).Port(remotePort).Ensure() }) - ginkgo.It("Mofify RemotePort", func() { + ginkgo.It("Modify RemotePort", func() { localPort := f.AllocPort() remotePort := f.AllocPort() handler := func(req *plugin.Request) *plugin.Response {