1.1.1 • Published 2 years ago

node-https-socks5-proxy v1.1.1

Weekly downloads
7
License
ISC
Repository
-
Last release
2 years ago

node-https-socks5-proxy

###简介 使用 socks5 代理转发 nodejs 的 http/https 请求 ###安装

npm i node-https-socks5-proxy

###使用

import * as https from "https";
import * as ProxySocket from "node-https-socks5-proxy";

const HOST = "www.google.com";
const PORT = 443;
const PATH = "/";
//转发到本地的ssr客户端
const PROXY_HOST = "127.0.0.1";
const PROXY_PORT = 1086;

const req = https.request(
  {
    host: HOST,
    path: PATH,
    port: PORT,
    createConnection: (opt, oncreate) => {
      ProxySocket.createConnection(
        {
          proxyHost: PROXY_HOST,
          proxyPort: PROXY_PORT,
          port: PORT,
          host: HOST,
          https: true,
        },
        oncreate
      );
      return null;
    },
  },
  (res) => {
    console.log(res.headers);
    console.log(res.statusCode);
    console.log(res.statusMessage);
    res.on("data", (buf) => {
      console.log(buf.toString("utf-8"));
    });
  }
);
req.end();
1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago