Total Pageviews

Sunday, 10 May 2020

利用rsnova翻墙

在linux vps上。首先安装rust环境,然后,
git clone https://github.com/yinqiwen/rsnova rsnova-by-yinqiwen
cd rsnova-by-yinqiwen
cargo build --release
(此命令完成后,在当前目录下会生成target目录)
cd target/release

[root@vps release]# ls
build  examples     librsnova.d     rsnova    rsnova_rCURRENT.log
deps   incremental  librsnova.rlib  rsnova.d
[root@vps release]# cp ../../server.toml ./
[root@vps release]# nano server.toml
[root@vps release]# cat server.toml
[log]
logtostderr = true
level = "info"
logdir = "./"


[[tunnel]]
# listen address of tunnel server
listen = "rmux://0.0.0.0:48101"
# pac rule to relay traffic, 'direct' is special channel which relay direct to remote target server
pac=[{host = ".*", channel = "direct"}]
cipher = {key="mypassword", method = "chacha20poly1305"}

[[tunnel]]
# listen address of tunnel server
listen = "ws://0.0.0.0:48102"
# pac rule to relay traffic, 'direct' is special channel which relay direct to remote target server
pac=[{host = ".*", channel = "direct"}]
cipher = {key="${WS_CIPHER_KEY}", method = "chacha20poly1305"}

我唯一修改了橘黄色部分。然后运行:
./rsnova -c server.toml
不过此命令是运行在前台的,我们可以利用systemd把它运行为service:
nano /etc/systemd/system/rsnova.service
cat /etc/systemd/system/rsnova.service
[Unit]
After=network.target

[Service]
ExecStart=/root/rsnova-by-yinqiwen/target/release/rsnova -c /root/rsnova-by-yinqiwen/target/release/server.toml
Restart=always

[Install]
WantedBy=multi-user.target

然后运行:
systemctl start rsnova
systemctl enable rsnova
服务器端搭建完成。

在客户机器mac上。
首先安装rust环境,然后,
git clone https://github.com/yinqiwen/rsnova rsnova-by-yinqiwen
cd rsnova-by-yinqiwen
cargo build --release
(此命令完成后,在当前目录下会生成target目录)
cd target/release
sudo cp ../../client.toml ./
nano client.toml
cat client.toml
[log]
logtostderr = true
level = "info"
logdir = "./"

[[tunnel]]
listen = "127.0.0.1:48100"
pac=[{host = ".*", channel = "rmux"}]

[[channel]]
# name of current channel
name = "rmux"
# host & port of server
url = "vps-public-ip:48101"
ping_interval_sec = 10
conns_per_host = 1
max_alive_mins = 40
# cipher to communicate with server
cipher = {key="mypassword", method = "chacha20poly1305"}


# [[channel]]
# name = "ws"
# url = "wss://testapp.herokuapp.com:443"
# ping_interval_sec = 10
# conns_per_host = 5
# max_alive_mins = 70
# cipher = {key="abcdefg", method = "chacha20poly1305"}
# work_time_frame=[7,22]  #only work between 7am to 22pm
# sni= "www.herokuapp.com"
# sni_proxy="10.10.10.10"

然后运行:
sudo ./rsnova -c client.toml
不要关闭此terminal.然后设置chrome的socks5代理服务器地址为127.0.0.1 ,端口为48100 ,chrome即可翻墙。
设置chrome的http代理服务器地址为127.0.0.1 ,端口为48100 ,chrome也可翻墙。








No comments:

Post a Comment