Skip to content

Commit

Permalink
Signed-off-by: arraykeys@gmail.com <arraykeys@gmail.com>
Browse files Browse the repository at this point in the history
  • Loading branch information
snail007 committed Jun 6, 2018
1 parent e185d73 commit 504de47
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
proxy更新日志
v4.9
1.修复了HTTP Basic代理返回不合适的头部,导致浏览器不会弹框,个别代理插件无法认证的问题.
2.mux内网穿透切换smux到yamux.
2.内网穿透切换smux到yamux.


v4.8
Expand Down
14 changes: 9 additions & 5 deletions services/tunnel_bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import (
"fmt"
logger "log"
"net"
"os"
"strconv"
"time"

"github.com/snail007/goproxy/utils"

"github.com/xtaci/smux"
//"github.com/xtaci/smux"
smux "github.com/hashicorp/yamux"
)

type ServerConn struct {
Expand Down Expand Up @@ -89,10 +91,12 @@ func (s *TunnelBridge) callback(inConn net.Conn) {
var err error
//s.log.Printf("connection from %s ", inConn.RemoteAddr())
sess, err := smux.Server(inConn, &smux.Config{
KeepAliveInterval: 10 * time.Second,
KeepAliveTimeout: time.Duration(*s.cfg.Timeout) * time.Second,
MaxFrameSize: 4096,
MaxReceiveBuffer: 4194304,
AcceptBacklog: 256,
EnableKeepAlive: true,
KeepAliveInterval: 9 * time.Second,
ConnectionWriteTimeout: 3 * time.Second,
MaxStreamWindowSize: 512 * 1024,
LogOutput: os.Stderr,
})
if err != nil {
s.log.Printf("new mux server conn error,ERR:%s", err)
Expand Down
14 changes: 9 additions & 5 deletions services/tunnel_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import (
"io"
logger "log"
"net"
"os"
"time"

"github.com/snail007/goproxy/utils"

"github.com/xtaci/smux"
//"github.com/xtaci/smux"
smux "github.com/hashicorp/yamux"
)

type TunnelClient struct {
Expand Down Expand Up @@ -139,10 +141,12 @@ func (s *TunnelClient) GetConn() (conn net.Conn, err error) {
if err == nil {
conn = net.Conn(&_conn)
c, e := smux.Client(conn, &smux.Config{
KeepAliveInterval: 10 * time.Second,
KeepAliveTimeout: time.Duration(*s.cfg.Timeout) * time.Second,
MaxFrameSize: 4096,
MaxReceiveBuffer: 4194304,
AcceptBacklog: 256,
EnableKeepAlive: true,
KeepAliveInterval: 9 * time.Second,
ConnectionWriteTimeout: 3 * time.Second,
MaxStreamWindowSize: 512 * 1024,
LogOutput: os.Stderr,
})
if e != nil {
s.log.Printf("new mux client conn error,ERR:%s", e)
Expand Down
14 changes: 9 additions & 5 deletions services/tunnel_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ import (
"io"
logger "log"
"net"
"os"
"runtime/debug"
"strconv"
"strings"
"time"

"github.com/snail007/goproxy/utils"

"github.com/xtaci/smux"
//"github.com/xtaci/smux"
smux "github.com/hashicorp/yamux"
)

type TunnelServer struct {
Expand Down Expand Up @@ -288,10 +290,12 @@ func (s *TunnelServer) GetConn() (conn net.Conn, err error) {
if err == nil {
conn = net.Conn(&_conn)
c, e := smux.Client(conn, &smux.Config{
KeepAliveInterval: 10 * time.Second,
KeepAliveTimeout: time.Duration(*s.cfg.Timeout) * time.Second,
MaxFrameSize: 4096,
MaxReceiveBuffer: 4194304,
AcceptBacklog: 256,
EnableKeepAlive: true,
KeepAliveInterval: 9 * time.Second,
ConnectionWriteTimeout: 3 * time.Second,
MaxStreamWindowSize: 512 * 1024,
LogOutput: os.Stderr,
})
if e != nil {
s.log.Printf("new mux client conn error,ERR:%s", e)
Expand Down

0 comments on commit 504de47

Please sign in to comment.