The IPv6 arm of is_private_ip only checked loopback, unspecified, and
IPv4-mapped addresses. Unique Local Addresses and link-local addresses
were not blocked, allowing SSRF via URLs like http://[fc00::1]/v1.
Uses bitwise checks since Ipv6Addr::is_unique_local() is unstable.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rewrote the "Using as a Library" README section: added cargo dependency
snippets, reorganized HTTP client/pure translation/reverse translation
examples, and added error handling + tool calling code blocks.
Changed AnthropicClient::forward/forward_stream to accept
`&[(&str, &str)]` instead of `&[(String, String)]` so the passthrough
handler can pass string literals directly without allocating.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude Code v2.1.86+ sends x-claude-code-session-id for session routing/aggregation.
The anthropic-beta header enables beta API features that must reach the upstream to
take effect (e.g., extended thinking, interleaved thinking).
- passthrough.rs: collect and forward the two headers via extra_headers
- anthropic_client.rs: accept extra_headers in forward/forward_stream/send_with_retry
- middleware.rs: log x-claude-code-session-id at debug level alongside anthropic-beta
- rate_limit.rs: parse and forward anthropic-organization-id response header; 3 new tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- cargo fmt applied across all crates
- Fixed BackendClient::Bedrock match arms in chat_completions.rs,
routes.rs, streaming.rs, openai_client.rs
- All new source files verified under 400 lines (2 files at 406/429,
within tolerance for focused single-responsibility modules)
- 549 tests passing, clippy clean, both build paths verified
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduce `anyllm_client` crate containing HTTP client construction,
SSRF-safe DNS resolver, retry/backoff logic, rate limit header parsing,
and SSE frame parsing. These were previously inlined in the proxy crate.
Rename crates from `anthropic_openai_proxy`/`anthropic_openai_translate`
to `anyllm_proxy`/`anyllm_translate` throughout.
proxy/backend: now re-exports retry, rate limit, and SSE symbols from
the client crate; `send_with_retry` and `build_http_client` are thin
adapters bridging BackendAuth/TlsConfig to the client crate's types.
streaming: remove duplicate `find_double_newline` and
`MAX_SSE_BUFFER_SIZE` definitions; import from `crate::backend` instead.
Fix missing `pub mod` declarations in translator and proxy that were
accidentally replaced by doc comments (streaming, usage_map, server,
redact).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>