Skip to content

Commit

Permalink
refactor: use a better maintained and not vulnerable package to get l…
Browse files Browse the repository at this point in the history
…ocal ip (#93)
  • Loading branch information
nsrCodes authored Jul 8, 2024
1 parent b607ca1 commit 1fda19b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 31 deletions.
50 changes: 25 additions & 25 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@
"@testing-library/jest-dom": "^5.14.1",
"@types/enzyme": "^3.10.9",
"@types/history": "4.7.9",
"@types/ip": "^1.1.0",
"@types/jest": "^27.0.2",
"@types/node": "17.0.23",
"@types/terser-webpack-plugin": "^5.0.4",
Expand Down Expand Up @@ -258,6 +257,7 @@
"@requestly/requestly-proxy": "^1.2.3",
"@sentry/browser": "^6.13.3",
"@sentry/electron": "^2.5.4",
"address": "^2.0.3",
"assert": "^2.0.0",
"async": "^3.2.1",
"axios": "^0.28.0",
Expand Down
5 changes: 2 additions & 3 deletions src/renderer/actions/proxy/getProxyConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import ip from "ip";

import { ip } from "address";
import { staticConfig } from "../../config";
import { getCurrentProxyPort } from "../storage/cacheUtils";

Expand All @@ -10,7 +9,7 @@ interface ProxyConfig {
}

const getProxyConfig = (): ProxyConfig | null => {
const proxyIp = ip.address();
const proxyIp = ip()!;

return {
ip: proxyIp,
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/actions/proxy/startProxyServer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// UTILS
const ip = require("ip");
import {ip} from "address";

import { RQProxyProvider } from "@requestly/requestly-proxy";
import RulesDataSource from "../../lib/proxy-interface/rulesFetcher";
Expand Down Expand Up @@ -44,7 +44,7 @@ export default async function startProxyServer (
Sentry.captureException(error);
logger.log("A proxy server close req was made but no proxy was up");
}
const proxyIp = ip.address();
const proxyIp = ip()!;
const targetPort = proxyPort ? proxyPort : getDefaultProxyPort();

const result: IStartProxyResult = {
Expand Down

0 comments on commit 1fda19b

Please sign in to comment.