Fix some tests and format code (#830)

* Increase some tls test timeout

* Fix TestUserValidator

* Change all tests to VMessAEAD

Old VMess MD5 tests will be rejected and fail in 2022

* Chore: auto format code
This commit is contained in:
yuhan6665 2021-12-14 19:28:47 -05:00 committed by GitHub
parent d5a7901601
commit e93da4bd02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
77 changed files with 137 additions and 234 deletions

View File

@ -4,7 +4,6 @@ package dispatcher
import ( import (
"context" "context"
"github.com/xtls/xray-core/features/dns"
"strings" "strings"
"sync" "sync"
"time" "time"
@ -16,6 +15,7 @@ import (
"github.com/xtls/xray-core/common/protocol" "github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/core" "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/features/dns"
"github.com/xtls/xray-core/features/outbound" "github.com/xtls/xray-core/features/outbound"
"github.com/xtls/xray-core/features/policy" "github.com/xtls/xray-core/features/policy"
"github.com/xtls/xray-core/features/routing" "github.com/xtls/xray-core/features/routing"

View File

@ -6,6 +6,7 @@ import (
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/miekg/dns" "github.com/miekg/dns"
"github.com/xtls/xray-core/app/dispatcher" "github.com/xtls/xray-core/app/dispatcher"
. "github.com/xtls/xray-core/app/dns" . "github.com/xtls/xray-core/app/dns"
"github.com/xtls/xray-core/app/policy" "github.com/xtls/xray-core/app/policy"

View File

@ -1,9 +1,8 @@
package fakedns package fakedns
import ( import (
"testing"
gonet "net" gonet "net"
"testing"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"

View File

@ -4,6 +4,7 @@ import (
"testing" "testing"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
. "github.com/xtls/xray-core/app/dns" . "github.com/xtls/xray-core/app/dns"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"

View File

@ -4,9 +4,8 @@ import (
"context" "context"
"strings" "strings"
"github.com/xtls/xray-core/features/dns"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/features/dns"
"github.com/xtls/xray-core/features/dns/localdns" "github.com/xtls/xray-core/features/dns/localdns"
) )

View File

@ -5,10 +5,9 @@ import (
"testing" "testing"
"time" "time"
"github.com/xtls/xray-core/common/net"
. "github.com/xtls/xray-core/app/dns" . "github.com/xtls/xray-core/app/dns"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/features/dns" "github.com/xtls/xray-core/features/dns"
) )

View File

@ -8,6 +8,9 @@ import (
"time" "time"
"github.com/lucas-clemente/quic-go" "github.com/lucas-clemente/quic-go"
"golang.org/x/net/dns/dnsmessage"
"golang.org/x/net/http2"
"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"
@ -17,8 +20,6 @@ import (
"github.com/xtls/xray-core/common/task" "github.com/xtls/xray-core/common/task"
dns_feature "github.com/xtls/xray-core/features/dns" dns_feature "github.com/xtls/xray-core/features/dns"
"github.com/xtls/xray-core/transport/internet/tls" "github.com/xtls/xray-core/transport/internet/tls"
"golang.org/x/net/dns/dnsmessage"
"golang.org/x/net/http2"
) )
// NextProtoDQ - During connection establishment, DNS/QUIC support is indicated // NextProtoDQ - During connection establishment, DNS/QUIC support is indicated

View File

@ -6,13 +6,12 @@ import (
"testing" "testing"
"time" "time"
"github.com/xtls/xray-core/features/dns"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
. "github.com/xtls/xray-core/app/dns" . "github.com/xtls/xray-core/app/dns"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/features/dns"
) )
func TestQUICNameServer(t *testing.T) { func TestQUICNameServer(t *testing.T) {

View File

@ -2,7 +2,7 @@ package log
import ( import (
"sync" "sync"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/log" "github.com/xtls/xray-core/common/log"
) )

View File

@ -1,3 +1,4 @@
//go:build !confonly
// +build !confonly // +build !confonly
package command package command
@ -7,9 +8,9 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
core "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/app/observatory" "github.com/xtls/xray-core/app/observatory"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
core "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/features/extension" "github.com/xtls/xray-core/features/extension"
) )

View File

@ -2,7 +2,6 @@ package observatory
import ( import (
"context" "context"
"github.com/xtls/xray-core/core"
"net" "net"
"net/http" "net/http"
"net/url" "net/url"
@ -17,6 +16,7 @@ import (
"github.com/xtls/xray-core/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/common/signal/done" "github.com/xtls/xray-core/common/signal/done"
"github.com/xtls/xray-core/common/task" "github.com/xtls/xray-core/common/task"
"github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/features/extension" "github.com/xtls/xray-core/features/extension"
"github.com/xtls/xray-core/features/outbound" "github.com/xtls/xray-core/features/outbound"
"github.com/xtls/xray-core/transport/internet/tagged" "github.com/xtls/xray-core/transport/internet/tagged"

View File

@ -6,8 +6,6 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/app/proxyman" "github.com/xtls/xray-core/app/proxyman"
"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"
@ -20,6 +18,7 @@ import (
"github.com/xtls/xray-core/features/stats" "github.com/xtls/xray-core/features/stats"
"github.com/xtls/xray-core/proxy" "github.com/xtls/xray-core/proxy"
"github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/transport/internet/tcp" "github.com/xtls/xray-core/transport/internet/tcp"
"github.com/xtls/xray-core/transport/internet/udp" "github.com/xtls/xray-core/transport/internet/udp"
"github.com/xtls/xray-core/transport/pipe" "github.com/xtls/xray-core/transport/pipe"

View File

@ -3,8 +3,6 @@ package outbound
import ( import (
"context" "context"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/app/proxyman" "github.com/xtls/xray-core/app/proxyman"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/mux" "github.com/xtls/xray-core/common/mux"
@ -18,6 +16,7 @@ import (
"github.com/xtls/xray-core/proxy" "github.com/xtls/xray-core/proxy"
"github.com/xtls/xray-core/transport" "github.com/xtls/xray-core/transport"
"github.com/xtls/xray-core/transport/internet" "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/tls"
"github.com/xtls/xray-core/transport/pipe" "github.com/xtls/xray-core/transport/pipe"
) )

View File

@ -4,8 +4,6 @@ import (
"context" "context"
"testing" "testing"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/app/policy" "github.com/xtls/xray-core/app/policy"
. "github.com/xtls/xray-core/app/proxyman/outbound" . "github.com/xtls/xray-core/app/proxyman/outbound"
"github.com/xtls/xray-core/app/stats" "github.com/xtls/xray-core/app/stats"
@ -14,6 +12,7 @@ import (
core "github.com/xtls/xray-core/core" core "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/features/outbound" "github.com/xtls/xray-core/features/outbound"
"github.com/xtls/xray-core/proxy/freedom" "github.com/xtls/xray-core/proxy/freedom"
"github.com/xtls/xray-core/transport/internet/stat"
) )
func TestInterfaces(t *testing.T) { func TestInterfaces(t *testing.T) {

View File

@ -4,14 +4,13 @@ import (
"context" "context"
"testing" "testing"
"github.com/xtls/xray-core/features/dns"
"github.com/golang/mock/gomock" "github.com/golang/mock/gomock"
. "github.com/xtls/xray-core/app/router" . "github.com/xtls/xray-core/app/router"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/features/dns"
"github.com/xtls/xray-core/features/outbound" "github.com/xtls/xray-core/features/outbound"
routing_session "github.com/xtls/xray-core/features/routing/session" routing_session "github.com/xtls/xray-core/features/routing/session"
"github.com/xtls/xray-core/testing/mocks" "github.com/xtls/xray-core/testing/mocks"

View File

@ -2,10 +2,10 @@ package router
import ( import (
"context" "context"
"github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/app/observatory" "github.com/xtls/xray-core/app/observatory"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/features/extension" "github.com/xtls/xray-core/features/extension"
) )

View File

@ -7,9 +7,8 @@ import (
"io" "io"
"syscall" "syscall"
"github.com/xtls/xray-core/features/stats"
"github.com/xtls/xray-core/common/platform" "github.com/xtls/xray-core/common/platform"
"github.com/xtls/xray-core/features/stats"
) )
type allocStrategy struct { type allocStrategy struct {

View File

@ -9,7 +9,6 @@ import (
"testing" "testing"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"golang.org/x/sync/errgroup" "golang.org/x/sync/errgroup"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"

View File

@ -5,10 +5,9 @@ import (
"net" "net"
"sync" "sync"
"github.com/xtls/xray-core/features/stats"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/errors" "github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/features/stats"
) )
// BufferToBytesWriter is a Writer that writes alloc.Buffer into underlying writer. // BufferToBytesWriter is a Writer that writes alloc.Buffer into underlying writer.

View File

@ -2,6 +2,7 @@ package conf
import ( import (
"encoding/json" "encoding/json"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"github.com/xtls/xray-core/common/serial" "github.com/xtls/xray-core/common/serial"

View File

@ -209,8 +209,7 @@ func TestUserParsing(t *testing.T) {
common.Must(json.Unmarshal([]byte(`{ common.Must(json.Unmarshal([]byte(`{
"id": "96edb838-6d68-42ef-a933-25f7ac3a9d09", "id": "96edb838-6d68-42ef-a933-25f7ac3a9d09",
"email": "love@example.com", "email": "love@example.com",
"level": 1, "level": 1
"alterId": 100
}`), user)) }`), user))
nUser := user.Build() nUser := user.Build()

View File

@ -68,10 +68,10 @@ func (FakeDNSPostProcessingStage) Process(config *Config) error {
} }
switch strings.ToLower(config.DNSConfig.QueryStrategy) { switch strings.ToLower(config.DNSConfig.QueryStrategy) {
case "useip4", "useipv4", "use_ip4", "use_ipv4", "use_ip_v4", "use-ip4", "use-ipv4", "use-ip-v4": case "useip4", "useipv4", "use_ip4", "use_ipv4", "use_ip_v4", "use-ip4", "use-ipv4", "use-ip-v4":
isIPv4Enable, isIPv6Enable = true, false isIPv4Enable, isIPv6Enable = true, false
case "useip6", "useipv6", "use_ip6", "use_ipv6", "use_ip_v6", "use-ip6", "use-ipv6", "use-ip-v6": case "useip6", "useipv6", "use_ip6", "use_ipv6", "use_ip_v6", "use-ip6", "use-ipv6", "use-ip-v6":
isIPv4Enable, isIPv6Enable = false, true isIPv4Enable, isIPv6Enable = false, true
} }
} }

View File

@ -47,8 +47,7 @@ func TestVMessOutbound(t *testing.T) {
Email: "love@example.com", Email: "love@example.com",
Level: 255, Level: 255,
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: "e641f5ad-9397-41e3-bf1a-e8740dfed019", Id: "e641f5ad-9397-41e3-bf1a-e8740dfed019",
AlterId: 0,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AUTO, Type: protocol.SecurityType_AUTO,
}, },
@ -74,14 +73,12 @@ func TestVMessInbound(t *testing.T) {
{ {
"id": "27848739-7e62-4138-9fd3-098a63964b6b", "id": "27848739-7e62-4138-9fd3-098a63964b6b",
"level": 0, "level": 0,
"alterId": 16,
"email": "love@example.com", "email": "love@example.com",
"security": "aes-128-gcm" "security": "aes-128-gcm"
} }
], ],
"default": { "default": {
"level": 0, "level": 0
"alterId": 32
}, },
"detour": { "detour": {
"to": "tag_to_detour" "to": "tag_to_detour"
@ -95,8 +92,7 @@ func TestVMessInbound(t *testing.T) {
Level: 0, Level: 0,
Email: "love@example.com", Email: "love@example.com",
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: "27848739-7e62-4138-9fd3-098a63964b6b", Id: "27848739-7e62-4138-9fd3-098a63964b6b",
AlterId: 16,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM, Type: protocol.SecurityType_AES128_GCM,
}, },
@ -104,8 +100,7 @@ func TestVMessInbound(t *testing.T) {
}, },
}, },
Default: &inbound.DefaultConfig{ Default: &inbound.DefaultConfig{
Level: 0, Level: 0,
AlterId: 32,
}, },
Detour: &inbound.DetourConfig{ Detour: &inbound.DetourConfig{
To: "tag_to_detour", To: "tag_to_detour",

View File

@ -11,9 +11,8 @@ import (
"github.com/xtls/xray-core/app/proxyman" "github.com/xtls/xray-core/app/proxyman"
"github.com/xtls/xray-core/app/stats" "github.com/xtls/xray-core/app/stats"
"github.com/xtls/xray-core/common/serial" "github.com/xtls/xray-core/common/serial"
"github.com/xtls/xray-core/transport/internet"
core "github.com/xtls/xray-core/core" core "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/xtls" "github.com/xtls/xray-core/transport/internet/xtls"
) )

View File

@ -72,7 +72,6 @@ func TestXrayConfig(t *testing.T) {
"settings": { "settings": {
"clients": [ "clients": [
{ {
"alterId": 100,
"security": "aes-128-gcm", "security": "aes-128-gcm",
"id": "0cdf8a45-303d-4fed-9780-29aa7f54175e" "id": "0cdf8a45-303d-4fed-9780-29aa7f54175e"
} }
@ -102,7 +101,6 @@ func TestXrayConfig(t *testing.T) {
"settings": { "settings": {
"clients": [ "clients": [
{ {
"alterId": 100,
"security": "aes-128-gcm", "security": "aes-128-gcm",
"id": "0cdf8a45-303d-4fed-9780-29aa7f54175e" "id": "0cdf8a45-303d-4fed-9780-29aa7f54175e"
} }
@ -266,8 +264,7 @@ func TestXrayConfig(t *testing.T) {
{ {
Level: 0, Level: 0,
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: "0cdf8a45-303d-4fed-9780-29aa7f54175e", Id: "0cdf8a45-303d-4fed-9780-29aa7f54175e",
AlterId: 100,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM, Type: protocol.SecurityType_AES128_GCM,
}, },
@ -322,8 +319,7 @@ func TestXrayConfig(t *testing.T) {
{ {
Level: 0, Level: 0,
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: "0cdf8a45-303d-4fed-9780-29aa7f54175e", Id: "0cdf8a45-303d-4fed-9780-29aa7f54175e",
AlterId: 100,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM, Type: protocol.SecurityType_AES128_GCM,
}, },

View File

@ -6,8 +6,6 @@ import (
"sync" "sync"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"golang.org/x/net/dns/dnsmessage" "golang.org/x/net/dns/dnsmessage"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
@ -22,6 +20,7 @@ import (
"github.com/xtls/xray-core/features/policy" "github.com/xtls/xray-core/features/policy"
"github.com/xtls/xray-core/transport" "github.com/xtls/xray-core/transport"
"github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/stat"
) )
func init() { func init() {

View File

@ -7,8 +7,6 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"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/log" "github.com/xtls/xray-core/common/log"
@ -20,6 +18,7 @@ import (
"github.com/xtls/xray-core/core" "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/features/policy" "github.com/xtls/xray-core/features/policy"
"github.com/xtls/xray-core/features/routing" "github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/transport/internet/stat"
) )
func init() { func init() {

View File

@ -6,8 +6,6 @@ import (
"context" "context"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"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/dice" "github.com/xtls/xray-core/common/dice"
@ -22,6 +20,7 @@ import (
"github.com/xtls/xray-core/features/stats" "github.com/xtls/xray-core/features/stats"
"github.com/xtls/xray-core/transport" "github.com/xtls/xray-core/transport"
"github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/stat"
) )
func init() { func init() {

View File

@ -9,8 +9,6 @@ import (
"net/url" "net/url"
"sync" "sync"
"github.com/xtls/xray-core/transport/internet/stat"
"golang.org/x/net/http2" "golang.org/x/net/http2"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
@ -26,6 +24,7 @@ import (
"github.com/xtls/xray-core/features/policy" "github.com/xtls/xray-core/features/policy"
"github.com/xtls/xray-core/transport" "github.com/xtls/xray-core/transport"
"github.com/xtls/xray-core/transport/internet" "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/tls"
) )

View File

@ -9,8 +9,6 @@ import (
"strings" "strings"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"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/errors" "github.com/xtls/xray-core/common/errors"
@ -24,6 +22,7 @@ import (
"github.com/xtls/xray-core/core" "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/features/policy" "github.com/xtls/xray-core/features/policy"
"github.com/xtls/xray-core/features/routing" "github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/transport/internet/stat"
) )
// Server is an HTTP proxy server. // Server is an HTTP proxy server.

View File

@ -2,11 +2,11 @@ package loopback
import ( import (
"context" "context"
"github.com/xtls/xray-core/common/net/cnc"
"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"
"github.com/xtls/xray-core/common/net/cnc"
"github.com/xtls/xray-core/common/retry" "github.com/xtls/xray-core/common/retry"
"github.com/xtls/xray-core/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/common/task" "github.com/xtls/xray-core/common/task"

View File

@ -5,8 +5,6 @@ import (
"context" "context"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"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/crypto" "github.com/xtls/xray-core/common/crypto"
@ -18,6 +16,7 @@ import (
"github.com/xtls/xray-core/core" "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/features/policy" "github.com/xtls/xray-core/features/policy"
"github.com/xtls/xray-core/features/routing" "github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/transport/internet/stat"
) )
var dcList = []net.Address{ var dcList = []net.Address{

View File

@ -8,13 +8,12 @@ package proxy
import ( import (
"context" "context"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/protocol" "github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/features/routing" "github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/transport" "github.com/xtls/xray-core/transport"
"github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/stat"
) )
// An Inbound processes inbound connections. // An Inbound processes inbound connections.

View File

@ -4,8 +4,6 @@ import (
"context" "context"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"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"
@ -18,6 +16,7 @@ import (
"github.com/xtls/xray-core/features/policy" "github.com/xtls/xray-core/features/policy"
"github.com/xtls/xray-core/transport" "github.com/xtls/xray-core/transport"
"github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/stat"
) )
// Client is a inbound handler for Shadowsocks protocol // Client is a inbound handler for Shadowsocks protocol

View File

@ -4,8 +4,6 @@ import (
"context" "context"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"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/log" "github.com/xtls/xray-core/common/log"
@ -18,6 +16,7 @@ import (
"github.com/xtls/xray-core/core" "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/features/policy" "github.com/xtls/xray-core/features/policy"
"github.com/xtls/xray-core/features/routing" "github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/transport/internet/udp" "github.com/xtls/xray-core/transport/internet/udp"
) )

View File

@ -4,8 +4,6 @@ import (
"context" "context"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"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"
@ -19,6 +17,7 @@ import (
"github.com/xtls/xray-core/features/policy" "github.com/xtls/xray-core/features/policy"
"github.com/xtls/xray-core/transport" "github.com/xtls/xray-core/transport"
"github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/stat"
) )
// Client is a Socks5 client. // Client is a Socks5 client.

View File

@ -5,8 +5,6 @@ import (
"io" "io"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"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/log" "github.com/xtls/xray-core/common/log"
@ -20,6 +18,7 @@ import (
"github.com/xtls/xray-core/features" "github.com/xtls/xray-core/features"
"github.com/xtls/xray-core/features/policy" "github.com/xtls/xray-core/features/policy"
"github.com/xtls/xray-core/features/routing" "github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/transport/internet/udp" "github.com/xtls/xray-core/transport/internet/udp"
) )

View File

@ -5,8 +5,6 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"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/errors" "github.com/xtls/xray-core/common/errors"
@ -22,6 +20,7 @@ import (
"github.com/xtls/xray-core/features/stats" "github.com/xtls/xray-core/features/stats"
"github.com/xtls/xray-core/transport" "github.com/xtls/xray-core/transport"
"github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/transport/internet/xtls" "github.com/xtls/xray-core/transport/internet/xtls"
) )

View File

@ -8,8 +8,6 @@ import (
"runtime" "runtime"
"syscall" "syscall"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/errors" "github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
@ -17,6 +15,7 @@ import (
"github.com/xtls/xray-core/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/common/signal" "github.com/xtls/xray-core/common/signal"
"github.com/xtls/xray-core/features/stats" "github.com/xtls/xray-core/features/stats"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/transport/internet/xtls" "github.com/xtls/xray-core/transport/internet/xtls"
) )

View File

@ -8,8 +8,6 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"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/errors" "github.com/xtls/xray-core/common/errors"
@ -26,6 +24,7 @@ import (
"github.com/xtls/xray-core/features/policy" "github.com/xtls/xray-core/features/policy"
"github.com/xtls/xray-core/features/routing" "github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/features/stats" "github.com/xtls/xray-core/features/stats"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/transport/internet/tls" "github.com/xtls/xray-core/transport/internet/tls"
"github.com/xtls/xray-core/transport/internet/udp" "github.com/xtls/xray-core/transport/internet/udp"
"github.com/xtls/xray-core/transport/internet/xtls" "github.com/xtls/xray-core/transport/internet/xtls"

View File

@ -9,8 +9,6 @@ import (
"runtime" "runtime"
"syscall" "syscall"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/errors" "github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
@ -19,6 +17,7 @@ import (
"github.com/xtls/xray-core/common/signal" "github.com/xtls/xray-core/common/signal"
"github.com/xtls/xray-core/features/stats" "github.com/xtls/xray-core/features/stats"
"github.com/xtls/xray-core/proxy/vless" "github.com/xtls/xray-core/proxy/vless"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/transport/internet/xtls" "github.com/xtls/xray-core/transport/internet/xtls"
) )

View File

@ -10,8 +10,6 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"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/errors" "github.com/xtls/xray-core/common/errors"
@ -31,6 +29,7 @@ import (
"github.com/xtls/xray-core/features/stats" "github.com/xtls/xray-core/features/stats"
"github.com/xtls/xray-core/proxy/vless" "github.com/xtls/xray-core/proxy/vless"
"github.com/xtls/xray-core/proxy/vless/encoding" "github.com/xtls/xray-core/proxy/vless/encoding"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/transport/internet/tls" "github.com/xtls/xray-core/transport/internet/tls"
"github.com/xtls/xray-core/transport/internet/xtls" "github.com/xtls/xray-core/transport/internet/xtls"
) )

View File

@ -7,8 +7,6 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"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"
@ -26,6 +24,7 @@ import (
"github.com/xtls/xray-core/proxy/vless/encoding" "github.com/xtls/xray-core/proxy/vless/encoding"
"github.com/xtls/xray-core/transport" "github.com/xtls/xray-core/transport"
"github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/transport/internet/xtls" "github.com/xtls/xray-core/transport/internet/xtls"
) )

View File

@ -5,11 +5,10 @@ import (
"encoding/binary" "encoding/binary"
"hash/fnv" "hash/fnv"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/crypto"
"golang.org/x/crypto/sha3" "golang.org/x/crypto/sha3"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/crypto"
) )
// Authenticate authenticates a byte array using Fnv hash. // Authenticate authenticates a byte array using Fnv hash.

View File

@ -28,8 +28,7 @@ func TestRequestSerialization(t *testing.T) {
} }
id := uuid.New() id := uuid.New()
account := &vmess.Account{ account := &vmess.Account{
Id: id.String(), Id: id.String(),
AlterId: 0,
} }
user.Account = toAccount(account) user.Account = toAccount(account)
@ -78,8 +77,7 @@ func TestInvalidRequest(t *testing.T) {
} }
id := uuid.New() id := uuid.New()
account := &vmess.Account{ account := &vmess.Account{
Id: id.String(), Id: id.String(),
AlterId: 0,
} }
user.Account = toAccount(account) user.Account = toAccount(account)
@ -120,8 +118,7 @@ func TestMuxRequest(t *testing.T) {
} }
id := uuid.New() id := uuid.New()
account := &vmess.Account{ account := &vmess.Account{
Id: id.String(), Id: id.String(),
AlterId: 0,
} }
user.Account = toAccount(account) user.Account = toAccount(account)

View File

@ -9,8 +9,6 @@ import (
"sync" "sync"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"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/errors" "github.com/xtls/xray-core/common/errors"
@ -28,6 +26,7 @@ import (
"github.com/xtls/xray-core/features/routing" "github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/proxy/vmess" "github.com/xtls/xray-core/proxy/vmess"
"github.com/xtls/xray-core/proxy/vmess/encoding" "github.com/xtls/xray-core/proxy/vmess/encoding"
"github.com/xtls/xray-core/transport/internet/stat"
) )
var ( var (

View File

@ -9,8 +9,6 @@ import (
"hash/crc64" "hash/crc64"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"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"
@ -27,6 +25,7 @@ import (
"github.com/xtls/xray-core/proxy/vmess/encoding" "github.com/xtls/xray-core/proxy/vmess/encoding"
"github.com/xtls/xray-core/transport" "github.com/xtls/xray-core/transport"
"github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/stat"
) )
// Handler is an outbound connection handler for VMess protocol. // Handler is an outbound connection handler for VMess protocol.

View File

@ -71,6 +71,11 @@ func NewTimedUserValidator(hasher protocol.IDHash) *TimedUserValidator {
return tuv return tuv
} }
// visible for testing
func (v *TimedUserValidator) GetBaseTime() protocol.Timestamp {
return v.baseTime
}
func (v *TimedUserValidator) generateNewHashes(nowSec protocol.Timestamp, user *user) { func (v *TimedUserValidator) generateNewHashes(nowSec protocol.Timestamp, user *user) {
var hashValue [16]byte var hashValue [16]byte
genEndSec := nowSec + cacheDurationSec genEndSec := nowSec + cacheDurationSec

View File

@ -2,7 +2,6 @@ package vmess_test
import ( import (
"testing" "testing"
"time"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/protocol" "github.com/xtls/xray-core/common/protocol"
@ -26,15 +25,14 @@ func TestUserValidator(t *testing.T) {
user := &protocol.MemoryUser{ user := &protocol.MemoryUser{
Email: "test", Email: "test",
Account: toAccount(&Account{ Account: toAccount(&Account{
Id: id.String(), Id: id.String(),
AlterId: 8,
}), }),
} }
common.Must(v.Add(user)) common.Must(v.Add(user))
{ {
testSmallLag := func(lag time.Duration) { testSmallLag := func(lag int64) {
ts := protocol.Timestamp(time.Now().Add(time.Second * lag).Unix()) ts := int64(v.GetBaseTime()) + lag + 240
idHash := hasher(id.Bytes()) idHash := hasher(id.Bytes())
common.Must2(serial.WriteUint64(idHash, uint64(ts))) common.Must2(serial.WriteUint64(idHash, uint64(ts)))
userHash := idHash.Sum(nil) userHash := idHash.Sum(nil)
@ -46,7 +44,7 @@ func TestUserValidator(t *testing.T) {
if euser.Email != user.Email { if euser.Email != user.Email {
t.Error("unexpected user email: ", euser.Email, " want ", user.Email) t.Error("unexpected user email: ", euser.Email, " want ", user.Email)
} }
if ets != ts { if int64(ets) != ts {
t.Error("unexpected timestamp: ", ets, " want ", ts) t.Error("unexpected timestamp: ", ets, " want ", ts)
} }
} }
@ -61,8 +59,8 @@ func TestUserValidator(t *testing.T) {
} }
{ {
testBigLag := func(lag time.Duration) { testBigLag := func(lag int64) {
ts := protocol.Timestamp(time.Now().Add(time.Second * lag).Unix()) ts := int64(v.GetBaseTime()) + lag + 240
idHash := hasher(id.Bytes()) idHash := hasher(id.Bytes())
common.Must2(serial.WriteUint64(idHash, uint64(ts))) common.Must2(serial.WriteUint64(idHash, uint64(ts)))
userHash := idHash.Sum(nil) userHash := idHash.Sum(nil)
@ -99,8 +97,7 @@ func BenchmarkUserValidator(b *testing.B) {
v.Add(&protocol.MemoryUser{ v.Add(&protocol.MemoryUser{
Email: "test", Email: "test",
Account: toAccount(&Account{ Account: toAccount(&Account{
Id: id.String(), Id: id.String(),
AlterId: 16,
}), }),
}) })
} }

View File

@ -181,8 +181,7 @@ func TestCommanderAddRemoveUser(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: u1.String(), Id: u1.String(),
AlterId: 64,
}), }),
}, },
}, },
@ -248,8 +247,7 @@ func TestCommanderAddRemoveUser(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: u2.String(), Id: u2.String(),
AlterId: 64,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM, Type: protocol.SecurityType_AES128_GCM,
}, },
@ -285,8 +283,7 @@ func TestCommanderAddRemoveUser(t *testing.T) {
User: &protocol.User{ User: &protocol.User{
Email: "test@example.com", Email: "test@example.com",
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: u2.String(), Id: u2.String(),
AlterId: 64,
}), }),
}, },
}), }),
@ -376,8 +373,7 @@ func TestCommanderStats(t *testing.T) {
Level: 1, Level: 1,
Email: "test", Email: "test",
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
}), }),
}, },
}, },
@ -432,8 +428,7 @@ func TestCommanderStats(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM, Type: protocol.SecurityType_AES128_GCM,
}, },

View File

@ -673,8 +673,7 @@ func TestDialXray(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
}), }),
}, },
}, },
@ -705,8 +704,7 @@ func TestDialXray(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM, Type: protocol.SecurityType_AES128_GCM,
}, },

View File

@ -76,8 +76,7 @@ func TestVMessClosing(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
}), }),
}, },
}, },
@ -130,8 +129,7 @@ func TestVMessClosing(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM, Type: protocol.SecurityType_AES128_GCM,
}, },
@ -190,8 +188,7 @@ func TestZeroBuffer(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
}), }),
}, },
}, },
@ -238,8 +235,7 @@ func TestZeroBuffer(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM, Type: protocol.SecurityType_AES128_GCM,
}, },

