Skip to main content

Module reverse

Module reverse 

Source
Expand description

Reverse connection support for Agent Protocol v2.

This module allows agents to connect to the proxy instead of the proxy connecting to agents. This is useful for:

  • Agents behind NAT or firewalls
  • Dynamic agent scaling (agents register on startup)
  • Simpler agent deployment (no need to expose agent ports)

§Protocol

  1. Proxy starts a listener (UDS or TCP)
  2. Agent connects and sends a RegistrationRequest
  3. Proxy validates and responds with RegistrationResponse
  4. On success, the connection is added to the AgentPool
  5. The connection is used bidirectionally like a normal connection

§Example

use grapsus_agent_protocol::v2::{AgentPool, ReverseConnectionListener};

let pool = AgentPool::new();
let listener = ReverseConnectionListener::bind_uds("/var/run/grapsus/agents.sock").await?;

// Accept connections in background
listener.accept_loop(pool).await;

Structs§

RegistrationRequest
Registration request sent by agent when connecting to proxy.
RegistrationResponse
Registration response sent by proxy to agent.
ReverseConnectionClient
Client wrapper for a reverse connection.
ReverseConnectionConfig
Configuration for the reverse connection listener.
ReverseConnectionListener
Listener for reverse agent connections over Unix Domain Socket.