pub fn dns_resolve(
domain: String,
dns_port: State<'_, DnsPort>,
) -> Result<DnsResolutionResult, String>Expand description
Resolves a domain name through the DNS server.
Performs a manual DNS resolution for testing and debugging purposes. This command is useful for:
- Testing DNS resolution
- Debugging domain lookup issues
- Verifying DNS server functionality
§Parameters
domain- The domain name to resolvedns_port- Tauri managed state containing the DNS port number
§Returns
Result<DnsResolutionResult, String> with resolution result or an error
message
§Errors
Returns an error if:
- DNS server is not running
- Domain resolution fails
- Network communication fails
§Example (JavaScript)
import { invoke } from '@tauri-apps/api/tauri';
const result = await invoke('dns_resolve', {
domain: 'code.editor.land'
});
if (result.succeeded) {
console.log(`Resolved ${result.domain}:`, result.addresses);
} else {
console.error(`Resolution failed: ${result.error}`);
}