---
title: llarp::dns::I_Platform
summary: sets dns settings in a platform dependant way 

---

# llarp::dns::I_Platform



sets dns settings in a platform dependant way 


`#include <platform.hpp>`

Inherited by [llarp::dns::Multi_Platform](Classes/classllarp_1_1dns_1_1Multi__Platform.md), [llarp::dns::Null_Platform](Classes/classllarp_1_1dns_1_1Null__Platform.md), [llarp::dns::nm::Platform](Classes/classllarp_1_1dns_1_1nm_1_1Platform.md), [llarp::dns::sd::Platform](Classes/classllarp_1_1dns_1_1sd_1_1Platform.md)

## Public Functions

|                | Name           |
| -------------- | -------------- |
| virtual | **[~I_Platform](Classes/classllarp_1_1dns_1_1I__Platform.md#function-~i-platform)**() =default |
| virtual void | **[set_resolver](Classes/classllarp_1_1dns_1_1I__Platform.md#function-set-resolver)**(unsigned int if_index, [llarp::SockAddr](Classes/structllarp_1_1SockAddr.md) dns, bool global) =0<br>Attempts to set lokinet as the DNS server.  |

## Public Functions Documentation

### function ~I_Platform

```cpp
virtual ~I_Platform() =default
```


### function set_resolver

```cpp
virtual void set_resolver(
    unsigned int if_index,
    llarp::SockAddr dns,
    bool global
) =0
```

Attempts to set lokinet as the DNS server. 

**Parameters**: 

  * **if_index** &ndash; the interface index to which we add the DNS servers, this can be gotten from the interface name e.g. lokitun0 (Typically tun_endpoint.GetIfName().) and then put through if_nametoindex(). 
  * **dns** &ndash; the listening address of the lokinet DNS server 
  * **global** &ndash; whether to set up lokinet for all DNS queries (true) or just .loki & .snode addresses (false). 


**Reimplemented by**: [llarp::dns::Multi_Platform::set_resolver](Classes/classllarp_1_1dns_1_1Multi__Platform.md#function-set-resolver), [llarp::dns::sd::Platform::set_resolver](Classes/classllarp_1_1dns_1_1sd_1_1Platform.md#function-set-resolver), [llarp::dns::nm::Platform::set_resolver](Classes/classllarp_1_1dns_1_1nm_1_1Platform.md#function-set-resolver), [llarp::dns::Null_Platform::set_resolver](Classes/classllarp_1_1dns_1_1Null__Platform.md#function-set-resolver)


throws if unsupported or fails.


-------------------------------

Updated on 2023-03-06 at 20:36:34 +0000