mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 20:32:20 +03:00
20 lines
632 B
TypeScript
20 lines
632 B
TypeScript
import { getOneproxyProxyForRotation, markOneproxyProxyFailed } from "./db/oneproxy";
|
|
import type { OneproxyProxyRecord } from "./db/oneproxy";
|
|
|
|
let sequentialIndex = 0;
|
|
|
|
export async function rotateOneproxyProxy(options?: {
|
|
strategy?: "random" | "quality" | "sequential";
|
|
}): Promise<OneproxyProxyRecord | null> {
|
|
const strategy = options?.strategy || "quality";
|
|
return getOneproxyProxyForRotation({ strategy });
|
|
}
|
|
|
|
export async function failOneproxyProxy(host: string, port: number): Promise<boolean> {
|
|
return markOneproxyProxyFailed(host, port);
|
|
}
|
|
|
|
export function resetSequentialIndex(): void {
|
|
sequentialIndex = 0;
|
|
}
|