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

This commit is contained in:
arraykeys@gmail.com
2018-06-06 14:44:04 +08:00
parent e185d734d0
commit 504de47999
4 changed files with 28 additions and 16 deletions

View File

@ -1,7 +1,7 @@
proxy更新日志 proxy更新日志
v4.9 v4.9
1.修复了HTTP Basic代理返回不合适的头部,导致浏览器不会弹框,个别代理插件无法认证的问题. 1.修复了HTTP Basic代理返回不合适的头部,导致浏览器不会弹框,个别代理插件无法认证的问题.
2.mux内网穿透切换smux到yamux. 2.内网穿透切换smux到yamux.
v4.8 v4.8

View File

@ -5,12 +5,14 @@ import (
"fmt" "fmt"
logger "log" logger "log"
"net" "net"
"os"
"strconv" "strconv"
"time" "time"
"github.com/snail007/goproxy/utils" "github.com/snail007/goproxy/utils"
"github.com/xtaci/smux" //"github.com/xtaci/smux"
smux "github.com/hashicorp/yamux"
) )
type ServerConn struct { type ServerConn struct {
@ -89,10 +91,12 @@ func (s *TunnelBridge) callback(inConn net.Conn) {
var err error var err error
//s.log.Printf("connection from %s ", inConn.RemoteAddr()) //s.log.Printf("connection from %s ", inConn.RemoteAddr())
sess, err := smux.Server(inConn, &smux.Config{ sess, err := smux.Server(inConn, &smux.Config{
KeepAliveInterval: 10 * time.Second, AcceptBacklog: 256,
KeepAliveTimeout: time.Duration(*s.cfg.Timeout) * time.Second, EnableKeepAlive: true,
MaxFrameSize: 4096, KeepAliveInterval: 9 * time.Second,
MaxReceiveBuffer: 4194304, ConnectionWriteTimeout: 3 * time.Second,
MaxStreamWindowSize: 512 * 1024,
LogOutput: os.Stderr,
}) })
if err != nil { if err != nil {
s.log.Printf("new mux server conn error,ERR:%s", err) s.log.Printf("new mux server conn error,ERR:%s", err)

View File

@ -6,11 +6,13 @@ import (
"io" "io"
logger "log" logger "log"
"net" "net"
"os"
"time" "time"
"github.com/snail007/goproxy/utils" "github.com/snail007/goproxy/utils"
"github.com/xtaci/smux" //"github.com/xtaci/smux"
smux "github.com/hashicorp/yamux"
) )
type TunnelClient struct { type TunnelClient struct {
@ -139,10 +141,12 @@ func (s *TunnelClient) GetConn() (conn net.Conn, err error) {
if err == nil { if err == nil {
conn = net.Conn(&_conn) conn = net.Conn(&_conn)
c, e := smux.Client(conn, &smux.Config{ c, e := smux.Client(conn, &smux.Config{
KeepAliveInterval: 10 * time.Second, AcceptBacklog: 256,
KeepAliveTimeout: time.Duration(*s.cfg.Timeout) * time.Second, EnableKeepAlive: true,
MaxFrameSize: 4096, KeepAliveInterval: 9 * time.Second,
MaxReceiveBuffer: 4194304, ConnectionWriteTimeout: 3 * time.Second,
MaxStreamWindowSize: 512 * 1024,
LogOutput: os.Stderr,
}) })
if e != nil { if e != nil {
s.log.Printf("new mux client conn error,ERR:%s", e) s.log.Printf("new mux client conn error,ERR:%s", e)

View File

@ -6,6 +6,7 @@ import (
"io" "io"
logger "log" logger "log"
"net" "net"
"os"
"runtime/debug" "runtime/debug"
"strconv" "strconv"
"strings" "strings"
@ -13,7 +14,8 @@ import (
"github.com/snail007/goproxy/utils" "github.com/snail007/goproxy/utils"
"github.com/xtaci/smux" //"github.com/xtaci/smux"
smux "github.com/hashicorp/yamux"
) )
type TunnelServer struct { type TunnelServer struct {
@ -288,10 +290,12 @@ func (s *TunnelServer) GetConn() (conn net.Conn, err error) {
if err == nil { if err == nil {
conn = net.Conn(&_conn) conn = net.Conn(&_conn)
c, e := smux.Client(conn, &smux.Config{ c, e := smux.Client(conn, &smux.Config{
KeepAliveInterval: 10 * time.Second, AcceptBacklog: 256,
KeepAliveTimeout: time.Duration(*s.cfg.Timeout) * time.Second, EnableKeepAlive: true,
MaxFrameSize: 4096, KeepAliveInterval: 9 * time.Second,
MaxReceiveBuffer: 4194304, ConnectionWriteTimeout: 3 * time.Second,
MaxStreamWindowSize: 512 * 1024,
LogOutput: os.Stderr,
}) })
if e != nil { if e != nil {
s.log.Printf("new mux client conn error,ERR:%s", e) s.log.Printf("new mux client conn error,ERR:%s", e)