MCPcopy
hub / github.com/garrytan/gstack / resolveTunnelIPv6

Function resolveTunnelIPv6

ios-qa/daemon/src/devicectl.ts:219–241  ·  view source on GitHub ↗
(opts: {
  udid: string;
  deviceName: string;
  spawn?: SpawnImpl;
  resolve?: ResolveImpl;
  legacyResolve?: ResolveImpl;
})

Source from the content-addressed store, hash-verified

217 * Returns the first address that any strategy yields, or null.
218 */
219export async function resolveTunnelIPv6(opts: {
220 udid: string;
221 deviceName: string;
222 spawn?: SpawnImpl;
223 resolve?: ResolveImpl;
224 legacyResolve?: ResolveImpl;
225}): Promise<string | null> {
226 const spawn = opts.spawn ?? defaultSpawn;
227 const resolveLookup = opts.resolve ?? defaultResolve;
228 const resolveLegacy = opts.legacyResolve ?? legacyResolve6;
229
230 // 1. devicectl-based
231 const fromDevicectl = getDeviceTunnelIPv6FromDevicectl(opts.udid, spawn);
232 if (fromDevicectl) return fromDevicectl;
233
234 // 2. mDNS via dns.lookup
235 const fromLookup = await getDeviceTunnelIPv6(opts.deviceName, resolveLookup);
236 if (fromLookup) return fromLookup;
237
238 // 3. last-resort: legacy dns.resolve6
239 const fromLegacy = await getDeviceTunnelIPv6(opts.deviceName, resolveLegacy);
240 return fromLegacy;
241}
242
243/**
244 * Check whether a specific bundle ID has a running process on the device.

Callers 2

bootstrapTunnelFunction · 0.90

Calls 2

getDeviceTunnelIPv6Function · 0.85

Tested by

no test coverage detected