diff --git a/package.json b/package.json index db8003e..2c89eb5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "socks", "private": false, - "version": "2.8.1", + "version": "2.8.2", "description": "Fully featured SOCKS proxy client supporting SOCKSv4, SOCKSv4a, and SOCKSv5. Includes Bind and Associate functionality.", "main": "build/index.js", "typings": "typings/index.d.ts", diff --git a/src/common/helpers.ts b/src/common/helpers.ts index d74d810..42d36f0 100644 --- a/src/common/helpers.ts +++ b/src/common/helpers.ts @@ -236,8 +236,9 @@ export function ipToBuffer(ip: string): Buffer { } else if (net.isIPv6(ip)) { // Handle IPv6 addresses const address = new Address6(ip); - return Buffer.from(address.toByteArray()); + return Buffer.from(address.canonicalForm().split(":").map(segment => segment.padStart(4, '0')).join(''), 'hex'); } else { throw new Error('Invalid IP address format'); } } +