
Implement a simplified version of STCP functionality. * **Client Proxy Configuration and Handling** - Add `STCPProxyConfig` to the `pxyConfs` slice in `client/proxy/general_tcp.go`. * **Client Visitor Configuration and Handling** - Add `STCPVisitorConfig` to the `cfg` struct in `client/visitor/stcp.go`. * **Command Registration and Initialization** - Add `STCP` to the `proxyTypes` and `visitorTypes` slices in `cmd/frpc/sub/proxy.go`. * **Configuration Examples** - Add example configurations for `STCP` proxy and visitor in `conf/frpc_full_example.toml`. - Add example configurations for `STCP` proxy and visitor in `conf/legacy/frpc_legacy_full.ini`. * **Configuration Structures** - Add `STCPProxyConfig` struct and include it in the `proxyConfigTypeMap` in `pkg/config/v1/proxy.go`. - Add `STCPVisitorConfig` struct and include it in the `visitorConfigTypeMap` in `pkg/config/v1/visitor.go`. * **Configuration Validation** - Add validation for `STCPProxyConfig` in `pkg/config/v1/validation/proxy.go`. - Add validation for `STCPVisitorConfig` in `pkg/config/v1/validation/visitor.go`. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/fatedier/frp?shareId=XXXX-XXXX-XXXX-XXXX).
35 lines
777 B
Go
35 lines
777 B
Go
package proxy
|
|
|
|
import (
|
|
"reflect"
|
|
|
|
v1 "github.com/fatedier/frp/pkg/config/v1"
|
|
)
|
|
|
|
func init() {
|
|
pxyConfs := []v1.ProxyConfigurer{
|
|
&v1.TCPProxyConfig{},
|
|
&v1.HTTPProxyConfig{},
|
|
&v1.HTTPSProxyConfig{},
|
|
&v1.STCPProxyConfig{},
|
|
&v1.TCPMuxProxyConfig{},
|
|
&v1.STCPProxyConfig{},
|
|
}
|
|
for _, cfg := range pxyConfs {
|
|
RegisterProxyFactory(reflect.TypeOf(cfg), NewGeneralTCPProxy)
|
|
}
|
|
}
|
|
|
|
// GeneralTCPProxy is a general implementation of Proxy interface for TCP protocol.
|
|
// If the default GeneralTCPProxy cannot meet the requirements, you can customize
|
|
// the implementation of the Proxy interface.
|
|
type GeneralTCPProxy struct {
|
|
*BaseProxy
|
|
}
|
|
|
|
func NewGeneralTCPProxy(baseProxy *BaseProxy, _ v1.ProxyConfigurer) Proxy {
|
|
return &GeneralTCPProxy{
|
|
BaseProxy: baseProxy,
|
|
}
|
|
}
|