GithubHelp home page GithubHelp logo

kneesocks's Introduction

kneesocks

npm version build status

Put some nice SOCKS on your HTTP only program

Motivation

Driven by my burning desire to tunnel npm install requests through a SOCKSv5 proxy (eg. shadowsocks). Since npm only support HTTP proxy, I wrote this simple command line module to fire up a HTTP Proxy server, then use it to tunnel requests to my SOCKS proxy.

Features

  • Supports HTTP and HTTPS requests
  • Built-in DNS cache
  • 150 loc, does nothing else

Install

npm install kneesocks --production -g

Usage

kneesocks port1 port2, eg. kneesocks 10001 10002

  • port1 is the port your HTTP proxy server listen to on localhost.
  • port2 is the port of your existing SOCKS proxy, also on localhost.

Then you can set your npm config:

  • npm config set http http://127.0.0.1:10001
  • npm config set https-proxy http://127.0.0.1:10001

To revert proxy config, use npm config delete http and npm config delete https-proxy.

To debug, use DEBUG=proxy kneesocks port1 port2

Limit

  • Node v0.10+ required (Node v0.11+ preferred).
  • Probably not the best solution for day-to-day browsing, due to lack of remote dns and websocket support.
  • If you don't mind building binaries, use DeleGate or Polipo instead.

License

MIT

kneesocks's People

Contributors

bitinn avatar

Stargazers

Maxwell Bloch avatar Libra avatar  avatar x0x8x avatar WangXiaolong avatar  avatar  avatar  avatar Xi Lin avatar cloudroc avatar  avatar momo avatar Leo avatar ruiming avatar TZ | 天猪 avatar Zhang Rui avatar Femtedele avatar  avatar Victor avatar nendo avatar Daniel Liu avatar BitMind avatar  avatar 大香蕉 avatar Song Zhou avatar John avatar Feng Qiang avatar Zhao Zugang avatar Ken avatar jaeheng avatar Ehsan Ghasemlou avatar Jack avatar Wang Zishi avatar seaify avatar  avatar wang avatar Ning Luo avatar  avatar icefox0801 avatar xzper avatar snowdream avatar  avatar yahuo avatar Jyun Hong Su avatar medifle avatar toast avatar 库洛兰斯 avatar Leo Hui avatar Lenic avatar Luke Wang avatar frozenwings avatar Mike Lei avatar  avatar Tao avatar Oaker avatar  avatar Huang Chen avatar Ling Yang avatar leon avatar Su Yang avatar  avatar  avatar 面条 avatar  avatar 脉脉不得语 avatar Lim Sze Seong avatar Jiyee Sheng avatar

Watchers

James Cloos avatar cfwings avatar  avatar x0x8x avatar 陆小凤 avatar ZhangRui  avatar  avatar medifle avatar nendo avatar  avatar

kneesocks's Issues

Stuck

It is stuck when run kneesocks port1 port2

update socksv5 version

lastest version of socksv5 is 0.0.6, which includes ipv6 dependency, which current 0.0.4 version is missing.

It come to an error when running

/usr/local/lib/node_modules/kneesocks/node_modules/socksv5/lib/client.js:225
var args = normalizeConnectArgs(arguments),
^

TypeError: normalizeConnectArgs is not a function
at Agent.exports.connect.exports.createConnection (/usr/local/lib/node_modules/kneesocks/node_modules/socksv5/lib/client.js:225:14)
at Agent.createSocket (/usr/local/lib/node_modules/kneesocks/node_modules/socksv5/lib/Agents.js:225:21)
at Agent.addRequest (/usr/local/lib/node_modules/kneesocks/node_modules/socksv5/lib/Agents.js:194:23)
at new ClientRequest (_http_client.js:159:16)
at Object.request (http.js:26:10)
at Server. (/usr/local/lib/node_modules/kneesocks/lib/kneesocks.js:81:22)
at emitTwo (events.js:106:13)
at Server.emit (events.js:191:7)
at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:547:12)
at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)

Error in use

operating system:window 7 64
nodejs : v5.10.1

npm : 3.8.7

image

请问 npm 支持 Shadowsocks 的 PAC 模式吗?

Shadowsocks-windows 提供了 socks5 和 http 两个代理,所以在 Windows 上设置 npm 代理其实不成问题。

问题是,如果 npm 使用了淘宝源,这时候如果再用代理,就特别慢。而如果不用代理,一些需要从亚马逊 S3 云服务器上下载的 tarball 就会下载特别龟速。

所以,更希望 npm 能支持 Shadowsocks 的 PAC 模式~不知道有没有头绪?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.