这个只是个人小实验,请勿用于生产环境
可以这样配置部署:
# 安装
apt-get update
apt-get install dante-server
adduser --no-create-home --shell /usr/sbin/nologin dante-socks
# 启动代理
nohup /usr/sbin/danted -f /etc/danted.conf&
# 本机验证转发
curl -x socks5h://127.0.0.1:10080 -m 5 http://httpbin.org/get | grep origin
/etc/danted.conf
internal: 0.0.0.0 port = 10080
external: eth0
errorlog: /mnt/danted/sockd.errlog
logoutput: /mnt/danted/sockd.log
user.notprivileged: dante-socks
clientmethod: none
socksmethod: none
client pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: error connect disconnect iooperation
}
socks pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
command: bindreply udpreply connect bind udpassociate
log: error connect disconnect iooperation
}
#block incoming connections/packets from ftp.example.org
socks block {
from: 0.0.0.0/0 to: ftp.example.org
command: bindreply udpreply
log: error # connect disconnect iooperation
}
https://www.inet.no/dante/doc/1.4.x/config/bandwidth.html
socks pass {
from: 0.0.0.0/0 to: 0.0.0.0/0 port http
command: connect
log: error # connect disconnect iooperation
bandwidth: 102400 #100kbps
}
https://www.inet.no/dante/doc/1.4.x/config/redirect.html
socks pass {
from: 10.0.0.0/24 to: 0.0.0.0/0 port = http
command: connect
redirect to: squid.example.com port = 3128
}
wget https://www.inet.no/dante/files/dante-1.4.4.tar.gz
github上有一个unofficial copy,tag打得比较全,可以方便查看修改历史。
https://github.com/notpeter/dante
可以搭配frp端口转发使用。所以有三种转发端口的方式。
ssh -L 0.0.0.0:10080:192.168.0.3:10080 [email protected]
注意到frp的xtcp:https://gofrp.org/zh-cn/docs/features/xtcp/
使用的是tls1.3
细节见:https://gofrp.org/zh-cn/docs/features/common/network/network/
不需要额外配置,使用xtcp,默认就是tls1.3
frp支持 QUIC 协议
底层通信协议支持选择 QUIC 协议,底层采用 UDP 传输,解决了 TCP 上的一些问题,传输效率更高,连接延迟低。
# frps.toml
bindPort = 7000
# QUIC 绑定的是 UDP 端口,可以和 bindPort 一样
quicBindPort = 7000