tinyproxy
A tiny transparent proxy with http/https support、socks5 forward and mock feature.
Last updated 4 years ago by jin5354 .
MIT · Original npm · Tarball · package.json
$ cnpm install tinyproxy 
SYNC missed versions from official npm registry.

tinyproxy

支持http、https的透明转发代理,支持抓包改包,目前支持socks5的二次转发。

使用

let proxy = new tinyProxy({
    port: 9999,
    agent: 'http'
});

proxy.start();
console.log(`proxy started! Listening on port 9999.`);

可配置项:

{
    port: 9999,
    agent: 'http',
    mock: mock,  //是否启用mock模式
    onServerError: function(){},
    onBeforeRequest: function(){},
    onBeforeResponse: function(){},
    onRequestError: function(){}
}


//mock 处理函数

let mock = (req, res, requestOptions) => {  //req:原始请求 res:回送数据 requestOptions:处理后的req,可以直接用于request库
    console.log(`MOCK ${req.method}: ${req.url}`);
    res.writeHead(result.statusCode, '', result.headers); //自己的mock数据...
    res.end(result.body);
};

license

MIT

致谢

mini-proxy

Current Tags

  • 0.1.9                                ...           latest (4 years ago)

10 Versions

  • 0.1.9                                ...           4 years ago
  • 0.1.8                                ...           4 years ago
  • 0.1.7                                ...           4 years ago
  • 0.1.6                                ...           4 years ago
  • 0.1.5                                ...           4 years ago
  • 0.1.4                                ...           4 years ago
  • 0.1.3                                ...           4 years ago
  • 0.1.2                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 11
This Month 14
Last Day 1
Last Week 1
Last Month 1
Dependencies (4)
Dev Dependencies (0)
None
Dependents (1)

Copyright 2014 - 2016 © taobao.org |