all: add use_gzip configure and some improvements, see #28

This commit is contained in:
fatedier
2016-06-24 13:12:34 +08:00
parent 1987a399c1
commit c5e4b24f8f
15 changed files with 337 additions and 303 deletions

View File

@@ -19,7 +19,9 @@ import (
"sync"
"time"
"frp/models/config"
"frp/models/consts"
"frp/models/msg"
"frp/utils/conn"
"frp/utils/log"
)
@@ -30,16 +32,11 @@ type Listener interface {
}
type ProxyServer struct {
Name string
AuthToken string
Type string
config.BaseConf
BindAddr string
ListenPort int64
CustomDomains []string
// configure in frpc.ini
UseEncryption int
Status int64
CtlConn *conn.Conn // control connection with frpc
listeners []Listener // accept new connection from remote users
@@ -144,7 +141,7 @@ func (p *ProxyServer) Start(c *conn.Conn) (err error) {
log.Debug("Join two connections, (l[%s] r[%s]) (l[%s] r[%s])", workConn.GetLocalAddr(), workConn.GetRemoteAddr(),
userConn.GetLocalAddr(), userConn.GetRemoteAddr())
go conn.JoinMore(userConn, workConn, p.AuthToken, p.UseEncryption)
go msg.JoinMore(userConn, workConn, p.BaseConf)
}()
}
}(listener)
@@ -186,9 +183,9 @@ func (p *ProxyServer) RegisterNewWorkConn(c *conn.Conn) {
p.workConnChan <- c
}
// when frps get one user connection, we get one work connection from the pool and return it
// if no workConn available in the pool, send message to frpc to get one or more
// and wait until it is available
// When frps get one user connection, we get one work connection from the pool and return it.
// If no workConn available in the pool, send message to frpc to get one or more
// and wait until it is available.
// return an error if wait timeout
func (p *ProxyServer) getWorkConn() (workConn *conn.Conn, err error) {
var ok bool