Legends never die (#1725)

This commit is contained in:
yuhan6665 2023-03-04 05:39:26 -05:00 committed by GitHub
parent 4c8ee0af50
commit 9e5bc07bf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 71 additions and 1773 deletions

View file

@ -12,7 +12,6 @@ import (
"github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/transport/internet/tls"
"github.com/xtls/xray-core/transport/internet/xtls"
)
var globalConv = uint32(dice.RollUint16())
@ -87,8 +86,6 @@ func DialKCP(ctx context.Context, dest net.Destination, streamSettings *internet
if config := tls.ConfigFromStreamSettings(streamSettings); config != nil {
iConn = tls.Client(iConn, config.GetTLSConfig(tls.WithDestination(dest)))
} else if config := xtls.ConfigFromStreamSettings(streamSettings); config != nil {
iConn = xtls.Client(iConn, config.GetXTLSConfig(xtls.WithDestination(dest)))
}
return iConn, nil

View file

@ -6,7 +6,6 @@ import (
gotls "crypto/tls"
"sync"
goxtls "github.com/xtls/go"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/net"
@ -14,7 +13,6 @@ import (
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/transport/internet/tls"
"github.com/xtls/xray-core/transport/internet/udp"
"github.com/xtls/xray-core/transport/internet/xtls"
)
type ConnectionID struct {
@ -29,7 +27,6 @@ type Listener struct {
sessions map[ConnectionID]*Connection
hub *udp.Hub
tlsConfig *gotls.Config
xtlsConfig *goxtls.Config
config *Config
reader PacketReader
header internet.PacketHeader
@ -62,9 +59,6 @@ func NewListener(ctx context.Context, address net.Address, port net.Port, stream
if config := tls.ConfigFromStreamSettings(streamSettings); config != nil {
l.tlsConfig = config.GetTLSConfig()
}
if config := xtls.ConfigFromStreamSettings(streamSettings); config != nil {
l.xtlsConfig = config.GetXTLSConfig()
}
hub, err := udp.ListenUDP(ctx, address, port, streamSettings, udp.HubCapacity(1024))
if err != nil {
@ -137,8 +131,6 @@ func (l *Listener) OnReceive(payload *buf.Buffer, src net.Destination) {
var netConn stat.Connection = conn
if l.tlsConfig != nil {
netConn = tls.Server(conn, l.tlsConfig)
} else if l.xtlsConfig != nil {
netConn = xtls.Server(conn, l.xtlsConfig)
}
l.addConn(netConn)