Skip to content

Commit

Permalink
release 3.0.2 (#8)
Browse files Browse the repository at this point in the history
dep: replace ip with ipaddr.js
  • Loading branch information
msimerson authored Nov 13, 2024
1 parent ed064c3 commit 10e3e10
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 25 deletions.
6 changes: 5 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the "stun" package will be documented in this file.

### [3.0.2] - 2024-11-13

- dep: replace ip dependency with ipaddr.js

### [3.0.1] - 2024-04-02

- dep(ip): bump 2.0.0 to 2.0.1
Expand All @@ -11,7 +15,7 @@ All notable changes to the "stun" package will be documented in this file.
- test: remove eslint from devDependencies (installed by GHA for tests, npx will use local version)
- test: remove jest from devDependencies
- installed by npx when needed
- dramatically shrinks package-lock.json
- shrinks package-lock.json from 229KB to 5.7KB
- next version: replaced with node:test

### [3.0.0] - 2023-12-13
Expand Down
35 changes: 19 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stun",
"version": "3.0.1",
"version": "3.0.2",
"description": "Session Traversal Utilities for NAT (STUN) client and server.",
"main": "src/index.js",
"scripts": {
Expand Down Expand Up @@ -34,8 +34,8 @@
"dependencies": {
"binary-data": "^0.6.0",
"buffer-xor": "^2.0.2",
"debug": "^4.3.4",
"ip": "^2.0.1",
"debug": "^4.3.7",
"ipaddr.js": "^2.2.0",
"ip2buf": "^2.0.0",
"is-stun": "^2.0.0",
"minimist": "^1.2.8",
Expand Down
4 changes: 2 additions & 2 deletions src/attributes/stun-address-attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const {
decode,
types: { uint8, uint16be, buffer, reserved },
} = require('binary-data');
const ip = require('ip');
const ipa = require('ipaddr.js');
const { pton4, pton6 } = require('ip2buf');
const constants = require('../lib/constants');
const StunAttribute = require('./stun-attribute');
Expand Down Expand Up @@ -59,7 +59,7 @@ module.exports = class StunAddressAttribute extends StunAttribute {
static from(type, message) {
const { address, port } = StunAddressAttribute.decode(message);

const ipaddr = ip.toString(address);
const ipaddr = ipa.fromByteArray(address).toString();

assert(isPort(port));
assert(net.isIP(ipaddr));
Expand Down
6 changes: 3 additions & 3 deletions src/attributes/stun-xor-address-attribute.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const net = require('net');
const ip = require('ip');
const ipa = require('ipaddr.js');
const xor = require('buffer-xor');
const { pton4, pton6 } = require('ip2buf');
const constants = require('../lib/constants');
Expand Down Expand Up @@ -36,7 +36,7 @@ module.exports = class StunXorAddressAttribute extends StunAddressAttribute {
const packet = StunAddressAttribute.decode(message);

const port = xorPort(packet.port);
const address = xorIP(ip.toString(packet.address), owner);
const address = xorIP(ipa.fromByteArray(packet.address).toString(), owner);

const attribute = new StunXorAddressAttribute(type, address, port);

Expand Down Expand Up @@ -104,7 +104,7 @@ function xorIP(address, owner) {
throw new Error(`Invalid ip address: ${address}`);
}

return ip.toString(xored);
return ipa.fromByteArray(xored).toString();
}

/**
Expand Down

0 comments on commit 10e3e10

Please sign in to comment.