Replace ip-bigint with ip-num (#23)

This commit is contained in:
Butterscotch!
2022-11-03 16:33:53 -04:00
committed by GitHub
parent 9f9d45c450
commit 660599b5e1
5 changed files with 18 additions and 54 deletions

43
package-lock.json generated
View File

@@ -34,7 +34,7 @@
"fs-extra": "^10.0.0",
"html-webpack-plugin": "^5.5.0",
"identity-obj-proxy": "^3.0.0",
"ip-bigint": "^5.0.3",
"ip-num": "^1.4.1",
"jest": "^27.4.3",
"jest-resolve": "^27.4.2",
"jest-watch-typeahead": "^1.0.0",
@@ -8916,27 +8916,10 @@
"node": ">= 0.4"
}
},
"node_modules/ip-bigint": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/ip-bigint/-/ip-bigint-5.0.3.tgz",
"integrity": "sha512-Tvl0inX9ACOQ0eLKg89nz2gS0l/bxvkqSDs43q4KWUaA2ZlDdeCXNtMx/EEoXPSuLEgWn9Zyr3Ze5N0EpYRnFQ==",
"dependencies": {
"ip-regex": "5.0.0"
},
"engines": {
"node": ">=14"
}
},
"node_modules/ip-regex": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-5.0.0.tgz",
"integrity": "sha512-fOCG6lhoKKakwv+C6KdsOnGvgXnmgfmp0myi3bcNwj3qfwPAxRKWEuFhvEFF7ceYIz6+1jRZ+yguLFAmUNPEfw==",
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
"node_modules/ip-num": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/ip-num/-/ip-num-1.4.1.tgz",
"integrity": "sha512-7+S/V9JGNfJu2aYj5j1uHwL3rij1TeZO/szPTyX+us52a9h9qv9sPMlwl5Ts0T/49zTFHdz1JJeDjcHHFoyDYg=="
},
"node_modules/ipaddr.js": {
"version": "2.0.1",
@@ -21932,18 +21915,10 @@
"side-channel": "^1.0.4"
}
},
"ip-bigint": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/ip-bigint/-/ip-bigint-5.0.3.tgz",
"integrity": "sha512-Tvl0inX9ACOQ0eLKg89nz2gS0l/bxvkqSDs43q4KWUaA2ZlDdeCXNtMx/EEoXPSuLEgWn9Zyr3Ze5N0EpYRnFQ==",
"requires": {
"ip-regex": "5.0.0"
}
},
"ip-regex": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-5.0.0.tgz",
"integrity": "sha512-fOCG6lhoKKakwv+C6KdsOnGvgXnmgfmp0myi3bcNwj3qfwPAxRKWEuFhvEFF7ceYIz6+1jRZ+yguLFAmUNPEfw=="
"ip-num": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/ip-num/-/ip-num-1.4.1.tgz",
"integrity": "sha512-7+S/V9JGNfJu2aYj5j1uHwL3rij1TeZO/szPTyX+us52a9h9qv9sPMlwl5Ts0T/49zTFHdz1JJeDjcHHFoyDYg=="
},
"ipaddr.js": {
"version": "2.0.1"

View File

@@ -29,7 +29,7 @@
"fs-extra": "^10.0.0",
"html-webpack-plugin": "^5.5.0",
"identity-obj-proxy": "^3.0.0",
"ip-bigint": "^5.0.3",
"ip-num": "^1.4.1",
"jest": "^27.4.3",
"jest-resolve": "^27.4.2",
"jest-watch-typeahead": "^1.0.0",

View File

@@ -1,4 +1,4 @@
import { stringifyIp } from 'ip-bigint';
import { IPv4 } from 'ip-num/IPNumber';
import { Quaternion } from 'math3d';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useForm } from 'react-hook-form';
@@ -184,12 +184,9 @@ export function TrackerSettingsPage() {
<Typography color="secondary">Tracker URL</Typography>
<Typography>
udp://
{stringifyIp({
number: BigInt(
tracker?.device?.hardwareInfo?.ipAddress?.addr || 0
),
version: 4,
})}
{IPv4.fromNumber(
tracker?.device?.hardwareInfo?.ipAddress?.addr || 0
).toString()}
</Typography>
</div>
</div>

View File

@@ -12,7 +12,7 @@ import { Typography } from '../commons/Typography';
import { TrackerBattery } from './TrackerBattery';
import { TrackerStatus } from './TrackerStatus';
import { TrackerWifi } from './TrackerWifi';
import { stringifyIp } from 'ip-bigint';
import { IPv4 } from 'ip-num/IPNumber';
export function TrackerNameCol({ tracker }: { tracker: TrackerDataT }) {
const { useName } = useTracker(tracker);
@@ -220,10 +220,9 @@ export function TrackersTable({
>
<Typography color="secondary">
udp://
{stringifyIp({
number: BigInt(device?.hardwareInfo?.ipAddress?.addr || 0),
version: 4,
})}
{IPv4.fromNumber(
device?.hardwareInfo?.ipAddress?.addr || 0
).toString()}
</Typography>
</RowContainer>
))}

7
src/gobals.d.ts vendored
View File

@@ -1,7 +0,0 @@
declare module 'ip-bigint' {
function stringifyIp(options: {
number: bigint;
version: 4 | 6;
ipv4mapped?: boolean;
}): string;
}