mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-29 16:58:34 +00:00
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:
parent
d5a7901601
commit
e93da4bd02
77 changed files with 137 additions and 234 deletions
|
@ -2,6 +2,7 @@ package conf
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
|
||||
"github.com/xtls/xray-core/common/serial"
|
||||
|
|
|
@ -209,8 +209,7 @@ func TestUserParsing(t *testing.T) {
|
|||
common.Must(json.Unmarshal([]byte(`{
|
||||
"id": "96edb838-6d68-42ef-a933-25f7ac3a9d09",
|
||||
"email": "love@example.com",
|
||||
"level": 1,
|
||||
"alterId": 100
|
||||
"level": 1
|
||||
}`), user))
|
||||
|
||||
nUser := user.Build()
|
||||
|
|
|
@ -68,10 +68,10 @@ func (FakeDNSPostProcessingStage) Process(config *Config) error {
|
|||
}
|
||||
|
||||
switch strings.ToLower(config.DNSConfig.QueryStrategy) {
|
||||
case "useip4", "useipv4", "use_ip4", "use_ipv4", "use_ip_v4", "use-ip4", "use-ipv4", "use-ip-v4":
|
||||
isIPv4Enable, isIPv6Enable = true, false
|
||||
case "useip6", "useipv6", "use_ip6", "use_ipv6", "use_ip_v6", "use-ip6", "use-ipv6", "use-ip-v6":
|
||||
isIPv4Enable, isIPv6Enable = false, true
|
||||
case "useip4", "useipv4", "use_ip4", "use_ipv4", "use_ip_v4", "use-ip4", "use-ipv4", "use-ip-v4":
|
||||
isIPv4Enable, isIPv6Enable = true, false
|
||||
case "useip6", "useipv6", "use_ip6", "use_ipv6", "use_ip_v6", "use-ip6", "use-ipv6", "use-ip-v6":
|
||||
isIPv4Enable, isIPv6Enable = false, true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,8 +47,7 @@ func TestVMessOutbound(t *testing.T) {
|
|||
Email: "love@example.com",
|
||||
Level: 255,
|
||||
Account: serial.ToTypedMessage(&vmess.Account{
|
||||
Id: "e641f5ad-9397-41e3-bf1a-e8740dfed019",
|
||||
AlterId: 0,
|
||||
Id: "e641f5ad-9397-41e3-bf1a-e8740dfed019",
|
||||
SecuritySettings: &protocol.SecurityConfig{
|
||||
Type: protocol.SecurityType_AUTO,
|
||||
},
|
||||
|
@ -74,14 +73,12 @@ func TestVMessInbound(t *testing.T) {
|
|||
{
|
||||
"id": "27848739-7e62-4138-9fd3-098a63964b6b",
|
||||
"level": 0,
|
||||
"alterId": 16,
|
||||
"email": "love@example.com",
|
||||
"security": "aes-128-gcm"
|
||||
}
|
||||
],
|
||||
"default": {
|
||||
"level": 0,
|
||||
"alterId": 32
|
||||
"level": 0
|
||||
},
|
||||
"detour": {
|
||||
"to": "tag_to_detour"
|
||||
|
@ -95,8 +92,7 @@ func TestVMessInbound(t *testing.T) {
|
|||
Level: 0,
|
||||
Email: "love@example.com",
|
||||
Account: serial.ToTypedMessage(&vmess.Account{
|
||||
Id: "27848739-7e62-4138-9fd3-098a63964b6b",
|
||||
AlterId: 16,
|
||||
Id: "27848739-7e62-4138-9fd3-098a63964b6b",
|
||||
SecuritySettings: &protocol.SecurityConfig{
|
||||
Type: protocol.SecurityType_AES128_GCM,
|
||||
},
|
||||
|
@ -104,8 +100,7 @@ func TestVMessInbound(t *testing.T) {
|
|||
},
|
||||
},
|
||||
Default: &inbound.DefaultConfig{
|
||||
Level: 0,
|
||||
AlterId: 32,
|
||||
Level: 0,
|
||||
},
|
||||
Detour: &inbound.DetourConfig{
|
||||
To: "tag_to_detour",
|
||||
|
|
|
@ -11,9 +11,8 @@ import (
|
|||
"github.com/xtls/xray-core/app/proxyman"
|
||||
"github.com/xtls/xray-core/app/stats"
|
||||
"github.com/xtls/xray-core/common/serial"
|
||||
"github.com/xtls/xray-core/transport/internet"
|
||||
|
||||
core "github.com/xtls/xray-core/core"
|
||||
"github.com/xtls/xray-core/transport/internet"
|
||||
"github.com/xtls/xray-core/transport/internet/xtls"
|
||||
)
|
||||
|
||||
|
|
|
@ -72,7 +72,6 @@ func TestXrayConfig(t *testing.T) {
|
|||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"alterId": 100,
|
||||
"security": "aes-128-gcm",
|
||||
"id": "0cdf8a45-303d-4fed-9780-29aa7f54175e"
|
||||
}
|
||||
|
@ -102,7 +101,6 @@ func TestXrayConfig(t *testing.T) {
|
|||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"alterId": 100,
|
||||
"security": "aes-128-gcm",
|
||||
"id": "0cdf8a45-303d-4fed-9780-29aa7f54175e"
|
||||
}
|
||||
|
@ -266,8 +264,7 @@ func TestXrayConfig(t *testing.T) {
|
|||
{
|
||||
Level: 0,
|
||||
Account: serial.ToTypedMessage(&vmess.Account{
|
||||
Id: "0cdf8a45-303d-4fed-9780-29aa7f54175e",
|
||||
AlterId: 100,
|
||||
Id: "0cdf8a45-303d-4fed-9780-29aa7f54175e",
|
||||
SecuritySettings: &protocol.SecurityConfig{
|
||||
Type: protocol.SecurityType_AES128_GCM,
|
||||
},
|
||||
|
@ -322,8 +319,7 @@ func TestXrayConfig(t *testing.T) {
|
|||
{
|
||||
Level: 0,
|
||||
Account: serial.ToTypedMessage(&vmess.Account{
|
||||
Id: "0cdf8a45-303d-4fed-9780-29aa7f54175e",
|
||||
AlterId: 100,
|
||||
Id: "0cdf8a45-303d-4fed-9780-29aa7f54175e",
|
||||
SecuritySettings: &protocol.SecurityConfig{
|
||||
Type: protocol.SecurityType_AES128_GCM,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue