all: now messages between frps and frpc can be encryped when use_encryption set true

This commit is contained in:
fatedier
2016-03-31 18:48:18 +08:00
parent 52f99bbc00
commit 80fc76da52
11 changed files with 73 additions and 44 deletions

View File

@@ -25,11 +25,12 @@ import (
)
type ProxyServer struct {
Name string
Passwd string
BindAddr string
ListenPort int64
Status int64
Name string
Passwd string
UseEncryption bool
BindAddr string
ListenPort int64
Status int64
listener *conn.Listener // accept new connection from remote users
ctlMsgChan chan int64 // every time accept a new user conn, put "1" to the channel
@@ -132,8 +133,12 @@ func (p *ProxyServer) Start() (err error) {
// l means local, r means remote
log.Debug("Join two connections, (l[%s] r[%s]) (l[%s] r[%s])", workConn.GetLocalAddr(), workConn.GetRemoteAddr(),
userConn.GetLocalAddr(), userConn.GetRemoteAddr())
// go conn.Join(workConn, userConn)
go conn.JoinMore(userConn, workConn, p.Passwd)
if p.UseEncryption {
go conn.JoinMore(userConn, workConn, p.Passwd)
} else {
go conn.Join(userConn, workConn)
}
}
}()