mirror of
https://github.com/younesaassila/ttv-lol-pro.git
synced 2025-04-29 14:04:26 +02:00
Fix IP anonymisation
This commit is contained in:
parent
2649ca6d6c
commit
1b594ce08b
@ -20,9 +20,19 @@ export function anonymizeIpAddress(url: string): string {
|
||||
|
||||
if (isPublicIP) {
|
||||
if (isIPv4) {
|
||||
proxyHost = new Address4(proxyHost).mask(16);
|
||||
proxyHost = new Address4(proxyHost)
|
||||
.correctForm()
|
||||
.split(".")
|
||||
.map((byte, index) => (index < 2 ? byte : "xxx"))
|
||||
.join(".");
|
||||
} else if (isIPv6) {
|
||||
proxyHost = new Address6(proxyHost).mask(64);
|
||||
const bytes = new Address6(proxyHost).toByteArray();
|
||||
const anonymizedBytes = bytes.map((byte, index) =>
|
||||
index < 6 ? byte : 0x0
|
||||
);
|
||||
proxyHost = Address6.fromByteArray(anonymizedBytes)
|
||||
.correctForm()
|
||||
.replace(/::$/, "::xxxx");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user