mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 09:36:34 -05:00
Fix: build routing condition for geo domain
This commit is contained in:
parent
3673ed2be8
commit
5d3915c751
@ -46,6 +46,18 @@ func (rr *RoutingRule) BuildCondition() (Condition, error) {
|
||||
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 {
|
||||
conds.Add(NewUserMatcher(rr.UserEmail))
|
||||
}
|
||||
|
@ -220,7 +220,6 @@ func init() {
|
||||
if err != nil {
|
||||
return nil, newError("unable to load geodomain").Base(err)
|
||||
}
|
||||
rule.Domain = append(rule.Domain, geo.Domain...)
|
||||
}
|
||||
}
|
||||
if v.PortList != "" {
|
||||
@ -240,6 +239,7 @@ func init() {
|
||||
rule.SourcePortList = portList.Build()
|
||||
}
|
||||
rule.Domain = v.Domain
|
||||
rule.GeoDomain = v.GeoDomain
|
||||
if v.Networks != "" {
|
||||
rule.Networks = net.ParseNetworks(v.Networks)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user