Interface ConnectHandler


public interface ConnectHandler
Handler for authorizing incoming SOCKS CONNECT requests.

Called after successful SOCKS method negotiation (RFC 1928 §3) and authentication (RFC 1929 or RFC 1961), when a CONNECT request (RFC 1928 §4: CMD=0x01) is received.

Implementations can perform custom authorization logic — for example, checking whether a user is allowed to connect to a particular destination, applying rate limits, or logging access.

The handler receives a ConnectState callback and must call exactly one of ConnectState.allow() or ConnectState.deny(int) when the decision is ready. The decision may be made asynchronously.

Author:
Chris Burdess
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    handleConnect(ConnectState state, SOCKSRequest request, Endpoint clientEndpoint)
    Called when a SOCKS CONNECT request has been received and (if applicable) authenticated.
  • Method Details

    • handleConnect

      void handleConnect(ConnectState state, SOCKSRequest request, Endpoint clientEndpoint)
      Called when a SOCKS CONNECT request has been received and (if applicable) authenticated.

      The implementation must call ConnectState.allow() to permit the connection, or ConnectState.deny(int) to reject it with a SOCKS reply code.

      Parameters:
      state - the callback for communicating the decision
      request - the parsed SOCKS request (includes destination, version, userid, authenticated user)
      clientEndpoint - the client's endpoint (for address info)