Feature: add source ipcidr condition to rule final

This commit is contained in:
yaling888
2021-09-01 18:29:48 +08:00
parent fb836fe441
commit b904ca0bcc
4 changed files with 25 additions and 13 deletions

View File

@ -22,7 +22,7 @@ type geoipFilter struct {
func (gf *geoipFilter) Match(ip net.IP) bool {
if multiGeoIPMatcher == nil {
countryCodeCN := gf.code
countryCode := gf.code
countryCodePrivate := "private"
geoLoader, err := geodata.GetGeoDataLoader("standard")
if err != nil {
@ -30,7 +30,7 @@ func (gf *geoipFilter) Match(ip net.IP) bool {
return false
}
recordsCN, err := geoLoader.LoadGeoIP(countryCodeCN)
recordsCN, err := geoLoader.LoadGeoIP(countryCode)
if err != nil {
log.Errorln("[GeoIPFilter] LoadGeoIP error: %s", err.Error())
return false
@ -44,7 +44,7 @@ func (gf *geoipFilter) Match(ip net.IP) bool {
geoips := []*router.GeoIP{
{
CountryCode: countryCodeCN,
CountryCode: countryCode,
Cidr: recordsCN,
ReverseMatch: false,
},