Signed-off-by: arraykeys@gmail.com <arraykeys@gmail.com>

This commit is contained in:
arraykeys@gmail.com
2018-04-24 18:25:04 +08:00
parent 6b2b75bc50
commit 52a2771382
3 changed files with 18 additions and 3 deletions

View File

@ -85,7 +85,12 @@ func (s *TunnelBridge) Clean() {
func (s *TunnelBridge) callback(inConn net.Conn) { func (s *TunnelBridge) callback(inConn net.Conn) {
var err error var err error
//log.Printf("connection from %s ", inConn.RemoteAddr()) //log.Printf("connection from %s ", inConn.RemoteAddr())
sess, err := smux.Server(inConn, nil) sess, err := smux.Server(inConn, &smux.Config{
KeepAliveInterval: 10 * time.Second,
KeepAliveTimeout: time.Duration(*s.cfg.Timeout) * time.Second,
MaxFrameSize: 4096,
MaxReceiveBuffer: 4194304,
})
if err != nil { if err != nil {
log.Printf("new mux server conn error,ERR:%s", err) log.Printf("new mux server conn error,ERR:%s", err)
return return

View File

@ -135,7 +135,12 @@ func (s *TunnelClient) GetConn() (conn net.Conn, err error) {
_conn, err = utils.TlsConnectHost(*s.cfg.Parent, *s.cfg.Timeout, s.cfg.CertBytes, s.cfg.KeyBytes, nil) _conn, err = utils.TlsConnectHost(*s.cfg.Parent, *s.cfg.Timeout, s.cfg.CertBytes, s.cfg.KeyBytes, nil)
if err == nil { if err == nil {
conn = net.Conn(&_conn) conn = net.Conn(&_conn)
c, e := smux.Client(conn, nil) c, e := smux.Client(conn, &smux.Config{
KeepAliveInterval: 10 * time.Second,
KeepAliveTimeout: time.Duration(*s.cfg.Timeout) * time.Second,
MaxFrameSize: 4096,
MaxReceiveBuffer: 4194304,
})
if e != nil { if e != nil {
log.Printf("new mux client conn error,ERR:%s", e) log.Printf("new mux client conn error,ERR:%s", e)
err = e err = e

View File

@ -282,7 +282,12 @@ func (s *TunnelServer) GetConn() (conn net.Conn, err error) {
_conn, err = utils.TlsConnectHost(*s.cfg.Parent, *s.cfg.Timeout, s.cfg.CertBytes, s.cfg.KeyBytes, nil) _conn, err = utils.TlsConnectHost(*s.cfg.Parent, *s.cfg.Timeout, s.cfg.CertBytes, s.cfg.KeyBytes, nil)
if err == nil { if err == nil {
conn = net.Conn(&_conn) conn = net.Conn(&_conn)
c, e := smux.Client(conn, nil) c, e := smux.Client(conn, &smux.Config{
KeepAliveInterval: 10 * time.Second,
KeepAliveTimeout: time.Duration(*s.cfg.Timeout) * time.Second,
MaxFrameSize: 4096,
MaxReceiveBuffer: 4194304,
})
if e != nil { if e != nil {
log.Printf("new mux client conn error,ERR:%s", e) log.Printf("new mux client conn error,ERR:%s", e)
err = e err = e