Skip to content
13 changes: 5 additions & 8 deletions common/errors/feature_errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,19 @@ import (
"context"
)

// PrintMigrateFeatureInfo prints a notice of the upcoming feature migration.
// Place it after the source feature related config file pharser code.
// Important note: Only use this when the target migrating feature is under construction.
// 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.
// PrintNonRemovalDeprecatedFeatureWarning prints a warning of the deprecated feature that won't be removed in the near future.
// Do not remove this function even there is no reference to it.
func PrintMigrateFeatureInfo(sourceFeature string, targetFeature string) {
LogInfo(context.Background(), "The feature "+sourceFeature+" will be migrated to "+targetFeature+" in the future.")
func PrintNonRemovalDeprecatedFeatureWarning(sourceFeature string, targetFeature string) {
LogWarning(context.Background(), "The feature "+sourceFeature+" is deprecated, not recommended for using and might be removed. Please migrate to "+targetFeature+" as soon as possible.")
}

// PrintDeprecatedFeatureWarning prints a warning for deprecated and going to be removed feature.
// Do not remove this function even there is no reference to it.
func PrintDeprecatedFeatureWarning(feature string, migrateFeature string) {
if len(migrateFeature) > 0 {
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.")
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.")
} else {
LogWarning(context.Background(), "This feature "+feature+" is deprecated. Please update your config(s) according to release note and documentation before removal.")
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.")
}
}

Expand Down
4 changes: 2 additions & 2 deletions infra/conf/shadowsocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type ShadowsocksServerConfig struct {
}

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

if C.Contains(shadowaead_2022.List, v.Cipher) {
return buildShadowsocks2022(v)
Expand Down Expand Up @@ -187,7 +187,7 @@ type ShadowsocksClientConfig struct {
}

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

if v.Address != nil {
v.Servers = []*ShadowsocksServerTarget{
Expand Down
6 changes: 3 additions & 3 deletions infra/conf/transport_internet.go
Original file line number Diff line number Diff line change
Expand Up @@ -903,13 +903,13 @@ func (p TransportProtocol) Build() (string, error) {
case "kcp", "mkcp":
return "mkcp", nil
case "grpc":
errors.PrintDeprecatedFeatureWarning("gRPC transport (with unnecessary costs, etc.)", "XHTTP stream-up H2")
errors.PrintNonRemovalDeprecatedFeatureWarning("gRPC transport (with unnecessary costs, etc.)", "XHTTP stream-up H2")
return "grpc", nil
case "ws", "websocket":
errors.PrintDeprecatedFeatureWarning("WebSocket transport (with ALPN http/1.1, etc.)", "XHTTP H2 & H3")
errors.PrintNonRemovalDeprecatedFeatureWarning("WebSocket transport (with ALPN http/1.1, etc.)", "XHTTP H2 & H3")
return "websocket", nil
case "httpupgrade":
errors.PrintDeprecatedFeatureWarning("HTTPUpgrade transport (with ALPN http/1.1, etc.)", "XHTTP H2 & H3")
errors.PrintNonRemovalDeprecatedFeatureWarning("HTTPUpgrade transport (with ALPN http/1.1, etc.)", "XHTTP H2 & H3")
return "httpupgrade", nil
case "h2", "h3", "http":
return "", errors.PrintRemovedFeatureError("HTTP transport (without header padding, etc.)", "XHTTP stream-one H2 & H3")
Expand Down
4 changes: 2 additions & 2 deletions infra/conf/trojan.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type TrojanClientConfig struct {

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

if c.Address != nil {
c.Servers = []*TrojanServerTarget{
Expand Down Expand Up @@ -117,7 +117,7 @@ type TrojanServerConfig struct {

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

config := &trojan.ServerConfig{
Users: make([]*protocol.User, len(c.Clients)),
Expand Down
4 changes: 2 additions & 2 deletions infra/conf/vless.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (c *VLessInboundConfig) Build() (proto.Message, error) {
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")
errors.PrintNonRemovalDeprecatedFeatureWarning("VLESS (with no Flow, etc.)", "VLESS with Flow & Seed")
}

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

switch account.Flow {
case "":
errors.PrintDeprecatedFeatureWarning("VLESS without flow", "VLESS with flow")
errors.PrintNonRemovalDeprecatedFeatureWarning("VLESS (with no Flow, etc.)", "VLESS with Flow & Seed")
case vless.XRV, vless.XRV + "-udp443":
default:
return nil, errors.New(`VLESS users: "flow" doesn't support "` + account.Flow + `" in this version`)
Expand Down
4 changes: 2 additions & 2 deletions infra/conf/vmess.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ type VMessInboundConfig struct {

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

config := &inbound.Config{}

Expand Down Expand Up @@ -115,7 +115,7 @@ type VMessOutboundConfig struct {

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

config := new(outbound.Config)
if c.Address != nil {
Expand Down