Total Pageviews

Thursday 23 April 2020

利用shadowducks翻墙(速度不错)

登陆linux vps.
首先搭建java环境:
apt-get install -y default-jdk或者openjdk-8-jdk 
(centos系统下,则yum install -y java-1.8.0-openjdk)
这样jdk环境就搭建好了。

接着是搭建maven环境:
建议这样安装Maven:
apt-get install -y maven*
(yum install -y maven*)
运行 mvn -version 命令,检验是否正确地安装了 Maven.

然后,
git clone https://github.com/netfreer/shadowducks  shadowducks-by-netfreer。
cd shadowducks-by-netfreer
mvn package
此命令会在./shadowducks-server/下面生成target目录。
cd shadowducks-server/target
java -jar shadowducks-server-1.0-SNAPSHOT-jar-with-dependencies.jar
会显示:
...
20-04-23 17:16:16 [main] INFO  c.g.n.s.s.DucksServer - Start listen tcp port 0.0.0.0 on address 2999, method: aes-256-cfb, password: password.
20-04-23 17:16:16 [main] INFO  c.g.n.s.s.DucksServer - Start listen udp port 0.0.0.0 on address 2999, method: aes-256-cfb, password: password.
20-04-23 17:16:16 [main] INFO  c.g.n.s.s.DucksServer - start server success !

先按ctrl+c,终止运行此命令。
cd /root/shadowducks-by-netfreer/
grep -r -n 2999 .
显示:
./shadowducks-common/src/main/java/com/github/netfreer/shadowducks/common/config/ConfigUtil.java:17:        int port = 2999;


于是,
nano ./shadowducks-common/src/main/java/com/github/netfreer/shadowducks/common/config/ConfigUtil.java
(在ConfigUtil.java文件的第17行,改2999为3999.在第24行,把password的值改为你的密码,比如yourpassword)
rm -rf ./shadowducks-server/target/
mvn package
ls shadowducks-server
显示:
pom.xml  src  target
(可以见到重新生成了target目录。)
cd shadowducks-server/target
java -jar shadowducks-server-1.0-SNAPSHOT-jar-with-dependencies.jar
会显示:
...
20-04-23 17:38:07 [main] INFO  c.g.n.s.s.DucksServer - Start listen tcp port 0.0.0.0 on address 3999, method: aes-256-cfb, password: yourpassword.
20-04-23 17:38:07 [main] INFO  c.g.n.s.s.DucksServer - Start listen udp port 0.0.0.0 on address 3999, method: aes-256-cfb, password: yourpassword.
20-04-23 17:38:07 [main] INFO  c.g.n.s.s.DucksServer - start server success !

不过命令:java -jar shadowducks-server-1.0-SNAPSHOT-jar-with-dependencies.jar是运行在前台的,我们可以使用systemd把它运行为service:
nano /etc/systemd/system/shadowducks.service
cat /etc/systemd/system/shadowducks.service
[Unit]
After=network.target

[Service]
WorkingDirectory=/root/shadowducks-by-netfreer/shadowducks-common/src/main/java/com/github/netfreer/shadowducks/common/config/
ExecStart=/usr/bin/java -jar /root/shadowducks-by-netfreer/shadowducks-server/target/shadowducks-server-1.0-SNAPSHOT-jar-with-dependencies.jar
Restart=always

[Install]
WantedBy=multi-user.target

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

至于客户端,兼容各大平台下的ss客户端程序。把4个参数填入即可。

项目地址:https://github.com/netfreer/shadowducks

No comments:

Post a Comment