Total Pageviews

Saturday 24 June 2017

搭建lightning,用以翻墙

登录linux vps,然后
wget https://cmake.org/files/v3.10/cmake-3.10.1.tar.gz
tar zxvf cmake-3.10.1.tar.gz
cd cmake-3.10.1
./configure
make
make install

cd ..
git clone https://github.com/libuv/libuv
cd libuv
sh autogen.sh
./configure
make
make install
ldconfig 
 
cd ..
git clone https://github.com/neevek/lightning
cd lightning
mkdir build 
cd build
cmake ..  
make (上面必须先编译libuv,否则这步会提示错误:
fatal error: uv.h: No such file or directory。
compilation terminated.) 
 
root@localhost:~/lightning/build# ls
bin  CMakeCache.txt  CMakeFiles  cmake_install.cmake  Makefile
root@localhost:~/lightning/build# cd bin
root@localhost:~/lightning/build/bin# ls
lightning_local  lightning_remote
root@localhost:~/lightning/build/bin# ./lightning_remote -h 0.0.0.0 -p 8790 -c aes-256-cfb -s THE_SECRET --daemon
这样服务器端就运行起来了。
 
在linux桌面系统,也是运行如上的步骤,最后,
cd ~/lightning/build/bin
./lightning_local -h 0.0.0.0 -p 2080 -H REMOTE_HOST_IP -P 8790 -c aes-256-cfb -s THE_SECRET --daemon
这样客户端就运行起来了。
然后设置浏览器的socks5代理服务器为127.0.0.1:2080 ,即可翻墙。
 
项目地址:https://github.com/neevek/lightning 
 
注:如果你的本地机器为mac,则先挂个vpn,然后
brew install openssl

brew install libuv
 
git clone https://github.com/neevek/lightning
cd lightning
nano CMakeLists.txt 
CMakeLists.txt 的第 7 行位置加上以下两行:
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/usr/local/opt/openssl/include")
SET(CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -L/usr/local/opt/openssl/lib")
  
mkdir build 
cd build
cmake ..  (需先编译cmake)
make 


yudeMacBook-Air:build brite$ ls
CMakeCache.txt  Makefile  cmake_install.cmake
CMakeFiles  bin
yudeMacBook-Air:build brite$ cd bin
yudeMacBook-Air:bin brite$ ls
lightning_local  lightning_remote
(在bin目录里生成了lightning_local和lightning_remote这2个可执行文件)
yudeMacBook-Air:bin brite$ ./lightning_local -h 0.0.0.0 -p 2080 -H your_vps_ip -P 8790 -c aes-256-cfb -s THE_SECRET --daemon

这样客户端就运行起来了。然后设置浏览器的socks5代理服务器为127.0.0.1:2080 ,即可翻墙。
如果过段时间后,翻墙失败,则重启客户端即可:
killall lightning_local
./lightning_local -h 0.0.0.0 -p 2080 -H vps_ip -P 8790 -c aes-256-cfb -s THE_SECRET --daemon
参考:https://github.com/neevek/lightning/issues/1
 
注意: 
 
问:最近在用这个翻墙术,不过有时莫名其妙的翻墙失败,
我以为是客户端程序或服务器端程序退出了所致。

但运行命令ps aux|grep lightning_local和ps aux|grep lightning_remote,
发现它们都在运行中。为何会突然翻墙失败呢? 
 
答:我试过重启浏览器之后又恢复正常了,猜测可能是本地端口在某些情况下没正常释放。
 
from https://github.com/neevek/lightning/issues/2 
---------
 

最近用lightning翻墙,感觉不错

http://briteming.blogspot.com/2017/06/lightning.html

主要是它自带“--daemon”参数,不用象v2ray那样要开着terminal才行。
 不过暂时只支持mac,linux桌面系统。程序作者暂未提供windows下的客户端。

因此我强烈建议你买个mac,早日享受多种翻墙术.

No comments:

Post a Comment