From 38b0f026feabe1bc7618bda92e42c7ffad29d6f7 Mon Sep 17 00:00:00 2001 From: Shelikhoo Date: Wed, 3 Mar 2021 22:35:55 +0000 Subject: [PATCH] json parsing rule for domain matcher --- infra/conf/router.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/infra/conf/router.go b/infra/conf/router.go index ae23ece6e..b7b892c47 100644 --- a/infra/conf/router.go +++ b/infra/conf/router.go @@ -97,6 +97,8 @@ type RouterRule struct { Type string `json:"type"` OutboundTag string `json:"outboundTag"` BalancerTag string `json:"balancerTag"` + + DomainMatcher string `json:"domainMatcher"` } 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") } + if rawFieldRule.DomainMatcher != "" { + rule.DomainMatcher = rawFieldRule.DomainMatcher + } + if rawFieldRule.Domain != nil { for _, domain := range *rawFieldRule.Domain { rules, err := parseDomainRule(domain)