Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use a maintained and not vulnerable alternative to get local ip address #93

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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