arn-browser 0.1.23 → 0.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -64,7 +64,7 @@ export interface ProxyServerOptions {
|
|
|
64
64
|
*/
|
|
65
65
|
ip2LocationKey?: string;
|
|
66
66
|
|
|
67
|
-
/** Retry delay in milliseconds between IP lookup attempts (default:
|
|
67
|
+
/** Retry delay in milliseconds between IP lookup attempts (default: 1000) */
|
|
68
68
|
retryDelayMs?: number;
|
|
69
69
|
|
|
70
70
|
/** Enable verbose logging (default: false) */
|
|
@@ -143,6 +143,6 @@ export function fetchPublicIP(proxyUrl: string | null): Promise<GeoDetails | nul
|
|
|
143
143
|
* Fetches proxy details (IP, country, city, timezone) with retries.
|
|
144
144
|
* @param proxyUrl The proxy URL string. Pass `null` for local fallback.
|
|
145
145
|
* @param apiKey Optional IP2Location API key.
|
|
146
|
-
* @param retryDelayMs Delay between retries in ms (default:
|
|
146
|
+
* @param retryDelayMs Delay between retries in ms (default: 1000).
|
|
147
147
|
*/
|
|
148
148
|
export function fetchProxyDetails(proxyUrl: string | null, apiKey?: string | null, retryDelayMs?: number): Promise<GeoDetails | null>;
|
|
@@ -110,7 +110,7 @@ export async function fetchPublicIP(proxyUrl) {
|
|
|
110
110
|
* 1. If proxyUrl is provided -> Fetch Real Data (IP + Timezone).
|
|
111
111
|
* 2. If proxyUrl is NULL/Undefined -> Return "Local" Mock immediately.
|
|
112
112
|
*/
|
|
113
|
-
export async function fetchProxyDetails(proxyUrl, apiKey = null, retryDelayMs =
|
|
113
|
+
export async function fetchProxyDetails(proxyUrl, apiKey = null, retryDelayMs = 1000) {
|
|
114
114
|
// --- AUTOMATIC LOCAL FALLBACK ---
|
|
115
115
|
if (!proxyUrl) {
|
|
116
116
|
return {
|
|
@@ -121,9 +121,9 @@ export async function fetchProxyDetails(proxyUrl, apiKey = null, retryDelayMs =
|
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
// --- EXTERNAL LOOKUP with retry (
|
|
124
|
+
// --- EXTERNAL LOOKUP with retry (5 attempts) ---
|
|
125
125
|
const providers = ["IP-API", "IP2Location"];
|
|
126
|
-
const MAX_RETRIES =
|
|
126
|
+
const MAX_RETRIES = 5;
|
|
127
127
|
|
|
128
128
|
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
|
|
129
129
|
for (const provider of providers) {
|
|
@@ -195,7 +195,7 @@ export async function startProxyServer({
|
|
|
195
195
|
PROXY_2_HOSTS = [],
|
|
196
196
|
NO_PROXY_HOSTS = [],
|
|
197
197
|
ip2LocationKey = null,
|
|
198
|
-
retryDelayMs =
|
|
198
|
+
retryDelayMs = 1000,
|
|
199
199
|
debug = false,
|
|
200
200
|
proxy_stats = true,
|
|
201
201
|
host_stats = true,
|