mirror of
https://github.com/fatedier/frp.git
synced 2025-08-04 20:49:04 +00:00
support yaml/json/toml configuration format, make ini deprecated (#3599)
This commit is contained in:
@@ -20,23 +20,23 @@ import (
|
||||
|
||||
"github.com/fatedier/golib/errors"
|
||||
|
||||
"github.com/fatedier/frp/pkg/config"
|
||||
v1 "github.com/fatedier/frp/pkg/config/v1"
|
||||
"github.com/fatedier/frp/pkg/msg"
|
||||
)
|
||||
|
||||
func init() {
|
||||
RegisterProxyFactory(reflect.TypeOf(&config.XTCPProxyConf{}), NewXTCPProxy)
|
||||
RegisterProxyFactory(reflect.TypeOf(&v1.XTCPProxyConfig{}), NewXTCPProxy)
|
||||
}
|
||||
|
||||
type XTCPProxy struct {
|
||||
*BaseProxy
|
||||
cfg *config.XTCPProxyConf
|
||||
cfg *v1.XTCPProxyConfig
|
||||
|
||||
closeCh chan struct{}
|
||||
}
|
||||
|
||||
func NewXTCPProxy(baseProxy *BaseProxy, cfg config.ProxyConf) Proxy {
|
||||
unwrapped, ok := cfg.(*config.XTCPProxyConf)
|
||||
func NewXTCPProxy(baseProxy *BaseProxy) Proxy {
|
||||
unwrapped, ok := baseProxy.GetConfigurer().(*v1.XTCPProxyConfig)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
@@ -58,7 +58,7 @@ func (pxy *XTCPProxy) Run() (remoteAddr string, err error) {
|
||||
if len(allowUsers) == 0 {
|
||||
allowUsers = []string{pxy.GetUserInfo().User}
|
||||
}
|
||||
sidCh, err := pxy.rc.NatHoleController.ListenClient(pxy.GetName(), pxy.cfg.Sk, allowUsers)
|
||||
sidCh, err := pxy.rc.NatHoleController.ListenClient(pxy.GetName(), pxy.cfg.Secretkey, allowUsers)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -86,10 +86,6 @@ func (pxy *XTCPProxy) Run() (remoteAddr string, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (pxy *XTCPProxy) GetConf() config.ProxyConf {
|
||||
return pxy.cfg
|
||||
}
|
||||
|
||||
func (pxy *XTCPProxy) Close() {
|
||||
pxy.BaseProxy.Close()
|
||||
pxy.rc.NatHoleController.CloseClient(pxy.GetName())
|
||||
|
Reference in New Issue
Block a user