mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 20:20:49 +00:00
13 lines
418 B
JavaScript
13 lines
418 B
JavaScript
import { isImdsEndpoint } from "./isImdsEndpoint.js";
|
|
|
|
/**
|
|
* Returns appropriate connection timeout for a host.
|
|
* - IMDS endpoints: 3s (fail fast when outside cloud, reduce 5min delay to ~20s)
|
|
* - Other endpoints: 30s (allow for slow networks while preventing indefinite hangs)
|
|
*/
|
|
export function getConnectTimeout(/** @type {string} */ host) {
|
|
if (isImdsEndpoint(host)) {
|
|
return 3000;
|
|
}
|
|
return 30000;
|
|
}
|