View File

@ -93,8 +93,7 @@ func TestReverseProxy(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
}), }),
}, },
}, },
@ -168,8 +167,7 @@ func TestReverseProxy(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM, Type: protocol.SecurityType_AES128_GCM,
}, },
@ -278,8 +276,7 @@ func TestReverseProxyLongRunning(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
}), }),
}, },
}, },
@ -367,8 +364,7 @@ func TestReverseProxyLongRunning(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM, Type: protocol.SecurityType_AES128_GCM,
}, },

View File

@ -125,7 +125,7 @@ func TestSimpleTLSConnection(t *testing.T) {
common.Must(err) common.Must(err)
defer CloseAllServers(servers) defer CloseAllServers(servers)
if err := testTCPConn(clientPort, 1024, time.Second*2)(); err != nil { if err := testTCPConn(clientPort, 1024, time.Second*20)(); err != nil {
t.Fatal(err) t.Fatal(err)
} }
} }
@ -247,7 +247,7 @@ func TestAutoIssuingCertificate(t *testing.T) {
defer CloseAllServers(servers) defer CloseAllServers(servers)
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
if err := testTCPConn(clientPort, 1024, time.Second*2)(); err != nil { if err := testTCPConn(clientPort, 1024, time.Second*20)(); err != nil {
t.Error(err) t.Error(err)
} }
} }
@ -350,7 +350,7 @@ func TestTLSOverKCP(t *testing.T) {
common.Must(err) common.Must(err)
defer CloseAllServers(servers) defer CloseAllServers(servers)
if err := testTCPConn(clientPort, 1024, time.Second*2)(); err != nil { if err := testTCPConn(clientPort, 1024, time.Second*20)(); err != nil {
t.Error(err) t.Error(err)
} }
} }
@ -925,7 +925,7 @@ func TestSimpleTLSConnectionPinned(t *testing.T) {
common.Must(err) common.Must(err)
defer CloseAllServers(servers) defer CloseAllServers(servers)
if err := testTCPConn(clientPort, 1024, time.Second*2)(); err != nil { if err := testTCPConn(clientPort, 1024, time.Second*20)(); err != nil {
t.Fatal(err) t.Fatal(err)
} }
} }

