Tabnine Logo
BlacklistFilter
Code IndexAdd Tabnine to your IDE (free)

How to use
BlacklistFilter
in
org.apache.mina.filter.firewall

Best Java code snippets using org.apache.mina.filter.firewall.BlacklistFilter (Showing top 20 results out of 315)

origin: org.apache.mina/mina-core

/**
 * Sets the subnets to be blacklisted.
 *
 * NOTE: this call will remove any previously blacklisted subnets.
 *
 * @param subnets an array of subnets to be blacklisted.
 */
public void setSubnetBlacklist(Iterable<Subnet> subnets) {
  if (subnets == null) {
    throw new IllegalArgumentException("Subnets must not be null");
  }
  blacklist.clear();
  for (Subnet subnet : subnets) {
    block(subnet);
  }
}
origin: org.apache.mina/mina-core

@Override
public void sessionClosed(NextFilter nextFilter, IoSession session) throws Exception {
  if (!isBlocked(session)) {
    // forward if not blocked
    nextFilter.sessionClosed(session);
  } else {
    blockSession(session);
  }
}
origin: org.apache.mina/mina-core

/**
 * Unblocks the specified endpoint.
 * 
 * @param address The address to unblock
 */
public void unblock(InetAddress address) {
  if (address == null) {
    throw new IllegalArgumentException("Adress to unblock can not be null");
  }
  unblock(new Subnet(address, 32));
}
origin: jzyong/game-server

public GateWebSocketUserServer(MinaServerConfig minaServerConfig) {
  super(null);
  this.minaServerConfig=minaServerConfig;
  blacklistFilter=new BlacklistFilter();
  filters.put("Blacklist", blacklistFilter);
  ScriptManager.getInstance().getBaseScriptEntry().executeScripts(IGateServerScript.class, script->script.setIpBlackList(blacklistFilter));
  gateWebSocketUserServerHandler=new GateWebSocketUserServerHandler();
  tcpServer=new TcpServer(minaServerConfig, gateWebSocketUserServerHandler, new WebSocketCodecFactory(), filters);
}
origin: miltonio/milton2

private void updateBlacklistFilter() {
  if (acceptor != null) {
    BlacklistFilter filter = (BlacklistFilter) acceptor
        .getFilterChain().get("ipFilter");
    if (filter != null) {
      if (getBlockedAddresses() != null) {
        filter.setBlacklist(getBlockedAddresses());
      } else if (getBlockedSubnets() != null) {
        filter.setSubnetBlacklist(getBlockedSubnets());
      } else {
        // an empty list clears the blocked addresses
        filter.setSubnetBlacklist(new ArrayList<Subnet>());
      }
    }
  }
}
origin: org.apache.directory.api/api-ldap-client-all

/**
 * Unblocks the specified endpoint.
 * 
 * @param address The address to unblock
 */
public void unblock(InetAddress address) {
  if (address == null) {
    throw new IllegalArgumentException("Adress to unblock can not be null");
  }
  unblock(new Subnet(address, 32));
}
origin: jzyong/game-server

public GateUdpUserServer(MinaServerConfig minaServerConfig) {
  super(null);
  this.minaServerConfig=minaServerConfig;
  blacklistFilter=new BlacklistFilter();
  filters.put("Blacklist", blacklistFilter);
  ScriptManager.getInstance().getBaseScriptEntry().executeScripts(IGateServerScript.class, script->script.setIpBlackList(blacklistFilter));
  udpServer=new UdpServer(minaServerConfig, new GateUdpUserServerHandler(this),new ClientProtocolCodecFactory(),filters);
}
origin: org.apache.directory.api/api-ldap-client-all

@Override
public void sessionOpened(NextFilter nextFilter, IoSession session) throws Exception {
  if (!isBlocked(session)) {
    // forward if not blocked
    nextFilter.sessionOpened(session);
  } else {
    blockSession(session);
  }
}
origin: kaazing/gateway

/**
 * Sets the subnets to be blacklisted.
 *
 * NOTE: this call will remove any previously blacklisted subnets.
 *
 * @param subnets an array of subnets to be blacklisted.
 */
public void setSubnetBlacklist(Iterable<Subnet> subnets) {
  if (subnets == null) {
    throw new NullPointerException("Subnets must not be null");
  }
  blacklist.clear();
  for (Subnet subnet : subnets) {
    block(subnet);
  }
}
origin: kaazing/gateway

/**
 * Unblocks the specified endpoint.
 */
public void unblock(InetAddress address) {
  if (address == null) {
    throw new NullPointerException("Adress to unblock can not be null");
  }
  
  unblock(new Subnet(address, 32));
}
origin: miltonio/milton2

