Socket
Socket
Sign inDemoInstall

@jolduca/vpn-fetch

Package Overview
Dependencies
22
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jolduca/vpn-fetch

Start multiple vpn servers and make network requests through them


Version published
Maintainers
1
Weekly downloads
1

Weekly downloads

Readme

Source

Install

Dependencies

This package depends on openvpn, net-tools and pkill

sudo apt install openvpn net-tools procps

NPM install:

npm install vpn-fetch

About

I created this package out of necessity, and as I haven’t found anything similar in my research I decided to publish it to help anyone out there who are in the same rabbit role that I went trying to achieve the functionality. It is heavily based on this blog post found in this question. To make the network requests it uses the got package, as it supports the localAddress option.

When executed, it will ask for the root password, it is asked because the openvpn client needs to be run as sudo.

Example

The VPNFetch constructor takes the VPN config file, and a txt file with the VPN server username and password sepparated by a newline.

const configFiles = await readdir("/etc/openvpn/ovpn_tcp");
const randomConfig =
  configFiles[Math.floor(Math.random() * configFiles.length)];

const vpnFetch = new VPNFetch(
  "/etc/openvpn/ovpn_tcp/" + randomConfig,
  "./login_information"
);
await vpnFetch.connect();
const response = await vpnFetch.get("https://ifconfig.me/ip");
console.log("IP:", response.body);
vpnFetch.disconnect();

Keywords

FAQs

Last updated on 17 Apr 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc