Skip to content

Commit 5836f36

Browse files
authored
Config: Add Warning for deprecated features (allowInsecure, Shadowsocks, VMess, Trojan, VLESS without flow)
Accelerate!
1 parent 6d6c045 commit 5836f36

File tree

5 files changed

+25
-9
lines changed

5 files changed

+25
-9
lines changed

infra/conf/shadowsocks.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ type ShadowsocksServerConfig struct {
5050
}
5151

5252
func (v *ShadowsocksServerConfig) Build() (proto.Message, error) {
53+
errors.PrintDeprecatedFeatureWarning("Shadowsocks", "VLESS Encryption")
54+
5355
if C.Contains(shadowaead_2022.List, v.Cipher) {
5456
return buildShadowsocks2022(v)
5557
}
@@ -185,6 +187,8 @@ type ShadowsocksClientConfig struct {
185187
}
186188

187189
func (v *ShadowsocksClientConfig) Build() (proto.Message, error) {
190+
errors.PrintDeprecatedFeatureWarning("Shadowsocks", "VLESS Encryption")
191+
188192
if v.Address != nil {
189193
v.Servers = []*ShadowsocksServerTarget{
190194
{
@@ -255,7 +259,7 @@ func (v *ShadowsocksClientConfig) Build() (proto.Message, error) {
255259
ss := &protocol.ServerEndpoint{
256260
Address: server.Address.Build(),
257261
Port: uint32(server.Port),
258-
User: &protocol.User{
262+
User: &protocol.User{
259263
Level: uint32(server.Level),
260264
Email: server.Email,
261265
Account: serial.ToTypedMessage(account),

infra/conf/transport_internet.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,9 @@ func (c *TLSConfig) Build() (proto.Message, error) {
596596
}
597597
serverName := c.ServerName
598598
config.AllowInsecure = c.Insecure
599+
if config.AllowInsecure {
600+
errors.PrintDeprecatedFeatureWarning("allowInsecure", "pinnedPeerCertSha256")
601+
}
599602
if len(c.ServerName) > 0 {
600603
config.ServerName = serverName
601604
}

infra/conf/trojan.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ type TrojanClientConfig struct {
3939

4040
// Build implements Buildable
4141
func (c *TrojanClientConfig) Build() (proto.Message, error) {
42+
errors.PrintDeprecatedFeatureWarning("Trojan", "VLESS with flow")
43+
4244
if c.Address != nil {
4345
c.Servers = []*TrojanServerTarget{
4446
{
@@ -74,7 +76,7 @@ func (c *TrojanClientConfig) Build() (proto.Message, error) {
7476
config.Server = &protocol.ServerEndpoint{
7577
Address: rec.Address.Build(),
7678
Port: uint32(rec.Port),
77-
User: &protocol.User{
79+
User: &protocol.User{
7880
Level: uint32(rec.Level),
7981
Email: rec.Email,
8082
Account: serial.ToTypedMessage(&trojan.Account{
@@ -115,6 +117,8 @@ type TrojanServerConfig struct {
115117

116118
// Build implements Buildable
117119
func (c *TrojanServerConfig) Build() (proto.Message, error) {
120+
errors.PrintDeprecatedFeatureWarning("Trojan", "VLESS with flow")
121+
118122
config := &trojan.ServerConfig{
119123
Users: make([]*protocol.User, len(c.Clients)),
120124
}

infra/conf/vless.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ func (c *VLessInboundConfig) Build() (proto.Message, error) {
4242
config := new(inbound.Config)
4343
config.Clients = make([]*protocol.User, len(c.Clients))
4444
switch c.Flow {
45-
case vless.None:
46-
c.Flow = ""
4745
case "", vless.XRV:
4846
default:
4947
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) {
6765
switch account.Flow {
6866
case "":
6967
account.Flow = c.Flow
70-
case vless.None:
71-
account.Flow = ""
7268
case vless.XRV:
7369
default:
7470
return nil, errors.New(`VLESS clients: "flow" doesn't support "` + account.Flow + `" in this version`)
7571
}
72+
if account.Flow == "" {
73+
errors.PrintDeprecatedFeatureWarning("VLESS without flow", "VLESS with flow")
74+
}
7675

7776
if len(account.Testseed) < 4 {
7877
account.Testseed = c.Testseed
@@ -280,7 +279,9 @@ func (c *VLessOutboundConfig) Build() (proto.Message, error) {
280279
account.Id = u.String()
281280

282281
switch account.Flow {
283-
case "", vless.XRV, vless.XRV + "-udp443":
282+
case "":
283+
errors.PrintDeprecatedFeatureWarning("VLESS without flow", "VLESS with flow")
284+
case vless.XRV, vless.XRV + "-udp443":
284285
default:
285286
return nil, errors.New(`VLESS users: "flow" doesn't support "` + account.Flow + `" in this version`)
286287
}

infra/conf/vmess.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,14 @@ func (c *VMessDefaultConfig) Build() *inbound.DefaultConfig {
5858
}
5959

6060
type VMessInboundConfig struct {
61-
Users []json.RawMessage `json:"clients"`
62-
Defaults *VMessDefaultConfig `json:"default"`
61+
Users []json.RawMessage `json:"clients"`
62+
Defaults *VMessDefaultConfig `json:"default"`
6363
}
6464

6565
// Build implements Buildable
6666
func (c *VMessInboundConfig) Build() (proto.Message, error) {
67+
errors.PrintDeprecatedFeatureWarning("VMess", "VLESS Encryption")
68+
6769
config := &inbound.Config{}
6870

6971
if c.Defaults != nil {
@@ -113,6 +115,8 @@ type VMessOutboundConfig struct {
113115

114116
// Build implements Buildable
115117
func (c *VMessOutboundConfig) Build() (proto.Message, error) {
118+
errors.PrintDeprecatedFeatureWarning("VMess", "VLESS Encryption")
119+
116120
config := new(outbound.Config)
117121
if c.Address != nil {
118122
c.Receivers = []*VMessOutboundTarget{

0 commit comments

Comments
 (0)