feat: IPv6 outbound rotation via curl --interface
- Add IPv6SourcePool for round-robin IP rotation - fetchViaCurl: Bun.spawn + curl -6 --interface for source binding - Auto-fallback to regular fetch when IPv6 connection fails - Response decompression via --compressed flag - Docker + GHCR build/deploy workflows - 8 routable IPv6 addresses on VPS
This commit is contained in:
+7
-6
@@ -376,6 +376,7 @@ export async function handleChatCompletion(
|
||||
proxyPool?: ProxyPool,
|
||||
sessionPool?: SessionProxyPool,
|
||||
sessionId?: string,
|
||||
ipv6Source?: string,
|
||||
): Promise<Response> {
|
||||
// -- Input validation -------------------------------------------------------
|
||||
const validationError = validateChatRequest(body);
|
||||
@@ -420,8 +421,8 @@ export async function handleChatCompletion(
|
||||
// -- Execute with session-aware or standard retry --------------------------
|
||||
let result: FetchWithRetryResult =
|
||||
sessionPool && sessionId
|
||||
? await fetchWithSessionRetry(url, init, sessionPool, sessionId, `openai:${req.model}`)
|
||||
: await fetchWithRetry(url, init, proxyPool, `openai:${req.model}`);
|
||||
? await fetchWithSessionRetry(url, init, sessionPool, sessionId, `openai:${req.model}`, undefined, ipv6Source)
|
||||
: await fetchWithRetry(url, init, proxyPool, `openai:${req.model}`, ipv6Source);
|
||||
|
||||
// -- Mimo Free: auth failure → invalidate JWT and retry once ---------------
|
||||
if (
|
||||
@@ -437,8 +438,8 @@ export async function handleChatCompletion(
|
||||
};
|
||||
result =
|
||||
sessionPool && sessionId
|
||||
? await fetchWithSessionRetry(url, init, sessionPool, sessionId, `openai:${req.model}`)
|
||||
: await fetchWithRetry(url, init, proxyPool, `openai:${req.model}`);
|
||||
? await fetchWithSessionRetry(url, init, sessionPool, sessionId, `openai:${req.model}`, undefined, ipv6Source)
|
||||
: await fetchWithRetry(url, init, proxyPool, `openai:${req.model}`, ipv6Source);
|
||||
}
|
||||
|
||||
// -- aichat.org: session expiry → invalidate session and retry once ---------
|
||||
@@ -456,8 +457,8 @@ export async function handleChatCompletion(
|
||||
};
|
||||
result =
|
||||
sessionPool && sessionId
|
||||
? await fetchWithSessionRetry(url, init, sessionPool, sessionId, `openai:${req.model}`)
|
||||
: await fetchWithRetry(url, init, proxyPool, `openai:${req.model}`);
|
||||
? await fetchWithSessionRetry(url, init, sessionPool, sessionId, `openai:${req.model}`, undefined, ipv6Source)
|
||||
: await fetchWithRetry(url, init, proxyPool, `openai:${req.model}`, ipv6Source);
|
||||
}
|
||||
|
||||
if (result.errorClassification) {
|
||||
|
||||
Reference in New Issue
Block a user