From 909cb9b27a21e8274b979a330070a4e07180cd86 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Fri, 21 Sep 2018 16:54:06 +0200 Subject: [PATCH] announce deprecated proto settings --- app/dns/hosts.go | 3 +++ app/dns/server.go | 4 ++++ functions.go | 4 ++++ proxy/socks/server.go | 3 +++ transport/config.proto | 1 + v2ray.go | 3 +++ 6 files changed, 18 insertions(+) diff --git a/app/dns/hosts.go b/app/dns/hosts.go index 0cdf1e0f3..3bc8d0873 100644 --- a/app/dns/hosts.go +++ b/app/dns/hosts.go @@ -1,6 +1,7 @@ package dns import ( + "v2ray.com/core" "v2ray.com/core/common" "v2ray.com/core/common/net" "v2ray.com/core/common/strmatcher" @@ -38,6 +39,8 @@ func NewStaticHosts(hosts []*Config_HostMapping, legacy map[string]*net.IPOrDoma } if legacy != nil { + core.PrintDeprecatedFeatureWarning("simple host mapping") + for domain, ip := range legacy { matcher, err := strmatcher.Full.New(domain) common.Must(err) diff --git a/app/dns/server.go b/app/dns/server.go index bdd029444..deb5665b8 100644 --- a/app/dns/server.go +++ b/app/dns/server.go @@ -60,6 +60,10 @@ func New(ctx context.Context, config *Config) (*Server, error) { return len(server.servers) - 1 } + if len(config.NameServers) > 0 { + core.PrintDeprecatedFeatureWarning("simple DNS server") + } + for _, destPB := range config.NameServers { addNameServer(destPB) } diff --git a/functions.go b/functions.go index feeab026d..89ef17de6 100644 --- a/functions.go +++ b/functions.go @@ -14,3 +14,7 @@ func CreateObject(v *Instance, config interface{}) (interface{}, error) { } return common.CreateObject(ctx, config) } + +func PrintDeprecatedFeatureWarning(feature string) { + newError("You are using a deprecated feature: " + feature + ". Please update your config file with latest configuration format, or update your client software.") +} diff --git a/proxy/socks/server.go b/proxy/socks/server.go index 5821b3ab6..d328ca744 100644 --- a/proxy/socks/server.go +++ b/proxy/socks/server.go @@ -37,6 +37,9 @@ func NewServer(ctx context.Context, config *ServerConfig) (*Server, error) { func (s *Server) policy() core.Policy { config := s.config p := s.v.PolicyManager().ForLevel(config.UserLevel) + if config.Timeout > 0 { + core.PrintDeprecatedFeatureWarning("Socks timeout") + } if config.Timeout > 0 && config.UserLevel == 0 { p.Timeouts.ConnectionIdle = time.Duration(config.Timeout) * time.Second } diff --git a/transport/config.proto b/transport/config.proto index 2c9030aaf..8510ff32a 100644 --- a/transport/config.proto +++ b/transport/config.proto @@ -9,6 +9,7 @@ option java_multiple_files = true; import "v2ray.com/core/transport/internet/config.proto"; // Global transport settings. This affects all type of connections that go through V2Ray. +// Deprecated. Use each settings in StreamConfig. message Config { repeated v2ray.core.transport.internet.TransportConfig transport_settings = 1; } diff --git a/v2ray.go b/v2ray.go index c6214f2d7..eb0006e05 100755 --- a/v2ray.go +++ b/v2ray.go @@ -45,6 +45,9 @@ func New(config *Config) (*Instance, error) { id: uuid.New(), } + if config.Transport != nil { + PrintDeprecatedFeatureWarning("global tranport settings") + } if err := config.Transport.Apply(); err != nil { return nil, err }