Ideally, for both ASN and country matching, I'd like to write something like this:
if BANNED_ASNS.matches(request.header("x-forwarded-for")) {
return garbage("banned-asn");
}
As in, the matcher would be able to match against a set of ASNs/countries. For countries, this is doable, because I already have a StringList
type. For ASNs... I have nothing, and I'm not sure I'd like to introduce a U32List
type.
"Why not make the matcher mutable, and push the ASNs one by one?"
Because then I still have the same problem! The only loop in roto
is a while
loop, and the list of ASNs is coming from a configuration file, and... yeah. Need some kind of list there.
#iocaine