自签名证书
openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 3650 -out certificate.pem
服务端
- 下载 GitHub Release https://github.com/HyNetwork/hysteria/releases
创建配置文件 config.json
{
"listen": ":443",
"cert": "/etc/hysteria/certificate.pem",
"key": "/etc/hysteria/key.pem",
"up_mbps": 300,
"down_mbps": 300,
"obfs": "dankdhsawj"
}
可选的 obfs 选项使用提供的密码对协议进行混淆,这样协议就不容易被检测出是 Hysteria/QUIC,可以用来绕过针对性的 DPI 屏蔽或者 QoS。 如果服务端和客户端的密码不匹配就不能建立连接,因此这也可以作为一个简单的密码验证。
up_mbps
和down_mbps
用来限制每个客户端最大下载速度和上传速度,可选
运行
hysteria server
- 即可。使用
-config
参数指定配置文件路径
hysteria -config /etc/hysteria/config.json server
客户端
iOS
iOS 可以使用 shadowrocket,混淆字段写 obfs 的值,密码留空,允许不安全勾选
shadowrocket 测速会显示超市,延迟测试方法改成 CONNECT 就好了,可能是个 bug
Linux
{
"server": "1.1.1.1:443",
"obfs": "1231",
"up_mbps": 300,
"down_mbps": 300,
"socks5": {
"listen": "127.0.0.1:1080"
},
"insecure": true
}
- 然后直接运行
hysteria
就可以,之后可以用 proxychains 之类的工具了。如有需要也可以添加 http 字段
"http": {
"listen": "127.0.0.1:8080"
}
systemd 自动启动
/lib/systemd/system/hysteria.service
- 如果是 systemd 的话,写个单元文件
[Unit]
Description=Hysteria
After=network.target network-online.target nss-lookup.target
[Service]
Restart=on-failure
Type=simple
ExecStart=/usr/sbin/hysteria -config /etc/hysteria/config.json server
[Install]
WantedBy=multi-user.target
systemctl daemon-reload # 重新加载
systemctl enable hysteria # 开机自启
systemctl start hysteria # 启动
没有评论:
发表评论