mirror of
https://github.com/fatedier/frp.git
synced 2024-12-22 23:04:49 +07:00
Fix various typos (#3783)
This commit is contained in:
parent
526e809bd5
commit
f5d5a00eef
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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 {
|
||||
|
@ -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.
|
||||
|
@ -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".
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user