import { type HybridObject } from 'react-native-nitro-modules' export interface NitroResolver extends HybridObject<{ ios: 'swift', android: 'kotlin' }> { /** * Cancel all outstanding DNS queries made by this resolver. */ cancel(): void getServers(): string setServers(servers: string): void resolveipv4(hostname: string): Promise resolveipv6(hostname: string): Promise resolveMx(hostname: string): Promise resolveTxt(hostname: string): Promise resolveBase64Txt(hostname: string): Promise // Not standard Node, but useful? Node just has resolveTxt resolveCname(hostname: string): Promise resolveNs(hostname: string): Promise resolveSoa(hostname: string): Promise resolveSrv(hostname: string): Promise resolveCaa(hostname: string): Promise resolveNaptr(hostname: string): Promise resolvePtr(hostname: string): Promise resolveTlsa(hostname: string): Promise resolveAny(hostname: string): Promise reverse(ip: string): Promise setLocalAddress(v4: string, v6: string): void clearCache(): void } export enum CachePolicy { FollowDnsTtl = 0, Bypass = 1, StaleWhileRevalidate = 2, StaleIfError = 3, } export interface NitroDns extends HybridObject<{ ios: 'swift', android: 'kotlin' }> { // Factory createResolver(config?: string): NitroResolver // Global Config getServers(): string setServers(servers: string): void // Lookup lookup(hostname: string, family: number): string // Resolution (Global/Default) resolve4(hostname: string): Promise resolve6(hostname: string): Promise resolveMx(hostname: string): Promise resolveTxt(hostname: string): Promise resolveCname(hostname: string): Promise resolveNs(hostname: string): Promise resolveSoa(hostname: string): Promise resolveSrv(hostname: string): Promise resolveCaa(hostname: string): Promise resolveNaptr(hostname: string): Promise resolvePtr(hostname: string): Promise resolveTlsa(hostname: string): Promise resolveAny(hostname: string): Promise reverse(ip: string): Promise lookupService(address: string, port: number): Promise /** * Set whether app-wide native network requests (fetch, etc.) should be intercepted by this module's DNS. * Supported on Android (OkHttp Hook) and iOS (NSURLProtocol). */ setNativeInterceptionEnabled(enabled: boolean): void setVerbose(enabled: boolean): void clearCache(): void setCacheSize(size: number): void setCachePolicy(policy: CachePolicy, staleTtl: number): void }