JAP是APJP作者开发的一个全新免费开源代理方案,是一个使用JavaScript编写的SOCKS5代理。JAP使用WebSocket协议HTTP(未加密)和HTTPS(加密:AES-256,256位密钥)。可以在支持Node.js的云平台或者VPS搭建该SOCKS5代理。
项目:http://code.google.com/p/jap/
源码:https://github.com/jvansteirteghem/jap
教程:http://code.google.com/p/jap/w/list
反馈:http://code.google.com/p/jap/issues/list
使用方法:
首先,安装NODE
install NODE on WINDOWS, LINUX and MAC OS X
You can download NODE installers for WINDOWS, LINUX and MAC OS X here: http://nodejs.org/download/
You can download NODE source here: http://nodejs.org/download/
More information: https://github.com/joyent/node/wiki/Installation
其次,了解下服务器端部署大致流程,再看一些官方给出的几个配置示例
Install JAP_REMOTE_NODE
Pre-installation
Installation
- HTTP
- unzip JAP_REMOTE_NODE-X.X.X.zip
- open JAP_REMOTE_NODE-X.X.X
- configure JAP_REMOTE_NODE.json.js (examples)
- REMOTE_PROXY_SERVER.TYPE = “HTTP”
- REMOTE_PROXY_SERVER.ADDRESS
- REMOTE_PROXY_SERVER.PORT
- REMOTE_PROXY_SERVER.AUTHENTICATION[X].USERNAME
- REMOTE_PROXY_SERVER.AUTHENTICATION[X].PASSWORD
- execute JAP_REMOTE_NODE.bat
- HTTPS
- unzip JAP_REMOTE_NODE-X.X.X.zip
- open JAP_REMOTE_NODE-X.X.X
- execute CA.bat
- configure C.ini
- countryName_default
- stateOrProvinceName_default
- localityName_default
- organizationName_default
- organizationalUnitName_default
- commonName_default = IP or DNS of REMOTE_PROXY_SERVER
- DNS.1 = DNS of REMOTE_PROXY_SERVER
- IP.1 = IP of REMOTE_PROXY_SERVER
- execute C.bat
- configure JAP_REMOTE_NODE.json.js (examples)
- REMOTE_PROXY_SERVER.TYPE = “HTTPS”
- REMOTE_PROXY_SERVER.ADDRESS
- REMOTE_PROXY_SERVER.PORT
- REMOTE_PROXY_SERVER.AUTHENTICATION[X].USERNAME
- REMOTE_PROXY_SERVER.AUTHENTICATION[X].PASSWORD
- REMOTE_PROXY_SERVER.CERTIFICATE.KEY.FILE = “CK.pem”
- REMOTE_PROXY_SERVER.CERTIFICATE.FILE = “C.pem”
- execute JAP_REMOTE_NODE.bat
examples
Example 1: LOCAL_PROXY_SERVER — INTERNET — REMOTE_PROXY_SERVER (HTTP)
JAP_LOCAL_NODE.json.js
module.exports = { "LOCAL_PROXY_SERVER": { "ADDRESS": "127.0.0.1", "PORT": 1080 }, "REMOTE_PROXY_SERVERS": [ { "TYPE": "HTTP", "ADDRESS": "1.2.3.4", "PORT": 8080, "AUTHENTICATION": { "USERNAME": "1", "PASSWORD": "1" } } ] }
JAP_REMOTE_NODE.json.js
module.exports = { "REMOTE_PROXY_SERVER": { "TYPE": "HTTP", "PORT": 8080, "AUTHENTICATION": [ { "USERNAME": "1", "PASSWORD": "1" }, { "USERNAME": "2", "PASSWORD": "2" } ] } }
Example 2: LOCAL_PROXY_SERVER — INTERNET — REMOTE_PROXY_SERVER (HTTPS)
JAP_LOCAL_NODE.json.js
module.exports = { "LOCAL_PROXY_SERVER": { "ADDRESS": "127.0.0.1", "PORT": 1080 }, "REMOTE_PROXY_SERVERS": [ { "TYPE": "HTTPS", "ADDRESS": "1.2.3.4", "PORT": 8080, "AUTHENTICATION": { "USERNAME": "1", "PASSWORD": "1" }, "CERTIFICATE": { "AUTHENTICATION": { "FILE": "CA.pem" } } } ] }
JAP_REMOTE_NODE.json.js
module.exports = { "REMOTE_PROXY_SERVER": { "TYPE": "HTTPS", "PORT": 8080, "AUTHENTICATION": [ { "USERNAME": "1", "PASSWORD": "1" }, { "USERNAME": "2", "PASSWORD": "2" } ], "CERTIFICATE": { "KEY": { "FILE": "CK.pem" }, "FILE": "C.pem" } } }
Example 3: LOCAL_PROXY_SERVER — PROXY_SERVER — INTERNET — REMOTE_PROXY_SERVER (HTTPS)
JAP_LOCAL_NODE.json.js
module.exports = { "LOCAL_PROXY_SERVER": { "ADDRESS": "127.0.0.1", "PORT": 1080 }, "REMOTE_PROXY_SERVERS": [ { "TYPE": "HTTPS", "ADDRESS": "1.2.3.4", "PORT": 8080, "AUTHENTICATION": { "USERNAME": "1", "PASSWORD": "1" }, "CERTIFICATE": { "AUTHENTICATION": { "FILE": "CA.pem" } } } ], "PROXY_SERVER": { "ADDRESS": "1.2.3.4", "PORT": 8080, "AUTHENTICATION": { "USERNAME": "1", "PASSWORD": "1" } } }
JAP_REMOTE_NODE.json.js
module.exports = { "REMOTE_PROXY_SERVER": { "TYPE": "HTTPS", "PORT": 8080, "AUTHENTICATION": [ { "USERNAME": "1", "PASSWORD": "1" }, { "USERNAME": "2", "PASSWORD": "2" } ], "CERTIFICATE": { "KEY": { "FILE": "CK.pem" }, "FILE": "C.pem" } } }
Example 4: LOCAL_PROXY_SERVER — INTERNET — PROXY_SERVER (DOTCLOUD) — REMOTE_PROXY_SERVER (HTTP)
JAP_LOCAL_NODE.json.js
module.exports = { "LOCAL_PROXY_SERVER": { "ADDRESS": "127.0.0.1", "PORT": 1080 }, "REMOTE_PROXY_SERVERS": [ { "TYPE": "HTTPS", "ADDRESS": "1-2.dotcloud.com", "PORT": 443, "AUTHENTICATION": { "USERNAME": "1", "PASSWORD": "1" } } ] }
JAP_REMOTE_NODE.json.js
module.exports = { "REMOTE_PROXY_SERVER": { "TYPE": "HTTP", "PORT": 8080, "AUTHENTICATION": [ { "USERNAME": "1", "PASSWORD": "1" }, { "USERNAME": "2", "PASSWORD": "2" } ] } }
然后,就可以在免费的dotCloud云平台或者自己的VPS上搭建服务器端了
install JAP_REMOTE_NODE_DOTCLOUD
Pre-installation
Installation
- unzip JAP_REMOTE_NODE_DOTCLOUD-X.X.X.zip
- open JAP_REMOTE_NODE_DOTCLOUD-X.X.X
- configure JAP_REMOTE_NODE.json.js (examples– example 4)
- REMOTE_PROXY_SERVER.TYPE = “HTTP”
- REMOTE_PROXY_SERVER.ADDRESS = “”
- REMOTE_PROXY_SERVER.PORT = 8080
- REMOTE_PROXY_SERVER.AUTHENTICATION[X].USERNAME
- REMOTE_PROXY_SERVER.AUTHENTICATION[X].PASSWORD
- open CONSOLE
- $ cd JAP_REMOTE_NODE_DOTCLOUD-X.X.X
- $ dotcloud create APPLICATION-ID
- $ dotcloud push APPLICATION-ID
install VPS
# install NODE
wget http://nodejs.org/dist/v0.8.14/node-v0.8.14.tar.gz
tar xvzf node-v0.8.14.tar.gz
cd node-v0.8.14
./configure
make
sudo make install
cd ..
sudo ln -s /usr/local/bin/node /usr/bin/node
sudo ln -s /usr/local/lib/node /usr/lib/node
sudo ln -s /usr/local/bin/npm /usr/bin/npm
sudo ln -s /usr/local/bin/node-waf /usr/bin/node-waf
sudo node -v
# install JAP_REMOTE_NODE
wget http://jap.googlecode.com/files/JAP_REMOTE_NODE-0.2.0.zip
unzip JAP_REMOTE_NODE-0.2.0.zip
cd JAP_REMOTE_NODE-0.2.0
# generate certificate
rm CAK.pem
rm CA.pem
rm CA.srl
openssl genrsa -des3 -out CAK.pem 2048
openssl req -new -x509 -days 3650 -key CAK.pem -out CA.pem -config CA.ini
rm CK.pem
rm CR.pem
rm C.pem
# configure C.ini
nano C.ini
openssl genrsa -out CK.pem 1024
openssl req -new -key CK.pem -out CR.pem -config C.ini
openssl x509 -req -in CR.pem -out C.pem -CA CA.pem -CAkey CAK.pem -CAcreateserial -days 3650 -extensions v3_req -extfile C.ini
# configure JAP_REMOTE_NODE.json.js
nano JAP_REMOTE_NODE.json.js
# start JAP_REMOTE_NODE
sudo nohup node JAP_REMOTE_NODE.js &
# stop JAP_REMOTE_NODE
# ps -ef
# kill -9 <id>
最后,就是JAP代理本机的配置方法了
install JAP_LOCAL_NODE
# install NODE
wget http://nodejs.org/dist/v0.8.14/node-v0.8.14.tar.gz
tar xvzf node-v0.8.14.tar.gz
cd node-v0.8.14
./configure
make
sudo make install
cd ..
sudo ln -s /usr/local/bin/node /usr/bin/node
sudo ln -s /usr/local/lib/node /usr/lib/node
sudo ln -s /usr/local/bin/npm /usr/bin/npm
sudo ln -s /usr/local/bin/node-waf /usr/bin/node-waf
sudo node -v
# install JAP_REMOTE_NODE
wget http://jap.googlecode.com/files/JAP_REMOTE_NODE-0.2.0.zip
unzip JAP_REMOTE_NODE-0.2.0.zip
cd JAP_REMOTE_NODE-0.2.0
# generate certificate
rm CAK.pem
rm CA.pem
rm CA.srl
openssl genrsa -des3 -out CAK.pem 2048
openssl req -new -x509 -days 3650 -key CAK.pem -out CA.pem -config CA.ini
rm CK.pem
rm CR.pem
rm C.pem
# configure C.ini
nano C.ini
openssl genrsa -out CK.pem 1024
openssl req -new -key CK.pem -out CR.pem -config C.ini
openssl x509 -req -in CR.pem -out C.pem -CA CA.pem -CAkey CAK.pem -CAcreateserial -days 3650 -extensions v3_req -extfile C.ini
# configure JAP_REMOTE_NODE.json.js
nano JAP_REMOTE_NODE.json.js
# start JAP_REMOTE_NODE
sudo nohup node JAP_REMOTE_NODE.js &
# stop JAP_REMOTE_NODE
# ps -ef
# kill -9 <id>
最后,就是JAP代理本机的配置方法了
install JAP_LOCAL_NODE
Pre-installation
Installation
- unzip JAP_LOCAL_NODE-X.X.X.zip
- open JAP_LOCAL_NODE-X.X.X
- configure JAP_LOCAL_NODE.json.js (examples)
- LOCAL_PROXY_SERVER.ADDRESS
- LOCAL_PROXY_SERVER.PORT
- HTTP
- REMOTE_PROXY_SERVERS[X].TYPE = “HTTP”
- REMOTE_PROXY_SERVERS[X].ADDRESS
- REMOTE_PROXY_SERVERS[X].PORT
- REMOTE_PROXY_SERVERS[X].AUTHENTICATION.USERNAME
- REMOTE_PROXY_SERVERS[X].AUTHENTICATION.PASSWORD
- HTTPS
- REMOTE_PROXY_SERVERS[X].TYPE = “HTTPS”
- REMOTE_PROXY_SERVERS[X].ADDRESS
- REMOTE_PROXY_SERVERS[X].PORT
- REMOTE_PROXY_SERVERS[X].AUTHENTICATION.USERNAME
- REMOTE_PROXY_SERVERS[X].AUTHENTICATION.PASSWORD
- REMOTE_PROXY_SERVER.CERTIFICATE.AUTHENTICATION.FILE = “CA.pem”
- PROXY_SERVER.ADDRESS
- PROXY_SERVER.PORT
- PROXY_SERVER.AUTHENTICATION.USERNAME
- PROXY_SERVER.AUTHENTICATION.PASSWORD
- execute JAP_LOCAL_NODE.bat
- open
- FIREFOX
- click TOOLS, OPTIONS
- click ADVANCED, NETWORK, SETTINGS
- check MANUAL PROXY CONFIGURATION
- in SOCKS write 127.0.0.1 and LOCAL_PROXY_SERVER.PORT
- check SOCKS v5
- click OK
- click OK
- INTERNET EXPLORER
- click TOOLS, INTERNET OPTIONS
- click CONNECTIONS, LAN SETTINGS
- uncheck AUTOMATICALLY DETECT PROXY SETTINGS
- uncheck USE A PROXY AUTOMATIC CONFIGURATION SCRIPT
- check USE A PROXY SERVER FOR YOUR LAN (THESE SETTINGS WILL NOT APPLY TO DAIL-UP OR VPN CONNECTIONS)
- click ADVANCED
- in SOCKS write 127.0.0.1 and LOCAL_PROXY_SERVER.PORT
- click OK
- click OK
- click OK
- FIREFOX
配置成功后就可以设置浏览器代理了。
以上官方教程都是JAP兼APJP的作者@ jvansteirteghem写的,由于他是个外国人,不懂中文所以教程是英文的.
note:搭建成功后,JAP_LOCAL_NODE.json.js 按照Example 4,设置成HTTPS模式,连接成功.
APJP是“纯正”的HTTP + HTTPS proxy,而JAP基本上是支持完整的TCP,这意味着JAP无需fake的证书,可用于客户端程序等。
JAP是新建的项目,仍需一点时间成熟起来的。程序如有什么bug,或者有什么建议,到Issue页详细描述.
related post: http://briteming.blogspot.com/2012/02/apjp.html
related post: http://briteming.blogspot.com/2012/02/apjp.html