CustomDNS, UserDNS, MultyHop, VpnProfiles

Use GetLocations for multi-hop, custom dns and vpn profiles functionalities instead of GetNodes

VpnProfiles

Can be receivedfrom GetLocations response

To apply VPN Profile used GetCredentials(GetCredentialsRequest request) then launch StartVPN

var getLocations = await GetLocations(Protocol.Hydra, "carrier");
var profile = getLocations.Profiles.FirstOrDefault();
var request = new GetCredentialsRequest()
    {
        AppVersion = appVersion,
        Protocol = protocol,
        Profile = profile.,
        VpnNode = vpnNode,
        WithCertificate = withCertificate,
        DeviceId = deviceId,    
    });

var response = await GetCredentials(request);         

var startVpnRequest = new StartVpnRequest
    {
        Credentials = getCredentialsResponse.Credentials,
        DeviceId = DEVICEID,
        EnableKillSwitch = false,
        EnableTunnelLogging = false,
        VpnNode = getNodesResponse.VpnCountries.FirstOrDefault(),
    };    
var startVpnResponse = sdk.StartVpn(startVpnRequest);

CustomDNS

Can be received from GetLocations response

To apply CustomDNS used GetCredentials(GetCredentialsRequest request) then launch StartVPN

var getLocations = await GetLocations(Protocol.Hydra, "carrier");
var customDnsServer = getLocations.DnsServers.FirstOrDefault();
var request = new GetCredentialsRequest()
    {
        AppVersion = appVersion,
        Protocol = protocol,
        CustomDns = customDnsServer,
        VpnNode = vpnNode,
        WithCertificate = withCertificate,
        DeviceId = deviceId,    
    });

var response = await GetCredentials(request);         

var startVpnRequest = new StartVpnRequest
    {
        Credentials = getCredentialsResponse.Credentials,
        DeviceId = DEVICEID,
        EnableKillSwitch = false,
        EnableTunnelLogging = false,
        VpnNode = getNodesResponse.VpnCountries.FirstOrDefault(),
    };    
var startVpnResponse = sdk.StartVpn(startVpnRequest);

UserDNS

To apply UserDNS used GetCredentials(GetCredentialsRequest request) then launch StartVPN

var getLocations = await GetLocations(Protocol.Hydra, "carrier");
var customDnsServer = getLocations.DnsServers.FirstOrDefault();
var request = new GetCredentialsRequest()
    {
        AppVersion = appVersion,
        Protocol = protocol,
        UserDns = customDnsServer,
        VpnNode = vpnNode,
        WithCertificate = withCertificate,
        DeviceId = deviceId,    
    });

var response = await GetCredentials(request);         

var startVpnRequest = new StartVpnRequest
    {
        Credentials = getCredentialsResponse.Credentials,
        DeviceId = DEVICEID,
        EnableKillSwitch = false,
        EnableTunnelLogging = false,
        VpnNode = getNodesResponse.VpnCountries.FirstOrDefault(),
    };    
var startVpnResponse = sdk.StartVpn(startVpnRequest);

MultyHope

Last updated