mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 17:38:41 +00:00
Config: Remove legacy config fields again (#3782)
* Remove more lecacy fields * Patch missing bracket * Fix tests * Fix missing comma * Fix buried test bomb * Cleanup test after removed legacy test content
This commit is contained in:
parent
c90affe7db
commit
6b1bf312d7
4 changed files with 55 additions and 152 deletions
|
@ -14,11 +14,6 @@ import (
|
|||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
type RouterRulesConfig struct {
|
||||
RuleList []json.RawMessage `json:"rules"`
|
||||
DomainStrategy string `json:"domainStrategy"`
|
||||
}
|
||||
|
||||
// StrategyConfig represents a strategy config
|
||||
type StrategyConfig struct {
|
||||
Type string `json:"type"`
|
||||
|
@ -76,7 +71,6 @@ func (r *BalancingRule) Build() (*router.BalancingRule, error) {
|
|||
}
|
||||
|
||||
type RouterConfig struct {
|
||||
Settings *RouterRulesConfig `json:"settings"` // Deprecated
|
||||
RuleList []json.RawMessage `json:"rules"`
|
||||
DomainStrategy *string `json:"domainStrategy"`
|
||||
Balancers []*BalancingRule `json:"balancers"`
|
||||
|
@ -88,8 +82,6 @@ func (c *RouterConfig) getDomainStrategy() router.Config_DomainStrategy {
|
|||
ds := ""
|
||||
if c.DomainStrategy != nil {
|
||||
ds = *c.DomainStrategy
|
||||
} else if c.Settings != nil {
|
||||
ds = c.Settings.DomainStrategy
|
||||
}
|
||||
|
||||
switch strings.ToLower(ds) {
|
||||
|
@ -111,10 +103,6 @@ func (c *RouterConfig) Build() (*router.Config, error) {
|
|||
var rawRuleList []json.RawMessage
|
||||
if c != nil {
|
||||
rawRuleList = c.RuleList
|
||||
if c.Settings != nil {
|
||||
c.RuleList = append(c.RuleList, c.Settings.RuleList...)
|
||||
rawRuleList = c.RuleList
|
||||
}
|
||||
}
|
||||
|
||||
for _, rawRule := range rawRuleList {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue