public final class IP2LocationConfig extends Object
IP2LocationConfig.Builder.</p>
<h2>Configuration Properties</h2>
<table border="1">
<tr><th>Property</th><th>Default</th><th>Description</th></tr>
<tr><td>enabled</td><td>false</td><td>Whether the service is enabled</td></tr>
<tr><td>token</td><td>""</td><td>IP2Location API download token</td></tr>
<tr><td>databasePath</td><td>"IP2Location"</td><td>Path relative to server installation</td></tr>
<tr><td>database</td><td>DB11_LITE</td><td>Database type to use</td></tr>
<tr><td>includeIPv6</td><td>false</td><td>Whether to enable IPv6 support</td></tr>
<tr><td>useMemoryMappedFile</td><td>true</td><td>Whether to use memory-mapped file access</td></tr>
</table>
<h2>Usage Example</h2>
<pre>// Create a configuration
IP2LocationConfig config = IP2LocationConfig.builder()
.enabled(true)
.token("your-token-here")
.database(Database.DB11_LITE)
.includeIPv6(true)
.useMemoryMappedFile(true)
.build();
// Create from existing config with modifications
IP2LocationConfig modified = config.toBuilder()
.includeIPv6(false)
.build();
</pre>
<h2>Persistence</h2>
<p>This class provides methods to load from and save to IniFile
for configuration persistence.</p>
<h2>Thread Safety</h2>
<p>This class is immutable and therefore inherently thread-safe.</p>AdminIP2LocationPanel,
IniFile| Modifier and Type | Class and Description |
|---|---|
static class |
IP2LocationConfig.Builder
Builder for creating
IP2LocationConfig instances. |
| Modifier and Type | Field and Description |
|---|---|
static Database |
DEFAULT_DATABASE
Default database type.
|
static String |
DEFAULT_DB_PATH
Default database path relative to server installation.
|
static String |
KEY_DB_NAME
Key for the database type name.
|
static String |
KEY_DB_PATH
Key for the database path.
|
static String |
KEY_ENABLE_IPV6
Key for IPv6 support flag.
|
static String |
KEY_ENABLED
Key for the enabled flag.
|
static String |
KEY_INIT_FAILURE_THRESHOLD
Key for init failure threshold.
|
static String |
KEY_LOOKUP_ERROR_THRESHOLD
Key for lookup error threshold.
|
static String |
KEY_MAX_RECOVERY_ATTEMPTS
Key for max auto-recovery attempts.
|
static String |
KEY_MEMORY_MAPPED
Key for memory-mapped file flag.
|
static String |
KEY_NOTIFY_TRANSIENT
Key for notify on transient errors flag.
|
static String |
KEY_RECOVER_ON_CORRUPTION
Key for recover on corruption flag.
|
static String |
KEY_RECOVER_ON_DOWNLOAD
Key for recover on download failure flag.
|
static String |
KEY_RECOVERY_ACTION
Key for recovery action.
|
static String |
KEY_RECOVERY_COOLDOWN
Key for recovery cooldown minutes.
|
static String |
KEY_TOKEN
Key for the download token.
|
static String |
SECTION
INI file section name for IP2Location settings.
|
| Modifier and Type | Method and Description |
|---|---|
static IP2LocationConfig.Builder |
builder()
Creates a new builder with default values.
|
boolean |
equals(Object o) |
Database |
getDatabase()
Returns the database type to use.
|
String |
getDatabasePath()
Returns the database path relative to server installation.
|
Path |
getDatabasePathAsPath()
Returns the database path as a
Path object. |
int |
getInitFailureThreshold()
Returns the threshold for consecutive init failures.
|
int |
getLookupErrorThreshold()
Returns the threshold for consecutive lookup errors.
|
int |
getMaxAutoRecoveryAttempts()
Returns the maximum auto-recovery attempts.
|
RecoveryConfig.RecoveryAction |
getRecoveryAction()
Returns the recovery action when thresholds are exceeded.
|
int |
getRecoveryCooldownMinutes()
Returns the recovery cooldown in minutes.
|
String |
getToken()
Returns the IP2Location download token.
|
int |
hashCode() |
boolean |
isEnabled()
Returns whether the IP2Location service is enabled.
|
boolean |
isIncludeIPv6()
Returns whether IPv6 support is enabled.
|
boolean |
isNotifyOnTransientErrors()
Returns whether to notify on transient errors.
|
boolean |
isRecoverOnCorruption()
Returns whether to recover on database corruption.
|
boolean |
isRecoverOnDownloadFailure()
Returns whether to recover on download failure.
|
boolean |
isUseMemoryMappedFile()
Returns whether memory-mapped file access is enabled.
|
static IP2LocationConfig |
loadFrom(IniFile ini)
Loads configuration from the server.ini file.
|
void |
saveTo(IniFile ini)
Saves this configuration to the server.ini file.
|
IP2LocationConfig.Builder |
toBuilder()
Creates a builder initialized with this configuration's values.
|
RecoveryConfig |
toRecoveryConfig()
Creates a RecoveryConfig from this configuration.
|
String |
toString() |
ValidationResult |
validate()
Validates this configuration.
|
public static final String SECTION
public static final String KEY_ENABLED
public static final String KEY_TOKEN
public static final String KEY_DB_PATH
public static final String KEY_DB_NAME
public static final String KEY_ENABLE_IPV6
public static final String KEY_MEMORY_MAPPED
public static final String KEY_RECOVERY_ACTION
public static final String KEY_INIT_FAILURE_THRESHOLD
public static final String KEY_LOOKUP_ERROR_THRESHOLD
public static final String KEY_MAX_RECOVERY_ATTEMPTS
public static final String KEY_RECOVERY_COOLDOWN
public static final String KEY_RECOVER_ON_DOWNLOAD
public static final String KEY_RECOVER_ON_CORRUPTION
public static final String KEY_NOTIFY_TRANSIENT
public static final String DEFAULT_DB_PATH
public static final Database DEFAULT_DATABASE
public boolean isEnabled()
true if the service should be startedpublic String getToken()
null (may be empty)public String getDatabasePath()
nullpublic Path getDatabasePathAsPath()
Path object.public Database getDatabase()
nullpublic boolean isIncludeIPv6()
true if both IPv4 and IPv6 databases should be downloadedpublic boolean isUseMemoryMappedFile()
true if memory-mapped files should be usedpublic RecoveryConfig.RecoveryAction getRecoveryAction()
public int getInitFailureThreshold()
public int getLookupErrorThreshold()
public int getMaxAutoRecoveryAttempts()
public int getRecoveryCooldownMinutes()
public boolean isRecoverOnDownloadFailure()
true if recovery on download failure is enabledpublic boolean isRecoverOnCorruption()
true if recovery on corruption is enabledpublic boolean isNotifyOnTransientErrors()
true if transient error notifications are enabledpublic RecoveryConfig toRecoveryConfig()
public ValidationResult validate()
public static IP2LocationConfig loadFrom(IniFile ini)
ini - The Ini file to load frompublic void saveTo(IniFile ini)
ini - The INI file to save topublic static IP2LocationConfig.Builder builder()
public IP2LocationConfig.Builder toBuilder()
Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© 2026 Mindus SARL. All rights reserved.