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
- Proxy starts a listener (UDS or TCP)
- Agent connects and sends a
RegistrationRequest - Proxy validates and responds with
RegistrationResponse - On success, the connection is added to the AgentPool
- 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§
- Registration
Request - Registration request sent by agent when connecting to proxy.
- Registration
Response - Registration response sent by proxy to agent.
- Reverse
Connection Client - Client wrapper for a reverse connection.
- Reverse
Connection Config - Configuration for the reverse connection listener.
- Reverse
Connection Listener - Listener for reverse agent connections over Unix Domain Socket.