LuckPerms

LuckPerms

41.4k Downloads

Support ipv6 addresses for database

masmc05 opened this issue ยท 2 comments

commented

Description

// get the database info/credentials from the config file
String[] addressSplit = this.configuration.getAddress().split(":");
String address = addressSplit[0];
String port = addressSplit.length > 1 ? addressSplit[1] : defaultPort();

This will never work with address of type [xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]:YYYY

Reproduction Steps

Use ipv6 for database

Expected Behaviour

For it to work

Server Details

This server is running Purpur version git-Purpur-2056 (MC: 1.20.1) (Implementing API version 1.20.1-R0.1-SNAPSHOT) (Git: bd327ae on HEAD)

LuckPerms Version

[LuckPerms] Enabling LuckPerms v5.4.102

Logs and Configs

No response

Extra Details

You could try to separate only the latest : if the string doesn't end in ], the rest to go untouched, as an address with of form [xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx] should be valid for hikari

commented

Same with

private static HostAndPort parseAddress(String address) {
String[] addressSplit = address.split(":");
String host = addressSplit[0];
int port = addressSplit.length > 1 ? Integer.parseInt(addressSplit[1]) : Protocol.DEFAULT_PORT;
return new HostAndPort(host, port);
}

commented

Recategorising this as a suggestion - I will accept a good PR to implement this functionality for the storage backends that support IPv6 :)