View File

@ -290,8 +290,7 @@ func TestVMessQuic(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
}), }),
}, },
}, },
@ -354,8 +353,7 @@ func TestVMessQuic(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM, Type: protocol.SecurityType_AES128_GCM,
}, },

View File

@ -216,8 +216,7 @@ func TestVMessGCM(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
}), }),
}, },
}, },
@ -264,8 +263,7 @@ func TestVMessGCM(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM, Type: protocol.SecurityType_AES128_GCM,
}, },
@ -322,8 +320,7 @@ func TestVMessGCMReadv(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
}), }),
}, },
}, },
@ -370,8 +367,7 @@ func TestVMessGCMReadv(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM, Type: protocol.SecurityType_AES128_GCM,
}, },
@ -431,8 +427,7 @@ func TestVMessGCMUDP(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
}), }),
}, },
}, },
@ -479,8 +474,7 @@ func TestVMessGCMUDP(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM, Type: protocol.SecurityType_AES128_GCM,
}, },
@ -534,8 +528,7 @@ func TestVMessChacha20(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
}), }),
}, },
}, },
@ -582,8 +575,7 @@ func TestVMessChacha20(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_CHACHA20_POLY1305, Type: protocol.SecurityType_CHACHA20_POLY1305,
}, },
@ -638,8 +630,7 @@ func TestVMessNone(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
}), }),
}, },
}, },
@ -686,8 +677,7 @@ func TestVMessNone(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_NONE, Type: protocol.SecurityType_NONE,
}, },
@ -744,8 +734,7 @@ func TestVMessKCP(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
}), }),
}, },
}, },
@ -792,8 +781,7 @@ func TestVMessKCP(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM, Type: protocol.SecurityType_AES128_GCM,
}, },
@ -874,8 +862,7 @@ func TestVMessKCPLarge(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
}), }),
}, },
}, },
@ -922,8 +909,7 @@ func TestVMessKCPLarge(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM, Type: protocol.SecurityType_AES128_GCM,
}, },
@ -1005,8 +991,7 @@ func TestVMessGCMMux(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
}), }),
}, },
}, },
@ -1059,8 +1044,7 @@ func TestVMessGCMMux(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM, Type: protocol.SecurityType_AES128_GCM,
}, },
@ -1124,8 +1108,7 @@ func TestVMessGCMMuxUDP(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
}), }),
}, },
}, },
@ -1192,8 +1175,7 @@ func TestVMessGCMMuxUDP(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM, Type: protocol.SecurityType_AES128_GCM,
}, },
@ -1255,8 +1237,7 @@ func TestVMessZero(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
}), }),
}, },
}, },
@ -1303,8 +1284,7 @@ func TestVMessZero(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_ZERO, Type: protocol.SecurityType_ZERO,
}, },
@ -1358,8 +1338,7 @@ func TestVMessGCMLengthAuth(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
}), }),
}, },
}, },
@ -1406,8 +1385,7 @@ func TestVMessGCMLengthAuth(t *testing.T) {
User: []*protocol.User{ User: []*protocol.User{
{ {
Account: serial.ToTypedMessage(&vmess.Account{ Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(), Id: userID.String(),
AlterId: 64,
SecuritySettings: &protocol.SecurityConfig{ SecuritySettings: &protocol.SecurityConfig{
Type: protocol.SecurityType_AES128_GCM, Type: protocol.SecurityType_AES128_GCM,
}, },

View File

@ -5,14 +5,13 @@ import (
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/dice" "github.com/xtls/xray-core/common/dice"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/net/cnc" "github.com/xtls/xray-core/common/net/cnc"
"github.com/xtls/xray-core/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/features/dns" "github.com/xtls/xray-core/features/dns"
"github.com/xtls/xray-core/features/outbound" "github.com/xtls/xray-core/features/outbound"
"github.com/xtls/xray-core/transport" "github.com/xtls/xray-core/transport"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/transport/pipe" "github.com/xtls/xray-core/transport/pipe"
) )

View File

@ -6,11 +6,10 @@ package domainsocket
import ( import (
"context" "context"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/transport/internet" "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/tls"
"github.com/xtls/xray-core/transport/internet/xtls" "github.com/xtls/xray-core/transport/internet/xtls"
) )

View File

@ -9,14 +9,13 @@ import (
"os" "os"
"strings" "strings"
"github.com/xtls/xray-core/transport/internet/stat"
goxtls "github.com/xtls/go" goxtls "github.com/xtls/go"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/transport/internet" "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/tls"
"github.com/xtls/xray-core/transport/internet/xtls" "github.com/xtls/xray-core/transport/internet/xtls"
) )

View File

@ -8,13 +8,12 @@ import (
"runtime" "runtime"
"testing" "testing"
"github.com/xtls/xray-core/transport/internet/stat"
"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"
"github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet"
. "github.com/xtls/xray-core/transport/internet/domainsocket" . "github.com/xtls/xray-core/transport/internet/domainsocket"
"github.com/xtls/xray-core/transport/internet/stat"
) )
func TestListen(t *testing.T) { func TestListen(t *testing.T) {

View File

@ -8,8 +8,6 @@ import (
"sync" "sync"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"golang.org/x/net/http2" "golang.org/x/net/http2"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
@ -18,6 +16,7 @@ import (
"github.com/xtls/xray-core/common/net/cnc" "github.com/xtls/xray-core/common/net/cnc"
"github.com/xtls/xray-core/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/transport/internet" "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/tls"
"github.com/xtls/xray-core/transport/pipe" "github.com/xtls/xray-core/transport/pipe"
) )

View File

@ -6,8 +6,6 @@ import (
"testing" "testing"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
@ -17,6 +15,7 @@ import (
"github.com/xtls/xray-core/testing/servers/tcp" "github.com/xtls/xray-core/testing/servers/tcp"
"github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet"
. "github.com/xtls/xray-core/transport/internet/http" . "github.com/xtls/xray-core/transport/internet/http"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/transport/internet/tls" "github.com/xtls/xray-core/transport/internet/tls"
) )

View File

@ -5,13 +5,12 @@ import (
"io" "io"
"sync/atomic" "sync/atomic"
"github.com/xtls/xray-core/transport/internet/stat"
"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/dice" "github.com/xtls/xray-core/common/dice"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/transport/internet" "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/tls"
"github.com/xtls/xray-core/transport/internet/xtls" "github.com/xtls/xray-core/transport/internet/xtls"
) )

View File

@ -7,8 +7,6 @@ import (
"testing" "testing"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"golang.org/x/sync/errgroup" "golang.org/x/sync/errgroup"
@ -17,6 +15,7 @@ import (
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet"
. "github.com/xtls/xray-core/transport/internet/kcp" . "github.com/xtls/xray-core/transport/internet/kcp"
"github.com/xtls/xray-core/transport/internet/stat"
) )
func TestDialAndListen(t *testing.T) { func TestDialAndListen(t *testing.T) {

View File

@ -6,14 +6,13 @@ import (
gotls "crypto/tls" gotls "crypto/tls"
"sync" "sync"
"github.com/xtls/xray-core/transport/internet/stat"
goxtls "github.com/xtls/go" goxtls "github.com/xtls/go"
"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"
"github.com/xtls/xray-core/transport/internet" "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/tls"
"github.com/xtls/xray-core/transport/internet/udp" "github.com/xtls/xray-core/transport/internet/udp"
"github.com/xtls/xray-core/transport/internet/xtls" "github.com/xtls/xray-core/transport/internet/xtls"

View File

@ -4,9 +4,8 @@ import (
"io" "io"
"sync" "sync"
"github.com/xtls/xray-core/common/retry"
"github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/retry"
) )
type SegmentWriter interface { type SegmentWriter interface {

View File

@ -5,14 +5,13 @@ import (
"sync" "sync"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/lucas-clemente/quic-go" "github.com/lucas-clemente/quic-go"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/task" "github.com/xtls/xray-core/common/task"
"github.com/xtls/xray-core/transport/internet" "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/tls"
) )

View File

@ -6,8 +6,6 @@ import (
"testing" "testing"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
@ -20,6 +18,7 @@ import (
"github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/headers/wireguard" "github.com/xtls/xray-core/transport/internet/headers/wireguard"
"github.com/xtls/xray-core/transport/internet/quic" "github.com/xtls/xray-core/transport/internet/quic"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/transport/internet/tls" "github.com/xtls/xray-core/transport/internet/tls"
) )

View File

@ -2,11 +2,11 @@ package taggedimpl
import ( import (
"context" "context"
"github.com/xtls/xray-core/common/net/cnc"
"github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/net/cnc"
"github.com/xtls/xray-core/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/features/routing" "github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/transport/internet/tagged" "github.com/xtls/xray-core/transport/internet/tagged"
) )

View File

@ -3,12 +3,11 @@ package tcp
import ( import (
"context" "context"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/transport/internet" "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/tls"
"github.com/xtls/xray-core/transport/internet/xtls" "github.com/xtls/xray-core/transport/internet/xtls"
) )

View File

@ -6,14 +6,13 @@ import (
"strings" "strings"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
goxtls "github.com/xtls/go" goxtls "github.com/xtls/go"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/transport/internet" "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/tls"
"github.com/xtls/xray-core/transport/internet/xtls" "github.com/xtls/xray-core/transport/internet/xtls"
) )

View File

@ -7,9 +7,8 @@ import (
"syscall" "syscall"
"unsafe" "unsafe"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/transport/internet/stat"
) )
const SO_ORIGINAL_DST = 80 const SO_ORIGINAL_DST = 80

View File

@ -3,9 +3,8 @@ package internet
import ( import (
"context" "context"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/transport/internet/stat"
) )
var transportListenerCache = make(map[string]ListenFunc) var transportListenerCache = make(map[string]ListenFunc)

View File

@ -3,11 +3,10 @@ package udp
import ( import (
"context" "context"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/stat"
) )
func init() { func init() {

View File

@ -6,14 +6,13 @@ import (
"sync" "sync"
"time" "time"
"github.com/xtls/xray-core/common/signal/done"
"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"
"github.com/xtls/xray-core/common/protocol/udp" "github.com/xtls/xray-core/common/protocol/udp"
"github.com/xtls/xray-core/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/common/signal" "github.com/xtls/xray-core/common/signal"
"github.com/xtls/xray-core/common/signal/done"
"github.com/xtls/xray-core/features/routing" "github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/transport" "github.com/xtls/xray-core/transport"
) )

View File

@ -10,14 +10,13 @@ import (
"os" "os"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/transport/internet" "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/tls"
) )

View File

@ -6,12 +6,11 @@ import (
"testing" "testing"
"time" "time"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/protocol/tls/cert" "github.com/xtls/xray-core/common/protocol/tls/cert"
"github.com/xtls/xray-core/transport/internet" "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/tls"
. "github.com/xtls/xray-core/transport/internet/websocket" . "github.com/xtls/xray-core/transport/internet/websocket"
) )