Browse Source

json parsing rule for domain matcher

Shelikhoo 4 years ago
parent
commit
38b0f026fe
1 changed files with 6 additions and 0 deletions
  1. 6 0
      infra/conf/router.go

+ 6 - 0
infra/conf/router.go

@@ -97,6 +97,8 @@ type RouterRule struct {
 	Type        string `json:"type"`
 	Type        string `json:"type"`
 	OutboundTag string `json:"outboundTag"`
 	OutboundTag string `json:"outboundTag"`
 	BalancerTag string `json:"balancerTag"`
 	BalancerTag string `json:"balancerTag"`
+
+	DomainMatcher string `json:"domainMatcher"`
 }
 }
 
 
 func ParseIP(s string) (*router.CIDR, error) {
 func ParseIP(s string) (*router.CIDR, error) {
@@ -476,6 +478,10 @@ func parseFieldRule(msg json.RawMessage) (*router.RoutingRule, error) {
 		return nil, newError("neither outboundTag nor balancerTag is specified in routing rule")
 		return nil, newError("neither outboundTag nor balancerTag is specified in routing rule")
 	}
 	}
 
 
+	if rawFieldRule.DomainMatcher != "" {
+		rule.DomainMatcher = rawFieldRule.DomainMatcher
+	}
+
 	if rawFieldRule.Domain != nil {
 	if rawFieldRule.Domain != nil {
 		for _, domain := range *rawFieldRule.Domain {
 		for _, domain := range *rawFieldRule.Domain {
 			rules, err := parseDomainRule(domain)
 			rules, err := parseDomainRule(domain)