acceptor.getFilterChain().addLast("ipFilter", new BlacklistFilter());
updateBlacklistFilter();
origin: org.apache.directory.api/api-ldap-client-all

@Override
public void sessionIdle(NextFilter nextFilter, IoSession session, IdleStatus status) throws Exception {
  if (!isBlocked(session)) {
    // forward if not blocked
    nextFilter.sessionIdle(session, status);
  } else {
    blockSession(session);
  }
}
origin: org.apache.mina/mina-core

/**
 * Sets the subnets to be blacklisted.
 *
 * NOTE: this call will remove any previously blacklisted subnets.
 *
 * @param subnets an array of subnets to be blacklisted.
 */
public void setSubnetBlacklist(Subnet[] subnets) {
  if (subnets == null) {
    throw new IllegalArgumentException("Subnets must not be null");
  }
  blacklist.clear();
  for (Subnet subnet : subnets) {
    block(subnet);
  }
}
origin: kaazing/gateway

@Override
public void sessionIdle(NextFilter nextFilter, IoSession session,
    IdleStatus status) throws Exception {
  if (!isBlocked(session)) {
    // forward if not blocked
    nextFilter.sessionIdle(session, status);
  } else {
    blockSession(session);
  }
}
origin: org.apache.mina/mina-core

/**
 * Sets the addresses to be blacklisted.
 *
 * NOTE: this call will remove any previously blacklisted addresses.
 *
 * @param addresses an array of addresses to be blacklisted.
 */
public void setBlacklist(InetAddress[] addresses) {
  if (addresses == null) {
    throw new IllegalArgumentException("addresses");
  }
  blacklist.clear();
  for (int i = 0; i < addresses.length; i++) {
    InetAddress addr = addresses[i];
    block(addr);
  }
}
origin: org.apache.mina/mina-core

@Override
public void sessionCreated(NextFilter nextFilter, IoSession session) {
  if (!isBlocked(session)) {
    // forward if not blocked
    nextFilter.sessionCreated(session);
  } else {
    blockSession(session);
  }
}
origin: org.apache.mina/mina-core

/**
 * Sets the addresses to be blacklisted.
 *
 * NOTE: this call will remove any previously blacklisted addresses.
 *
 * @param addresses a collection of InetAddress objects representing the
 *        addresses to be blacklisted.
 * @throws IllegalArgumentException if the specified collections contains
 *         non-{@link InetAddress} objects.
 */
public void setBlacklist(Iterable<InetAddress> addresses) {
  if (addresses == null) {
    throw new IllegalArgumentException("addresses");
  }
  blacklist.clear();
  for (InetAddress address : addresses) {
    block(address);
  }
}
origin: org.apache.mina/mina-core

@Override
public void sessionOpened(NextFilter nextFilter, IoSession session) throws Exception {
  if (!isBlocked(session)) {
    // forward if not blocked
    nextFilter.sessionOpened(session);
  } else {
    blockSession(session);
  }
}
origin: kaazing/gateway

/**
 * Sets the addresses to be blacklisted.
 *
 * NOTE: this call will remove any previously blacklisted addresses.
 *
 * @param addresses an array of addresses to be blacklisted.
 */
public void setBlacklist(InetAddress[] addresses) {
  if (addresses == null) {
    throw new NullPointerException("addresses");
  }
  blacklist.clear();
  for (int i = 0; i < addresses.length; i++) {
    InetAddress addr = addresses[i];
    block(addr);
  }
}
origin: org.apache.mina/mina-core

@Override
public void sessionIdle(NextFilter nextFilter, IoSession session, IdleStatus status) throws Exception {
  if (!isBlocked(session)) {
    // forward if not blocked
    nextFilter.sessionIdle(session, status);
  } else {
    blockSession(session);
  }
}
org.apache.mina.filter.firewallBlacklistFilter

Javadoc

A IoFilter which blocks connections from blacklisted remote address.

Most used methods

  • block
    Blocks the specified subnet.
  • blockSession
  • isBlocked
  • unblock
    Unblocks the specified subnet.
  • <init>
  • setBlacklist
    Sets the addresses to be blacklisted. NOTE: this call will remove any previously blacklisted address
  • setSubnetBlacklist
    Sets the subnets to be blacklisted. NOTE: this call will remove any previously blacklisted subnets.

Popular in Java

  • Reading from database using SQL prepared statement
  • getExternalFilesDir (Context)
  • setContentView (Activity)
  • putExtra (Intent)
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • JOptionPane (javax.swing)
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now