Node.js/pm2 - Can't kill TCP connection

删除回忆录丶 提交于 2020-01-25 10:12:27

问题


I'm trying to use NordVPN like a standard web proxy by adding the proxy to the request options like so:

const request = require('request-promise');
const options = {
    url: 'https://icanhazip.com',
    proxy: 'tcp://email@email.com:pass@us349.nordvpn.com',
}
const res = await request.get(options); // returns the NordVPN server ip address

This works, however, NordVPN allows a maximum of 6 connections and when the proxy url is changed, the previous connection stays open.

I see that I can run sudo lsof -iTCP -sTCP:LISTEN -n -P in order to get the process ID for the node process with the connection, however, when running pm2, attempting to kill the node TCP connection does not work - it simply restarts.

Is there a way to destroy the connection without killing pm2?

来源:https://stackoverflow.com/questions/58404966/node-js-pm2-cant-kill-tcp-connection

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!