mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-22 16:41:29 +00:00
XTLS Vision checks outer TLS version (#1554)
This commit is contained in:
parent
3fb67f065a
commit
fb212905bd
|
@ -5,6 +5,7 @@ package inbound
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
gotls "crypto/tls"
|
||||||
"io"
|
"io"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -470,6 +471,9 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s
|
||||||
var t reflect.Type
|
var t reflect.Type
|
||||||
var p uintptr
|
var p uintptr
|
||||||
if tlsConn, ok := iConn.(*tls.Conn); ok {
|
if tlsConn, ok := iConn.(*tls.Conn); ok {
|
||||||
|
if tlsConn.ConnectionState().Version != gotls.VersionTLS13 {
|
||||||
|
return newError(`failed to use ` + requestAddons.Flow + `, found outer tls version `, tlsConn.ConnectionState().Version).AtWarning()
|
||||||
|
}
|
||||||
netConn = tlsConn.NetConn()
|
netConn = tlsConn.NetConn()
|
||||||
if pc, ok := netConn.(*proxyproto.Conn); ok {
|
if pc, ok := netConn.(*proxyproto.Conn); ok {
|
||||||
netConn = pc.Raw()
|
netConn = pc.Raw()
|
||||||
|
|
|
@ -5,11 +5,13 @@ package outbound
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
gotls "crypto/tls"
|
||||||
"reflect"
|
"reflect"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
utls "github.com/refraction-networking/utls"
|
||||||
"github.com/xtls/xray-core/common"
|
"github.com/xtls/xray-core/common"
|
||||||
"github.com/xtls/xray-core/common/buf"
|
"github.com/xtls/xray-core/common/buf"
|
||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
|
@ -261,6 +263,15 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
if rawConn != nil && requestAddons.Flow == vless.XRV {
|
if rawConn != nil && requestAddons.Flow == vless.XRV {
|
||||||
|
if tlsConn, ok := iConn.(*tls.Conn); ok {
|
||||||
|
if tlsConn.ConnectionState().Version != gotls.VersionTLS13 {
|
||||||
|
return newError(`failed to use ` + requestAddons.Flow + `, found outer tls version `, tlsConn.ConnectionState().Version).AtWarning()
|
||||||
|
}
|
||||||
|
} else if utlsConn, ok := iConn.(*tls.UConn); ok {
|
||||||
|
if utlsConn.ConnectionState().Version != utls.VersionTLS13 {
|
||||||
|
return newError(`failed to use ` + requestAddons.Flow + `, found outer tls version `, utlsConn.ConnectionState().Version).AtWarning()
|
||||||
|
}
|
||||||
|
}
|
||||||
var counter stats.Counter
|
var counter stats.Counter
|
||||||
if statConn != nil {
|
if statConn != nil {
|
||||||
counter = statConn.WriteCounter
|
counter = statConn.WriteCounter
|
||||||
|
|
Loading…
Reference in a new issue