# DeviceAtlas Carrier Detection API Config #
Carrier Detection API Config provides options to customize the way the API
behaves in terms of memory use and device properties.
## Contents ##
* [DaConfig type](#config_type)
* [How it works](#how_it_works)
* [Configuration examples](#config_examples)
* [General tips](#general_tips)
### Config Type ###
* [Real Ip](#RealIp)
#### Real IP ####
Boolean value to enable/disable the addition of the IP address used
during the detection.
User-Agent/Dynamic properties: `realip`
**Config field:** `DaConfig.RealIp`
**Possible values:** true/false
**Default Value:** false
### How it works ###
This section describes how to use the `DaConfig` type to
modify the behavior of the `deviceatlas.device.DaGo` instance
when performing the device properties lookup.
#### Use of the default settings ####
When a new instance of the `deviceatlas.device.DaGo` is created,
internally another instance of the `DaConfig` type is generated
with the default settings.
```go
da := device.New()
defer da.Free()
```
#### Use of custom settings ####
In order to use custom settings, it is required to explicitly create a
`DaConfig` object, configure the settings and pass it to the
`deviceatlas.device.DaGo` instance.
**Preferred method**
```go
config := &carrier.DaConfig{RealIp: true}
da := device.New()
defer da.Free()
da.Config(config)
...
alternatively
...
config := &device.DaConfig{RealIp: true}
da := device.NewWithConfig(config)
defer da.Free()
```
### Configuration examples ###
In order to enhance performance, reduce memory footprint and, in general,
provide a better user experience, it is highly recommended to configure
the API with the most convenient settings for a given use case.
```go
var config *carrier.DaConfig
config = carrier.NewConfig()
config.RealIp = true
```
### General tips ###
#### Maximizing CPU utilization ####
The latest version of the carrier API runs without problems in a
multi-process environment, however custom code must be created to access the API
in a multi-process way to achieve the optimal hardware utilization.
The following are general recommendations to obtain optimal results from the hardware:
* A single carrier API instance can be used in a goroutine context.
* The default GOMAXPROCS value can be used or can be adjusted to use a subset of available cores.
* The recommended number of concurrent processes should not be greater than
the number of cores in the system.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_ Copyright (c) DeviceAtlas 2022. All Rights Reserved. _
https://deviceatlas.com