Dedicated IP
The Dedicated IP (DIP) module manages the full lifecycle of DIP addresses - static IPs reserved exclusively for a specific subscription. It handles assignment, renewal, health monitoring, and VPN protocol configuration retrieval.
Before any IP can be assigned, the subscription must first be unlocked via restoreDips. This populates the local cache and sets the backup encryption password used for all subsequent operations on that subscription.
Assigning a Dedicated IP
The first time a user sets up a Dedicated IP, unlock the subscription and then assign an IP to a chosen location. Use getAvailableDipLocations to let the user pick where they want their IP.
- Swift
- Kotlin
// Fetch available locations and let the user pick one
let locations = try manager.dip().getAvailableDipLocations(
subscriptionId: subscriptionId
)
// Unlock the subscription
let expiredIps = try manager.dip().restoreDips(
subscriptionId: subscriptionId,
backupEncryptionPassword: password
)
// Assign an IP in the chosen location
try manager.dip().assignNewDip(
subscriptionId: subscriptionId,
locationId: selectedLocationId
)
// Fetch available locations and let the user pick one
val locations = manager.dip().getAvailableDipLocations(
subscriptionId = subscriptionId
)
// Unlock the subscription
val expiredIps = manager.dip().restoreDips(
subscriptionId = subscriptionId,
backupEncryptionPassword = password,
)
// Assign an IP in the chosen location
manager.dip().assignNewDip(
subscriptionId = subscriptionId,
locationId = selectedLocationId
)
If restoreDips or renewDips return a non-empty list of IPs, those reservations have expired due to inactivity.
Renewing reservations
IP reservations expire if not renewed regularly. Call renewDips at least once per day - the SDK handles the check internally, so calling it more frequently is safe.
- Swift
- Kotlin
let expiredIps = try manager.dip().renewDips(subscriptionId: subscriptionId)
val expiredIps = manager.dip().renewDips(subscriptionId = subscriptionId)
Checking status and health
Use getDipStatus to get an overview of the subscription's DIP assignments, and getDipHealth to check whether a specific IP is currently reachable.
- Swift
- Kotlin
let status = try manager.dip().getDipStatus(subscriptionId: subscriptionId)
// If status.pendingDipAssignment is true, retry assignNewDip
let health = try manager.dip().getDipHealth(subscriptionId: subscriptionId, ip: ip)
val status = manager.dip().getDipStatus(subscriptionId = subscriptionId)
// if status.pendingDipAssignment is true, retry assignNewDip
val health = manager.dip().getDipHealth(subscriptionId = subscriptionId, ip = ip)
Read VPN protocols for Dedicated IP
Once an IP is assigned, you can retrieve the available VPN protocols.
- Swift
- Kotlin
let config = try manager.dip().getProtocolConfigurations(
subscriptionId: subscriptionId,
ip: ip
)
val config = manager.dip().getProtocolConfigurations(
subscriptionId = subscriptionId,
ip = ip
)