ssh2-http-agent
v1.0.1
Published
Http Agent for access the internal network without setup the server on jump station / hop server
Downloads
2
Maintainers
Readme
- Axios Example
import { SSHttpAgent } from "../src";
import Axios from "axios";
const main = async () => {
const agent = new SSHttpAgent(
{
host: "xxx.xxx.xxx.xxx",
username: "root",
password: "12345678",
port: 22,
tryKeyboard: true,
readyTimeout: 2000,
},
{
timeout: 3000,
keepAlive: true,
maxSockets: 5,
maxFreeSockets: 5,
keepAliveMsecs: 1000 * 60 * 60,
}
);
const res = await Axios.post<any>(
"http://internalIP/xxx",
{},
{
httpAgent: this.agent,
}
);
return res.data;
};
- Request Example
import { request } from "http";
import { SSHttpAgent } from "../src";
const main = () => {
const agent = new SSHttpAgent(
{
host: "xxx.xxx.xxx.xxx",
username: "root",
password: "12345678",
port: 22,
tryKeyboard: true,
readyTimeout: 2000,
},
{
timeout: 3000,
keepAlive: true,
maxSockets: 5,
maxFreeSockets: 5,
keepAliveMsecs: 1000 * 60 * 60,
}
);
request(
{
hostname: "",
port: 80,
path: "/",
method: "post",
agent,
},
(res) => {
// ....
}
);
};