Skip to content

Commit cd8aab9

Browse files
common/errors/feature_errors.go: Add PrintNonRemovalDeprecatedFeatureWarning() (#5567)
And #5567 (comment) --------- Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
1 parent 59dc2ce commit cd8aab9

File tree

6 files changed

+16
-19
lines changed

6 files changed

+16
-19
lines changed

common/errors/feature_errors.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,19 @@ import (
44
"context"
55
)
66

7-
// PrintMigrateFeatureInfo prints a notice of the upcoming feature migration.
8-
// Place it after the source feature related config file pharser code.
9-
// Important note: Only use this when the target migrating feature is under construction.
10-
// Important note: Even when the target migrating feature has finished its construction, this notice can still be used yet before announcing deprecation of the old feature.
7+
// PrintNonRemovalDeprecatedFeatureWarning prints a warning of the deprecated feature that won't be removed in the near future.
118
// Do not remove this function even there is no reference to it.
12-
func PrintMigrateFeatureInfo(sourceFeature string, targetFeature string) {
13-
LogInfo(context.Background(), "The feature "+sourceFeature+" will be migrated to "+targetFeature+" in the future.")
9+
func PrintNonRemovalDeprecatedFeatureWarning(sourceFeature string, targetFeature string) {
10+
LogWarning(context.Background(), "The feature "+sourceFeature+" is deprecated, not recommended for using and might be removed. Please migrate to "+targetFeature+" as soon as possible.")
1411
}
1512

1613
// PrintDeprecatedFeatureWarning prints a warning for deprecated and going to be removed feature.
1714
// Do not remove this function even there is no reference to it.
1815
func PrintDeprecatedFeatureWarning(feature string, migrateFeature string) {
1916
if len(migrateFeature) > 0 {
20-
LogWarning(context.Background(), "This feature "+feature+" is deprecated and being migrated to "+migrateFeature+". Please update your config(s) according to release note and documentation before removal.")
17+
LogWarning(context.Background(), "This feature "+feature+" is deprecated, will be removed soon and being migrated to "+migrateFeature+". Please update your config(s) according to release note and documentation before removal.")
2118
} else {
22-
LogWarning(context.Background(), "This feature "+feature+" is deprecated. Please update your config(s) according to release note and documentation before removal.")
19+
LogWarning(context.Background(), "This feature "+feature+" is deprecated and will be removed soon. Please update your config(s) according to release note and documentation before removal.")
2320
}
2421
}
2522

infra/conf/shadowsocks.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type ShadowsocksServerConfig struct {
5050
}
5151

5252
func (v *ShadowsocksServerConfig) Build() (proto.Message, error) {
53-
errors.PrintDeprecatedFeatureWarning("Shadowsocks", "VLESS Encryption")
53+
errors.PrintNonRemovalDeprecatedFeatureWarning("Shadowsocks (with no Forward Secrecy, etc.)", "VLESS Encryption")
5454

5555
if C.Contains(shadowaead_2022.List, v.Cipher) {
5656
return buildShadowsocks2022(v)
@@ -187,7 +187,7 @@ type ShadowsocksClientConfig struct {
187187
}
188188

189189
func (v *ShadowsocksClientConfig) Build() (proto.Message, error) {
190-
errors.PrintDeprecatedFeatureWarning("Shadowsocks", "VLESS Encryption")
190+
errors.PrintNonRemovalDeprecatedFeatureWarning("Shadowsocks (with no Forward Secrecy, etc.)", "VLESS Encryption")
191191

192192
if v.Address != nil {
193193
v.Servers = []*ShadowsocksServerTarget{

infra/conf/transport_internet.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -903,13 +903,13 @@ func (p TransportProtocol) Build() (string, error) {
903903
case "kcp", "mkcp":
904904
return "mkcp", nil
905905
case "grpc":
906-
errors.PrintDeprecatedFeatureWarning("gRPC transport (with unnecessary costs, etc.)", "XHTTP stream-up H2")
906+
errors.PrintNonRemovalDeprecatedFeatureWarning("gRPC transport (with unnecessary costs, etc.)", "XHTTP stream-up H2")
907907
return "grpc", nil
908908
case "ws", "websocket":
909-
errors.PrintDeprecatedFeatureWarning("WebSocket transport (with ALPN http/1.1, etc.)", "XHTTP H2 & H3")
909+
errors.PrintNonRemovalDeprecatedFeatureWarning("WebSocket transport (with ALPN http/1.1, etc.)", "XHTTP H2 & H3")
910910
return "websocket", nil
911911
case "httpupgrade":
912-
errors.PrintDeprecatedFeatureWarning("HTTPUpgrade transport (with ALPN http/1.1, etc.)", "XHTTP H2 & H3")
912+
errors.PrintNonRemovalDeprecatedFeatureWarning("HTTPUpgrade transport (with ALPN http/1.1, etc.)", "XHTTP H2 & H3")
913913
return "httpupgrade", nil
914914
case "h2", "h3", "http":
915915
return "", errors.PrintRemovedFeatureError("HTTP transport (without header padding, etc.)", "XHTTP stream-one H2 & H3")

infra/conf/trojan.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type TrojanClientConfig struct {
3939

4040
// Build implements Buildable
4141
func (c *TrojanClientConfig) Build() (proto.Message, error) {
42-
errors.PrintDeprecatedFeatureWarning("Trojan", "VLESS with flow")
42+
errors.PrintNonRemovalDeprecatedFeatureWarning("Trojan (with no Flow, etc.)", "VLESS with Flow & Seed")
4343

4444
if c.Address != nil {
4545
c.Servers = []*TrojanServerTarget{
@@ -117,7 +117,7 @@ type TrojanServerConfig struct {
117117

118118
// Build implements Buildable
119119
func (c *TrojanServerConfig) Build() (proto.Message, error) {
120-
errors.PrintDeprecatedFeatureWarning("Trojan", "VLESS with flow")
120+
errors.PrintNonRemovalDeprecatedFeatureWarning("Trojan (with no Flow, etc.)", "VLESS with Flow & Seed")
121121

122122
config := &trojan.ServerConfig{
123123
Users: make([]*protocol.User, len(c.Clients)),

infra/conf/vless.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (c *VLessInboundConfig) Build() (proto.Message, error) {
7070
return nil, errors.New(`VLESS clients: "flow" doesn't support "` + account.Flow + `" in this version`)
7171
}
7272
if account.Flow == "" {
73-
errors.PrintDeprecatedFeatureWarning("VLESS without flow", "VLESS with flow")
73+
errors.PrintNonRemovalDeprecatedFeatureWarning("VLESS (with no Flow, etc.)", "VLESS with Flow & Seed")
7474
}
7575

7676
if len(account.Testseed) < 4 {
@@ -280,7 +280,7 @@ func (c *VLessOutboundConfig) Build() (proto.Message, error) {
280280

281281
switch account.Flow {
282282
case "":
283-
errors.PrintDeprecatedFeatureWarning("VLESS without flow", "VLESS with flow")
283+
errors.PrintNonRemovalDeprecatedFeatureWarning("VLESS (with no Flow, etc.)", "VLESS with Flow & Seed")
284284
case vless.XRV, vless.XRV + "-udp443":
285285
default:
286286
return nil, errors.New(`VLESS users: "flow" doesn't support "` + account.Flow + `" in this version`)

infra/conf/vmess.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ type VMessInboundConfig struct {
6464

6565
// Build implements Buildable
6666
func (c *VMessInboundConfig) Build() (proto.Message, error) {
67-
errors.PrintDeprecatedFeatureWarning("VMess", "VLESS Encryption")
67+
errors.PrintNonRemovalDeprecatedFeatureWarning("VMess (with no Forward Secrecy, etc.)", "VLESS Encryption")
6868

6969
config := &inbound.Config{}
7070

@@ -115,7 +115,7 @@ type VMessOutboundConfig struct {
115115

116116
// Build implements Buildable
117117
func (c *VMessOutboundConfig) Build() (proto.Message, error) {
118-
errors.PrintDeprecatedFeatureWarning("VMess", "VLESS Encryption")
118+
errors.PrintNonRemovalDeprecatedFeatureWarning("VMess (with no Forward Secrecy, etc.)", "VLESS Encryption")
119119

120120
config := new(outbound.Config)
121121
if c.Address != nil {

0 commit comments

Comments
 (0)