mirror of
https://github.com/XrayR-project/XrayR.git
synced 2025-06-14 16:29:59 +00:00
update: reformat newV2board serverConfig structure
This commit is contained in:
parent
b5a8f4464c
commit
40c65a86fc
@ -5,14 +5,19 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type serverConfig struct {
|
type serverConfig struct {
|
||||||
|
shadowsocks
|
||||||
|
v2ray
|
||||||
|
trojan
|
||||||
|
|
||||||
ServerPort int `json:"server_port"`
|
ServerPort int `json:"server_port"`
|
||||||
BaseConfig struct {
|
BaseConfig struct {
|
||||||
PushInterval int `json:"push_interval"`
|
PushInterval int `json:"push_interval"`
|
||||||
PullInterval int `json:"pull_interval"`
|
PullInterval int `json:"pull_interval"`
|
||||||
} `json:"base_config"`
|
} `json:"base_config"`
|
||||||
Routes []route `json:"routes"`
|
Routes []route `json:"routes"`
|
||||||
|
}
|
||||||
|
|
||||||
// shadowsocks
|
type shadowsocks struct {
|
||||||
Cipher string `json:"cipher"`
|
Cipher string `json:"cipher"`
|
||||||
Obfs string `json:"obfs"`
|
Obfs string `json:"obfs"`
|
||||||
ObfsSettings struct {
|
ObfsSettings struct {
|
||||||
@ -20,8 +25,9 @@ type serverConfig struct {
|
|||||||
Host string `json:"host"`
|
Host string `json:"host"`
|
||||||
} `json:"obfs_settings"`
|
} `json:"obfs_settings"`
|
||||||
ServerKey string `json:"server_key"`
|
ServerKey string `json:"server_key"`
|
||||||
|
}
|
||||||
|
|
||||||
// v2ray
|
type v2ray struct {
|
||||||
Network string `json:"network"`
|
Network string `json:"network"`
|
||||||
NetworkSettings struct {
|
NetworkSettings struct {
|
||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
@ -29,8 +35,9 @@ type serverConfig struct {
|
|||||||
ServiceName string `json:"serviceName"`
|
ServiceName string `json:"serviceName"`
|
||||||
} `json:"networkSettings"`
|
} `json:"networkSettings"`
|
||||||
Tls int `json:"tls"`
|
Tls int `json:"tls"`
|
||||||
|
}
|
||||||
|
|
||||||
// trojan
|
type trojan struct {
|
||||||
Host string `json:"host"`
|
Host string `json:"host"`
|
||||||
ServerName string `json:"server_name"`
|
ServerName string `json:"server_name"`
|
||||||
}
|
}
|
||||||
|
@ -171,13 +171,13 @@ func (c *Controller) checkShadowsocksPassword(password string, method string) (s
|
|||||||
if strings.Contains(c.panelType, "V2board") {
|
if strings.Contains(c.panelType, "V2board") {
|
||||||
var userKey string
|
var userKey string
|
||||||
if len(password) < 16 {
|
if len(password) < 16 {
|
||||||
return "", fmt.Errorf("shadowsocks2022 key's length must be greater than 16")
|
return "", newError("shadowsocks2022 key's length must be greater than 16").AtWarning()
|
||||||
}
|
}
|
||||||
if method == "2022-blake3-aes-128-gcm" {
|
if method == "2022-blake3-aes-128-gcm" {
|
||||||
userKey = password[:16]
|
userKey = password[:16]
|
||||||
} else {
|
} else {
|
||||||
if len(password) < 32 {
|
if len(password) < 32 {
|
||||||
return "", fmt.Errorf("shadowsocks2022 key's length must be greater than 32")
|
return "", newError("shadowsocks2022 key's length must be greater than 32").AtWarning()
|
||||||
}
|
}
|
||||||
userKey = password[:32]
|
userKey = password[:32]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user