Advanced Threat Protection

Advanced Threat Protection (ATP) lets you block specific categories of unwanted content at the DNS level. You configure which categories to enable, and the SDK resolves the appropriate DNS IP to use.

Available categories

Category
Description

Adult

Blocks adult and explicit content

Ads

Blocks advertising domains

Malware

Blocks known malware and phishing domains

Trackers

Blocks cross-site tracking domains

Categories can be combined freely. Setting an empty list disables ATP.

Configuring categories

Set the desired categories on the Configuration object. This can be done at any time - for example, when the user updates their preferences.

let config = sdkManager.getConfiguration()

// Enable categories
config.setAdvancedThreatProtectionCategories(categories: [
    .malware,
    .trackers,
])

// Disable ATP
config.setAdvancedThreatProtectionCategories(categories: [])

// Read active categories
let active = config.getAdvancedThreatProtectionCategories()

Getting the DNS IP

Once categories are configured, call getDnsIp with the user's subscription ID to retrieve the DNS IP to use.

Use this when you are already fetching server locations as part of your connection flow. The DNS IP is derived from that same response - no extra network request is made.

DNS IP Only

Use this when you only need the DNS IP, with no other location data required. It makes a dedicated lightweight request.

Error Handling

Fetching the DNS IP can throw an InstanceDiscoveryException in the following cases:

  • DNSSubnetIpInvalid - the server could not return a valid DNS address for the given subscription.

  • DNSIPCalculationError - the selected categories could not be applied to the DNS address returned by the server.

Last updated