Merge pull request #3226 from BPplays/ipv6_auto

Automatically detect what IP versions are available and use them
This commit is contained in:
Cohee
2025-01-04 16:22:53 +02:00
committed by GitHub
3 changed files with 167 additions and 32 deletions

View File

@@ -692,6 +692,22 @@ export function isValidUrl(url) {
}
}
export function urlHostnameToIPv6(hostname) {
if (hostname.startsWith('[')) {
hostname = hostname.slice(1);
}
if (hostname.endsWith(']')) {
hostname = hostname.slice(0, -1);
}
return hostname;
}
export function stringToBool(str) {
if (str === 'true') return true;
if (str === 'false') return false;
return str;
}
/**
* MemoryLimitedMap class that limits the memory usage of string values.
*/