pub struct ProxyHandle {
pub port: u16,
pub token: Zeroizing<String>,
/* private fields */
}Expand description
Handle returned when the proxy server starts.
Contains the assigned port, session token, and a shutdown channel.
Drop the handle or send to shutdown_tx to stop the proxy.
Fields§
§port: u16The actual port the proxy is listening on
token: Zeroizing<String>Session token for client authentication
Implementations§
Source§impl ProxyHandle
impl ProxyHandle
Sourcepub fn env_vars(&self) -> Vec<(String, String)>
pub fn env_vars(&self) -> Vec<(String, String)>
Environment variables to inject into the child process.
The proxy URL includes nono:<token>@ userinfo so that standard HTTP
clients (curl, Python requests, etc.) automatically send
Proxy-Authorization: Basic ... on every request. The raw token is
also provided via NONO_PROXY_TOKEN for nono-aware clients that
prefer Bearer auth.
Sourcepub fn credential_env_vars(&self, config: &ProxyConfig) -> Vec<(String, String)>
pub fn credential_env_vars(&self, config: &ProxyConfig) -> Vec<(String, String)>
Environment variables for reverse proxy credential routes.
Returns two types of env vars per route:
- SDK base URL overrides (e.g.,
OPENAI_BASE_URL=http://127.0.0.1:PORT/openai) - SDK API key vars set to the session token (e.g.,
OPENAI_API_KEY=<token>)
The SDK sends the session token as its “API key” (phantom token pattern). The proxy validates this token and swaps it for the real credential.