function matches(ip, pattern) {
    pattern_parts = pattern.split(",")

    for (i = 0; i < pattern_parts.length; i++) {
        try {
            subnet = ip_lib.cidrSubnet(pattern_parts[i])
            if (subnet.contains(ip)) {
                return true
            }
        } catch (err) { }
        
        try {
            if (ip_lib.isEqual(ip, pattern_parts[i])) {
                return true
            }
        } catch (err) {  }

        if (pattern_parts[i] == "*") {
            return true
        }
        if (pattern_parts[i] == ip) {
            return true
        }
    }
    return false
}
// Pattern syntax is ,-separated cidr notation
Pattern syntax is ,-separated cidr notation
Pattern syntax is - separated cidr notation
function matches(ip, pattern) {
    pattern_parts = pattern.split(",")
    for (i = 0; i < pattern_parts.length; i++) {
        try {
            subnet = ip_lib.cidrSubnet(pattern_parts[i])
            if (subnet.contains(ip)) {
                return true
            }
        } catch (err) { }
        try {
            if (ip_lib.isEqual(ip, pattern_parts[i])) {
                return true
            }
        } catch (err) {  }
        if (pattern_parts[i] == "*") {
            return true
        }
        if (pattern_parts[i] == ip) {
            return true
        }
    }
    return false
}
function matches ( ip , pattern ) { pattern_parts = pattern . split ( "," ) for ( i = 0 ; i < pattern_parts . length ; i ++ ) { try { subnet = ip_lib . cidrSubnet ( pattern_parts [ i ] ) if ( subnet . contains ( ip ) ) { return true } } catch ( err ) { } try { if ( ip_lib . isEqual ( ip , pattern_parts [ i ] ) ) { return true } } catch ( err ) { } if ( pattern_parts [ i ] == "*" ) { return true } if ( pattern_parts [ i ] == ip ) { return true } } return false }
Pattern syntax is ,-separated cidr notation
Pattern syntax is - separated cidr notation