🌳
pt0/serverF/extIpFallbacksAI.mts
2import { type ExtIpSource } from './cfIpF.mts'
4export const getExtIpWithFallbacks = async (sources: ExtIpSource[]): Promise<string> => {
5 for (const fetchIp of sources) {
6 try {
7 const ip = await fetchIp()
8 if (ip) return ip
9 } catch { /* try next */ }
10 }
11 throwIf(() => true, {sourceCount: sources.length})
12 return '' // unreachable