2023-03-22 03:46:52 +08:00
|
|
|
const util = require('node:util');
|
|
|
|
const exec = util.promisify(require('node:child_process').exec);
|
|
|
|
const parameters = require('../core/parameters.js');
|
|
|
|
|
|
|
|
const hostname = new URL(parameters.server).hostname;
|
|
|
|
|
|
|
|
async function killConnection() {
|
2023-05-17 21:39:01 +08:00
|
|
|
await exec(`
|
|
|
|
sudo ss -K dst ${hostname} dport https;
|
|
|
|
sudo iptables -A OUTPUT -p tcp -d ${hostname} --dport 443 -j DROP;
|
|
|
|
sleep 1;
|
|
|
|
sudo iptables -D OUTPUT -p tcp -d ${hostname} --dport 443 -j DROP;
|
|
|
|
`);
|
|
|
|
|
2023-03-22 03:46:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
exports.killConnection = killConnection;
|