Total Pageviews

Monday, 5 April 2021

利用wsSocks-by-Mikubill翻墙

 在linux vps上,首先安装go1.16.3环境,然后,

git clone https://github.com/Mikubill/wsSocks wsSocks-by-Mikubill

cd wsSocks-by-Mikubill

go install (因为进入的目录里面有go.mod和go.sum文件)

which wsSocks

显示:

/root/go1.16/go/gopath/bin/wsSocks


cd ~

wsSocks -h

wsSocks server -h

wsSocks client -h


mkdir ~/wsSocks-certs

cd ~/wsSocks-certs

wsSocks cert --hosts vps-public-ip

(当前目录下,会生成root.key和root.pem文件)

wsSocks server -l wss://vps-public-ip:2333/ws --cert root.pem --key root.key --auth mypassword

会显示:

INFO[0000] Listening at wss://vps-public-ip:2333/ws 

此命令是运行在前台的。


boa /root/go1.16/go/gopath/bin/wsSocks server -l wss://vps-public-ip:2333/ws --cert /root/wsSocks-certs/root.pem --key /root/wsSocks-certs/root.key --auth mypassword && reboot

服务器端搭建完成。



在客户机器Mac上。改回使用go1.15.3:

nano ~/.profile

cat ~/.profile

显示:

...

#export PATH=$PATH:~/go1.16.3/go/bin

#export GOROOT=~/go1.16.3/go

#export GOPATH=~/go1.16.3/go/gopath

#export PATH=$PATH:~/go1.16.3/go/gopath/bin


export PATH=$PATH:~/go1.15.3/go/bin

export GOROOT=~/go1.15.3/go

export GOPATH=~/go1.15.3/go/gopath

export PATH=$PATH:~/go1.15.3/go/gopath/bin

...


然后,

~/.profile


cd $GOPATH

go get -u -v github.com/Mikubill/wsSocks/


which wsSocks

显示:

~/go1.15.3/go/bin/wsSocks


cd ~

wsSocks -h

wsSocks server -h

wsSocks client -h


wsSocks client --server wss://vps-public-ip:2333/ws --listen 127.0.0.1:2356 --auth mypassword --insecure 


不要关闭此terminal。设置浏览器的socks5代理地址为127.0.0.1 ,端口为2356,浏览器即可翻墙。


项目地址:https://github.com/Mikubill/wsSocks


要刷新一下,才看得到被封的网页。


类似的项目文章:

https://briteming.blogspot.com/2020/10/wssocks.html

https://briteming.blogspot.com/2020/05/websocks.html

https://briteming.blogspot.com/2018/04/haskellwstunnel-by-erebe.html



No comments:

Post a Comment