2023-05-30 22:18:56 +08:00
|
|
|
package proxy
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"reflect"
|
|
|
|
|
|
2023-09-06 10:18:02 +08:00
|
|
|
v1 "github.com/fatedier/frp/pkg/config/v1"
|
2023-05-30 22:18:56 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func init() {
|
2023-09-06 10:18:02 +08:00
|
|
|
pxyConfs := []v1.ProxyConfigurer{
|
|
|
|
|
&v1.TCPProxyConfig{},
|
|
|
|
|
&v1.HTTPProxyConfig{},
|
|
|
|
|
&v1.HTTPSProxyConfig{},
|
|
|
|
|
&v1.STCPProxyConfig{},
|
|
|
|
|
&v1.TCPMuxProxyConfig{},
|
2024-11-21 01:23:25 +08:00
|
|
|
&v1.STCPProxyConfig{},
|
2023-05-30 22:18:56 +08:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-06 10:18:02 +08:00
|
|
|
func NewGeneralTCPProxy(baseProxy *BaseProxy, _ v1.ProxyConfigurer) Proxy {
|
2023-05-30 22:18:56 +08:00
|
|
|
return &GeneralTCPProxy{
|
|
|
|
|
BaseProxy: baseProxy,
|
|
|
|
|
}
|
|
|
|
|
}
|