How do you restrict access to a Meteor site based on IP


I would like to restrict access to my site based on the IP address of the client. For example, if an user’s IP address has had past transgressions on my site, I want to effectively block it.

I know how to access the IP address in Meteor Methods (ip = this.connection.clientAddress;), but now I want to know how I can block it from access.


Something like this?

// Server.js
Meteor.onConnection(function (connection) {
  // Check if connected client has their IP banned
  if (BannedIPs.findOne({IP: connection.clientAddress})) {
    // Close/deny connection

More info:
Relevant package: