Merge branch 'master' into dev
This commit is contained in:
commit
4e1a70ec6d
@ -149,7 +149,9 @@ func (d *kcpDialer) initSession(ctx context.Context, addr net.Addr, conn net.Pac
|
|||||||
smuxConfig.Version = config.SmuxVer
|
smuxConfig.Version = config.SmuxVer
|
||||||
smuxConfig.MaxReceiveBuffer = config.SmuxBuf
|
smuxConfig.MaxReceiveBuffer = config.SmuxBuf
|
||||||
smuxConfig.MaxStreamBuffer = config.StreamBuf
|
smuxConfig.MaxStreamBuffer = config.StreamBuf
|
||||||
|
if config.KeepAlive > 0 {
|
||||||
smuxConfig.KeepAliveInterval = time.Duration(config.KeepAlive) * time.Second
|
smuxConfig.KeepAliveInterval = time.Duration(config.KeepAlive) * time.Second
|
||||||
|
}
|
||||||
var cc net.Conn = kcpconn
|
var cc net.Conn = kcpconn
|
||||||
if !config.NoComp {
|
if !config.NoComp {
|
||||||
cc = kcp_util.CompStreamConn(kcpconn)
|
cc = kcp_util.CompStreamConn(kcpconn)
|
||||||
|
@ -109,9 +109,10 @@ func (h *redirectHandler) Handle(ctx context.Context, conn net.Conn, opts ...han
|
|||||||
conn.SetReadDeadline(time.Time{})
|
conn.SetReadDeadline(time.Time{})
|
||||||
}
|
}
|
||||||
rw = xio.NewReadWriter(io.MultiReader(bytes.NewReader(hdr[:n]), rw), rw)
|
rw = xio.NewReadWriter(io.MultiReader(bytes.NewReader(hdr[:n]), rw), rw)
|
||||||
|
tlsVersion := binary.BigEndian.Uint16(hdr[1:3])
|
||||||
if err == nil &&
|
if err == nil &&
|
||||||
hdr[0] == dissector.Handshake &&
|
hdr[0] == dissector.Handshake &&
|
||||||
binary.BigEndian.Uint16(hdr[1:3]) == tls.VersionTLS10 {
|
(tlsVersion >= tls.VersionTLS10 && tlsVersion <= tls.VersionTLS13) {
|
||||||
return h.handleHTTPS(ctx, rw, conn.RemoteAddr(), dstAddr, log)
|
return h.handleHTTPS(ctx, rw, conn.RemoteAddr(), dstAddr, log)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,8 +90,10 @@ func (h *sniHandler) Handle(ctx context.Context, conn net.Conn, opts ...handler.
|
|||||||
}
|
}
|
||||||
|
|
||||||
rw := xio.NewReadWriter(io.MultiReader(bytes.NewReader(hdr[:]), conn), conn)
|
rw := xio.NewReadWriter(io.MultiReader(bytes.NewReader(hdr[:]), conn), conn)
|
||||||
|
|
||||||
|
tlsVersion := binary.BigEndian.Uint16(hdr[1:3])
|
||||||
if hdr[0] == dissector.Handshake &&
|
if hdr[0] == dissector.Handshake &&
|
||||||
binary.BigEndian.Uint16(hdr[1:3]) == tls.VersionTLS10 {
|
(tlsVersion >= tls.VersionTLS10 && tlsVersion <= tls.VersionTLS13) {
|
||||||
return h.handleHTTPS(ctx, rw, conn.RemoteAddr(), log)
|
return h.handleHTTPS(ctx, rw, conn.RemoteAddr(), log)
|
||||||
}
|
}
|
||||||
return h.handleHTTP(ctx, rw, conn.RemoteAddr(), log)
|
return h.handleHTTP(ctx, rw, conn.RemoteAddr(), log)
|
||||||
|
@ -21,9 +21,10 @@ func Sniffing(ctx context.Context, rdw io.ReadWriter) (rw io.ReadWriter, host st
|
|||||||
var hdr [dissector.RecordHeaderLen]byte
|
var hdr [dissector.RecordHeaderLen]byte
|
||||||
n, err := io.ReadFull(rw, hdr[:])
|
n, err := io.ReadFull(rw, hdr[:])
|
||||||
rw = xio.NewReadWriter(io.MultiReader(bytes.NewReader(hdr[:n]), rw), rw)
|
rw = xio.NewReadWriter(io.MultiReader(bytes.NewReader(hdr[:n]), rw), rw)
|
||||||
|
tlsVersion := binary.BigEndian.Uint16(hdr[1:3])
|
||||||
if err == nil &&
|
if err == nil &&
|
||||||
hdr[0] == dissector.Handshake &&
|
hdr[0] == dissector.Handshake &&
|
||||||
binary.BigEndian.Uint16(hdr[1:3]) == tls.VersionTLS10 {
|
(tlsVersion >= tls.VersionTLS10 && tlsVersion <= tls.VersionTLS13) {
|
||||||
rw, host, err = sniffSNI(ctx, rw)
|
rw, host, err = sniffSNI(ctx, rw)
|
||||||
protocol = ProtoTLS
|
protocol = ProtoTLS
|
||||||
return
|
return
|
||||||
|
@ -160,7 +160,9 @@ func (l *kcpListener) mux(conn net.Conn) {
|
|||||||
smuxConfig.Version = l.md.config.SmuxVer
|
smuxConfig.Version = l.md.config.SmuxVer
|
||||||
smuxConfig.MaxReceiveBuffer = l.md.config.SmuxBuf
|
smuxConfig.MaxReceiveBuffer = l.md.config.SmuxBuf
|
||||||
smuxConfig.MaxStreamBuffer = l.md.config.StreamBuf
|
smuxConfig.MaxStreamBuffer = l.md.config.StreamBuf
|
||||||
|
if l.md.config.KeepAlive > 0 {
|
||||||
smuxConfig.KeepAliveInterval = time.Duration(l.md.config.KeepAlive) * time.Second
|
smuxConfig.KeepAliveInterval = time.Duration(l.md.config.KeepAlive) * time.Second
|
||||||
|
}
|
||||||
|
|
||||||
if !l.md.config.NoComp {
|
if !l.md.config.NoComp {
|
||||||
conn = kcp_util.CompStreamConn(conn)
|
conn = kcp_util.CompStreamConn(conn)
|
||||||
|
Loading…
Reference in New Issue
Block a user