1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 17:46:58 -05:00

Fix: build routing condition for geo domain

This commit is contained in:
Huang-Huang Bao 2022-05-07 02:01:05 +08:00 committed by Xiaokang Wang (Shelikhoo)
parent 3673ed2be8
commit 5d3915c751
2 changed files with 13 additions and 1 deletions

View File

@ -46,6 +46,18 @@ func (rr *RoutingRule) BuildCondition() (Condition, error) {
conds.Add(cond) conds.Add(cond)
} }
var geoDomains []*routercommon.Domain
for _, geo := range rr.GeoDomain {
geoDomains = append(geoDomains, geo.Domain...)
}
if len(geoDomains) > 0 {
cond, err := NewDomainMatcher(rr.DomainMatcher, geoDomains)
if err != nil {
return nil, newError("failed to build geo domain condition").Base(err)
}
conds.Add(cond)
}
if len(rr.UserEmail) > 0 { if len(rr.UserEmail) > 0 {
conds.Add(NewUserMatcher(rr.UserEmail)) conds.Add(NewUserMatcher(rr.UserEmail))
} }

View File

@ -220,7 +220,6 @@ func init() {
if err != nil { if err != nil {
return nil, newError("unable to load geodomain").Base(err) return nil, newError("unable to load geodomain").Base(err)
} }
rule.Domain = append(rule.Domain, geo.Domain...)
} }
} }
if v.PortList != "" { if v.PortList != "" {
@ -240,6 +239,7 @@ func init() {
rule.SourcePortList = portList.Build() rule.SourcePortList = portList.Build()
} }
rule.Domain = v.Domain rule.Domain = v.Domain
rule.GeoDomain = v.GeoDomain
if v.Networks != "" { if v.Networks != "" {
rule.Networks = net.ParseNetworks(v.Networks) rule.Networks = net.ParseNetworks(v.Networks)
} }