ezelkow1 commented on code in PR #8982:
URL: https://github.com/apache/trafficserver/pull/8982#discussion_r932618729
##########
plugins/experimental/maxmind_acl/mmdb.cc:
##########
@@ -497,6 +577,94 @@ Acl::eval(TSRemapRequestInfo *rri, TSHttpTxn txnp)
return ret;
}
+///////////////////////////////////////////////////////////////////////////////
+// Returns true if entry data contains an
+// allowable non-anonymous IP.
+// False otherwise
+bool
+Acl::eval_anonymous(MMDB_entry_s *entry)
+{
+ MMDB_entry_data_s entry_data;
+ int status;
+
+ // For each value we only care if it was successful and if there was data.
+ // We can have unsuccessful gets in the instance an IP is not one of the
things
+ // we are asking for, so its not an error
+ if (_anonymous_ip) {
+ status = MMDB_get_value(entry, &entry_data, "is_anonymous", NULL);
+ if ((MMDB_SUCCESS == status) && (entry_data.has_data)) {
+ if (entry_data.type == MMDB_DATA_TYPE_BOOLEAN) {
+ if (entry_data.boolean == true) {
+ TSDebug(PLUGIN_NAME, "saw is_anonymous set to true bool");
+ return false;
+ }
+ }
+ }
Review Comment:
yea, eventually Im planning on breaking it out more like that to make it
more generic (we have some internal ideas around custom maxmind databases so
the hope would be to basically have this be based just on a field name in the
config and could be completely arbitrary)
just wanted to get this out there for now in a working state
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]