Signed-off-by: arraykeys@gmail.com <arraykeys@gmail.com>
This commit is contained in:
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user