mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-07-03 18:28:52 +00:00
Config: Add Warning for deprecated features (allowInsecure, Shadowsocks, VMess, Trojan, VLESS without flow)
Accelerate!
This commit is contained in:
@@ -50,6 +50,8 @@ type ShadowsocksServerConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v *ShadowsocksServerConfig) Build() (proto.Message, error) {
|
func (v *ShadowsocksServerConfig) Build() (proto.Message, error) {
|
||||||
|
errors.PrintDeprecatedFeatureWarning("Shadowsocks", "VLESS Encryption")
|
||||||
|
|
||||||
if C.Contains(shadowaead_2022.List, v.Cipher) {
|
if C.Contains(shadowaead_2022.List, v.Cipher) {
|
||||||
return buildShadowsocks2022(v)
|
return buildShadowsocks2022(v)
|
||||||
}
|
}
|
||||||
@@ -185,6 +187,8 @@ type ShadowsocksClientConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v *ShadowsocksClientConfig) Build() (proto.Message, error) {
|
func (v *ShadowsocksClientConfig) Build() (proto.Message, error) {
|
||||||
|
errors.PrintDeprecatedFeatureWarning("Shadowsocks", "VLESS Encryption")
|
||||||
|
|
||||||
if v.Address != nil {
|
if v.Address != nil {
|
||||||
v.Servers = []*ShadowsocksServerTarget{
|
v.Servers = []*ShadowsocksServerTarget{
|
||||||
{
|
{
|
||||||
@@ -255,7 +259,7 @@ func (v *ShadowsocksClientConfig) Build() (proto.Message, error) {
|
|||||||
ss := &protocol.ServerEndpoint{
|
ss := &protocol.ServerEndpoint{
|
||||||
Address: server.Address.Build(),
|
Address: server.Address.Build(),
|
||||||
Port: uint32(server.Port),
|
Port: uint32(server.Port),
|
||||||
User: &protocol.User{
|
User: &protocol.User{
|
||||||
Level: uint32(server.Level),
|
Level: uint32(server.Level),
|
||||||
Email: server.Email,
|
Email: server.Email,
|
||||||
Account: serial.ToTypedMessage(account),
|
Account: serial.ToTypedMessage(account),
|
||||||
|
|||||||
@@ -596,6 +596,9 @@ func (c *TLSConfig) Build() (proto.Message, error) {
|
|||||||
}
|
}
|
||||||
serverName := c.ServerName
|
serverName := c.ServerName
|
||||||
config.AllowInsecure = c.Insecure
|
config.AllowInsecure = c.Insecure
|
||||||
|
if config.AllowInsecure {
|
||||||
|
errors.PrintDeprecatedFeatureWarning("allowInsecure", "pinnedPeerCertSha256")
|
||||||
|
}
|
||||||
if len(c.ServerName) > 0 {
|
if len(c.ServerName) > 0 {
|
||||||
config.ServerName = serverName
|
config.ServerName = serverName
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ type TrojanClientConfig struct {
|
|||||||
|
|
||||||
// Build implements Buildable
|
// Build implements Buildable
|
||||||
func (c *TrojanClientConfig) Build() (proto.Message, error) {
|
func (c *TrojanClientConfig) Build() (proto.Message, error) {
|
||||||
|
errors.PrintDeprecatedFeatureWarning("Trojan", "VLESS with flow")
|
||||||
|
|
||||||
if c.Address != nil {
|
if c.Address != nil {
|
||||||
c.Servers = []*TrojanServerTarget{
|
c.Servers = []*TrojanServerTarget{
|
||||||
{
|
{
|
||||||
@@ -74,7 +76,7 @@ func (c *TrojanClientConfig) Build() (proto.Message, error) {
|
|||||||
config.Server = &protocol.ServerEndpoint{
|
config.Server = &protocol.ServerEndpoint{
|
||||||
Address: rec.Address.Build(),
|
Address: rec.Address.Build(),
|
||||||
Port: uint32(rec.Port),
|
Port: uint32(rec.Port),
|
||||||
User: &protocol.User{
|
User: &protocol.User{
|
||||||
Level: uint32(rec.Level),
|
Level: uint32(rec.Level),
|
||||||
Email: rec.Email,
|
Email: rec.Email,
|
||||||
Account: serial.ToTypedMessage(&trojan.Account{
|
Account: serial.ToTypedMessage(&trojan.Account{
|
||||||
@@ -115,6 +117,8 @@ type TrojanServerConfig struct {
|
|||||||
|
|
||||||
// Build implements Buildable
|
// Build implements Buildable
|
||||||
func (c *TrojanServerConfig) Build() (proto.Message, error) {
|
func (c *TrojanServerConfig) Build() (proto.Message, error) {
|
||||||
|
errors.PrintDeprecatedFeatureWarning("Trojan", "VLESS with flow")
|
||||||
|
|
||||||
config := &trojan.ServerConfig{
|
config := &trojan.ServerConfig{
|
||||||
Users: make([]*protocol.User, len(c.Clients)),
|
Users: make([]*protocol.User, len(c.Clients)),
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-5
@@ -42,8 +42,6 @@ func (c *VLessInboundConfig) Build() (proto.Message, error) {
|
|||||||
config := new(inbound.Config)
|
config := new(inbound.Config)
|
||||||
config.Clients = make([]*protocol.User, len(c.Clients))
|
config.Clients = make([]*protocol.User, len(c.Clients))
|
||||||
switch c.Flow {
|
switch c.Flow {
|
||||||
case vless.None:
|
|
||||||
c.Flow = ""
|
|
||||||
case "", vless.XRV:
|
case "", vless.XRV:
|
||||||
default:
|
default:
|
||||||
return nil, errors.New(`VLESS "settings.flow" doesn't support "` + c.Flow + `" in this version`)
|
return nil, errors.New(`VLESS "settings.flow" doesn't support "` + c.Flow + `" in this version`)
|
||||||
@@ -67,12 +65,13 @@ func (c *VLessInboundConfig) Build() (proto.Message, error) {
|
|||||||
switch account.Flow {
|
switch account.Flow {
|
||||||
case "":
|
case "":
|
||||||
account.Flow = c.Flow
|
account.Flow = c.Flow
|
||||||
case vless.None:
|
|
||||||
account.Flow = ""
|
|
||||||
case vless.XRV:
|
case vless.XRV:
|
||||||
default:
|
default:
|
||||||
return nil, errors.New(`VLESS clients: "flow" doesn't support "` + account.Flow + `" in this version`)
|
return nil, errors.New(`VLESS clients: "flow" doesn't support "` + account.Flow + `" in this version`)
|
||||||
}
|
}
|
||||||
|
if account.Flow == "" {
|
||||||
|
errors.PrintDeprecatedFeatureWarning("VLESS without flow", "VLESS with flow")
|
||||||
|
}
|
||||||
|
|
||||||
if len(account.Testseed) < 4 {
|
if len(account.Testseed) < 4 {
|
||||||
account.Testseed = c.Testseed
|
account.Testseed = c.Testseed
|
||||||
@@ -280,7 +279,9 @@ func (c *VLessOutboundConfig) Build() (proto.Message, error) {
|
|||||||
account.Id = u.String()
|
account.Id = u.String()
|
||||||
|
|
||||||
switch account.Flow {
|
switch account.Flow {
|
||||||
case "", vless.XRV, vless.XRV + "-udp443":
|
case "":
|
||||||
|
errors.PrintDeprecatedFeatureWarning("VLESS without flow", "VLESS with flow")
|
||||||
|
case vless.XRV, vless.XRV + "-udp443":
|
||||||
default:
|
default:
|
||||||
return nil, errors.New(`VLESS users: "flow" doesn't support "` + account.Flow + `" in this version`)
|
return nil, errors.New(`VLESS users: "flow" doesn't support "` + account.Flow + `" in this version`)
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-2
@@ -58,12 +58,14 @@ func (c *VMessDefaultConfig) Build() *inbound.DefaultConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type VMessInboundConfig struct {
|
type VMessInboundConfig struct {
|
||||||
Users []json.RawMessage `json:"clients"`
|
Users []json.RawMessage `json:"clients"`
|
||||||
Defaults *VMessDefaultConfig `json:"default"`
|
Defaults *VMessDefaultConfig `json:"default"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build implements Buildable
|
// Build implements Buildable
|
||||||
func (c *VMessInboundConfig) Build() (proto.Message, error) {
|
func (c *VMessInboundConfig) Build() (proto.Message, error) {
|
||||||
|
errors.PrintDeprecatedFeatureWarning("VMess", "VLESS Encryption")
|
||||||
|
|
||||||
config := &inbound.Config{}
|
config := &inbound.Config{}
|
||||||
|
|
||||||
if c.Defaults != nil {
|
if c.Defaults != nil {
|
||||||
@@ -113,6 +115,8 @@ type VMessOutboundConfig struct {
|
|||||||
|
|
||||||
// Build implements Buildable
|
// Build implements Buildable
|
||||||
func (c *VMessOutboundConfig) Build() (proto.Message, error) {
|
func (c *VMessOutboundConfig) Build() (proto.Message, error) {
|
||||||
|
errors.PrintDeprecatedFeatureWarning("VMess", "VLESS Encryption")
|
||||||
|
|
||||||
config := new(outbound.Config)
|
config := new(outbound.Config)
|
||||||
if c.Address != nil {
|
if c.Address != nil {
|
||||||
c.Receivers = []*VMessOutboundTarget{
|
c.Receivers = []*VMessOutboundTarget{
|
||||||
|
|||||||
Reference in New Issue
Block a user