mirror of
https://github.com/v2ray/v2ray-core.git
synced 2024-04-21 12:31:52 +00:00
@@ -210,9 +210,10 @@ func setUpHTTPTunnel(ctx context.Context, dest net.Destination, target string, u
|
||||
}
|
||||
|
||||
cachedH2Mutex.Lock()
|
||||
defer cachedH2Mutex.Unlock()
|
||||
cachedConn, cachedConnFound := cachedH2Conns[dest]
|
||||
cachedH2Mutex.Unlock()
|
||||
|
||||
if cachedConn, found := cachedH2Conns[dest]; found {
|
||||
if cachedConnFound {
|
||||
rc, cc := cachedConn.rawConn, cachedConn.h2Conn
|
||||
if cc.CanTakeNewRequest() {
|
||||
proxyConn, err := connectHTTP2(rc, cc)
|
||||
@@ -260,6 +261,7 @@ func setUpHTTPTunnel(ctx context.Context, dest net.Destination, target string, u
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cachedH2Mutex.Lock()
|
||||
if cachedH2Conns == nil {
|
||||
cachedH2Conns = make(map[net.Destination]h2Conn)
|
||||
}
|
||||
@@ -268,6 +270,7 @@ func setUpHTTPTunnel(ctx context.Context, dest net.Destination, target string, u
|
||||
rawConn: rawConn,
|
||||
h2Conn: h2clientConn,
|
||||
}
|
||||
cachedH2Mutex.Unlock()
|
||||
|
||||
return proxyConn, err
|
||||
default:
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"hash"
|
||||
"hash/fnv"
|
||||
"io"
|
||||
"os"
|
||||
vmessaead "v2ray.com/core/proxy/vmess/aead"
|
||||
|
||||
"golang.org/x/crypto/chacha20poly1305"
|
||||
@@ -62,6 +63,12 @@ func NewClientSession(idHash protocol.IDHash, ctx context.Context) *ClientSessio
|
||||
}
|
||||
}
|
||||
|
||||
if vmessAeadDisable, vmessAeadDisableFound := os.LookupEnv("V2RAY_VMESS_AEAD_DISABLED"); vmessAeadDisableFound {
|
||||
if vmessAeadDisable == "true" {
|
||||
session.isAEADRequest = false
|
||||
}
|
||||
}
|
||||
|
||||
copy(session.requestBodyKey[:], randomBytes[:16])
|
||||
copy(session.requestBodyIV[:], randomBytes[16:32])
|
||||
session.responseHeader = randomBytes[32]
|
||||
@@ -71,7 +78,7 @@ func NewClientSession(idHash protocol.IDHash, ctx context.Context) *ClientSessio
|
||||
} else {
|
||||
BodyKey := sha256.Sum256(session.requestBodyKey[:])
|
||||
copy(session.responseBodyKey[:], BodyKey[:16])
|
||||
BodyIV := sha256.Sum256(session.requestBodyKey[:])
|
||||
BodyIV := sha256.Sum256(session.requestBodyIV[:])
|
||||
copy(session.responseBodyIV[:], BodyIV[:16])
|
||||
}
|
||||
|
||||
|
||||
@@ -374,7 +374,7 @@ func (s *ServerSession) EncodeResponseHeader(header *protocol.ResponseHeader, wr
|
||||
} else {
|
||||
BodyKey := sha256.Sum256(s.requestBodyKey[:])
|
||||
copy(s.responseBodyKey[:], BodyKey[:16])
|
||||
BodyIV := sha256.Sum256(s.requestBodyKey[:])
|
||||
BodyIV := sha256.Sum256(s.requestBodyIV[:])
|
||||
copy(s.responseBodyIV[:], BodyIV[:16])
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user