Skip to content

Commit

Permalink
Remnents baking
Browse files Browse the repository at this point in the history
  • Loading branch information
KobeArthurScofield authored Sep 18, 2024
1 parent 5fbcd77 commit cebed7b
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 109 deletions.
10 changes: 0 additions & 10 deletions infra/conf/dokodemo.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package conf

import (
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/proxy/dokodemo"
"google.golang.org/protobuf/proto"
)
Expand All @@ -12,9 +11,6 @@ type DokodemoConfig struct {
NetworkList *NetworkList `json:"network"`
Redirect bool `json:"followRedirect"`
UserLevel uint32 `json:"userLevel"`

// Deprecated. Remove before v26.x, for feature error trigger.
TimeoutValue uint32 `json:"timeout"`
}

func (v *DokodemoConfig) Build() (proto.Message, error) {
Expand All @@ -24,12 +20,6 @@ func (v *DokodemoConfig) Build() (proto.Message, error) {
}
config.Port = uint32(v.PortValue)
config.Networks = v.NetworkList.Build()
if v.TimeoutValue > 0 { // Remove before v26.x
// After feature removal, change to PrintRemovedFeatureError, and keep it before v26.x
errors.PrintDeprecatedFeatureWarning("timeout config in dokodemo-door", "userLevel")
// Remove one line below before v25.x
config.Timeout = v.TimeoutValue
}
config.FollowRedirect = v.Redirect
config.UserLevel = v.UserLevel
return config, nil
Expand Down
8 changes: 0 additions & 8 deletions infra/conf/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,10 @@ type HTTPServerConfig struct {
Accounts []*HTTPAccount `json:"accounts"`
Transparent bool `json:"allowTransparent"`
UserLevel uint32 `json:"userLevel"`

// Deprecated. Remove before v26.x, for feature error trigger.
Timeout uint32 `json:"timeout"`
}

func (c *HTTPServerConfig) Build() (proto.Message, error) {
if c.Timeout > 0 { // Remove before v26.x
// Change this to PrintRemovedFeatureError before v25.x
errors.PrintDeprecatedFeatureWarning("Timeout config in HTTP server", "userLevel")
}
config := &http.ServerConfig{
Timeout: c.Timeout, // Remove before v25.x
AllowTransparent: c.Transparent,
UserLevel: c.UserLevel,
}
Expand Down
6 changes: 0 additions & 6 deletions infra/conf/trojan.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ type TrojanUserConfig struct {
type TrojanServerConfig struct {
Clients []*TrojanUserConfig `json:"clients"`
Fallbacks []*TrojanInboundFallback `json:"fallbacks"`

// Remove in v25.x
Fallback *TrojanInboundFallback `json:"fallback"`
}

// Build implements Buildable
Expand All @@ -120,9 +117,6 @@ func (c *TrojanServerConfig) Build() (proto.Message, error) {
}
}

if c.Fallback != nil { // Remove in v25.x
return nil, errors.PrintRemovedFeatureError(`"fallback":{} in Trojan`, `"fallbacks":[{}]`)
}
for _, fb := range c.Fallbacks {
var i uint16
var s string
Expand Down
6 changes: 0 additions & 6 deletions infra/conf/vless.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ type VLessInboundConfig struct {
Clients []json.RawMessage `json:"clients"`
Decryption string `json:"decryption"`
Fallbacks []*VLessInboundFallback `json:"fallbacks"`

// Remove in v25.x
Fallback *VLessInboundFallback `json:"fallback"`
}

// Build implements Buildable
Expand Down Expand Up @@ -76,9 +73,6 @@ func (c *VLessInboundConfig) Build() (proto.Message, error) {
}
config.Decryption = c.Decryption

if c.Fallback != nil { // Remove in v25.x
return nil, errors.PrintRemovedFeatureError(`"fallback":{} in VLESS`, `"fallbacks":[{}]`)
}
for _, fb := range c.Fallbacks {
var i uint16
var s string
Expand Down
45 changes: 15 additions & 30 deletions proxy/dokodemo/config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions proxy/dokodemo/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ message Config {
// List of networks that the Dokodemo accepts.
repeated xray.common.net.Network networks = 7;

// Deprecated and should use policy level
// Remove before v25.x
uint32 timeout = 4 [deprecated = true];
bool follow_redirect = 5;
uint32 user_level = 6;
}
4 changes: 0 additions & 4 deletions proxy/dokodemo/dokodemo.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ func (d *DokodemoDoor) Network() []net.Network {
func (d *DokodemoDoor) policy() policy.Session {
config := d.config
p := d.policyManager.ForLevel(config.UserLevel)
if config.Timeout > 0 && config.UserLevel == 0 { // Remove or change this logic before v25.x
errors.PrintDeprecatedFeatureWarning(`timeout config in dokodemo`, ``)
p.Timeouts.ConnectionIdle = time.Duration(config.Timeout) * time.Second
}
return p
}

Expand Down
58 changes: 22 additions & 36 deletions proxy/http/config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions proxy/http/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ message ServerConfig {
map<string, string> accounts = 2;
bool allow_transparent = 3;
uint32 user_level = 4;
// Deprecated, remove before v25.x
uint32 timeout = 1 [deprecated = true];
}

message Header {
Expand Down
4 changes: 0 additions & 4 deletions proxy/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ func NewServer(ctx context.Context, config *ServerConfig) (*Server, error) {
func (s *Server) policy() policy.Session {
config := s.config
p := s.policyManager.ForLevel(config.UserLevel)
if config.Timeout > 0 && config.UserLevel == 0 { // Remove this before v25.x
errors.PrintDeprecatedFeatureWarning(`timeout config in HTTP inbound`, ``)
p.Timeouts.ConnectionIdle = time.Duration(config.Timeout) * time.Second
}
return p
}

Expand Down

0 comments on commit cebed7b

Please sign in to comment.