Errors: Add PrintRemovedFeatureError & PrintDeprecatedFeatureWarning (#3804)

This commit is contained in:
Kobe Arthur Scofield 2024-09-15 12:55:54 +08:00 committed by GitHub
parent 3fed0c773f
commit 5f0642a671
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 32 additions and 25 deletions

View file

@ -15,7 +15,6 @@ import (
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/common/strmatcher"
"github.com/xtls/xray-core/features"
"github.com/xtls/xray-core/features/dns"
)
@ -96,7 +95,7 @@ func New(ctx context.Context, config *Config) (*DNS, error) {
geoipContainer := router.GeoIPMatcherContainer{}
for _, endpoint := range config.NameServers {
features.PrintDeprecatedFeatureWarning("simple DNS server")
errors.PrintDeprecatedFeatureWarning("simple DNS server", "")
client, err := NewSimpleClient(ctx, endpoint, clientIP)
if err != nil {
return nil, errors.New("failed to create client").Base(err)

View file

@ -7,7 +7,6 @@ import (
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/strmatcher"
"github.com/xtls/xray-core/features"
"github.com/xtls/xray-core/features/dns"
)
@ -26,7 +25,7 @@ func NewStaticHosts(hosts []*Config_HostMapping, legacy map[string]*net.IPOrDoma
}
if legacy != nil {
features.PrintDeprecatedFeatureWarning("simple host mapping")
errors.PrintDeprecatedFeatureWarning("simple host mapping", "")
for domain, ip := range legacy {
matcher, err := strmatcher.Full.New(domain)