forked from apernet/hysteria
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
gua
committed
Jan 28, 2024
1 parent
ba83f62
commit 161c1a4
Showing
1 changed file
with
16 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,40 @@ | ||
# ![Hysteria 2](logo.svg) | ||
|
||
# 支持对接 Xboard/V2board 面板的Hysteria2后端 | ||
# 支持对接V2board面板的Hysteria2后端 | ||
|
||
### 项目说明 | ||
本项目基于hysteria官方内核二次开发,添加了从 Xboard/V2board 获取节点信息、用户鉴权信息与上报用户流量的功能。 | ||
本项目基于hysteria官方内核二次开发,添加了从v2b获取节点信息、用户鉴权信息与上报用户流量的功能。 | ||
性能方面已经由hysteria2内核作者亲自指导优化过了。 | ||
|
||
### TG交流群 | ||
欢迎加入交流群 [点击加入](https://t.me/+DcRt8AB2VbI2Yzc1) | ||
|
||
准备工作:默认在root目录下开始。 | ||
配置ssl证书,使用acme配置证书要占用80端口,CentOS自行把`apt`改成`yum`。 | ||
``` | ||
apt install -y vim curl socat openssl && mkdir hysteria | ||
``` | ||
``` | ||
curl https://get.acme.sh | sh -s [email protected] | ||
``` | ||
``` | ||
~/.acme.sh/acme.sh --upgrade --auto-upgrade | ||
``` | ||
可选:切换申请letsencrypt的证书,`~/.acme.sh/acme.sh --set-default-ca --server letsencrypt` | ||
|
||
每行第一个 example.com 换成你解析到 vps 的域名,后面的 example.com 不用改了。 | ||
``` | ||
~/.acme.sh/acme.sh --issue -d example.com --standalone | ||
~/.acme.sh/acme.sh --install-cert -d example.com --key-file /root/hysteria/example.com.key | ||
~/.acme.sh/acme.sh --install-cert -d example.com --fullchain-file /root/hysteria/example.com.crt | ||
``` | ||
安装docker,docker compose | ||
``` | ||
curl -fsSL https://get.docker.com | bash -s docker && systemctl start docker && systemctl enable docker | ||
``` | ||
修改 docker-compose.yml, server.yaml 配置文件。 | ||
Finalshell 注意:直接新建文件,复制粘贴过去,用终端粘贴不了符号。 | ||
``` | ||
cd hysteria | ||
``` | ||
|
||
---在ssh 终端复制命令写入docker-compose.yml 文件 | ||
``` | ||
cat > docker-compose.yml << EOF | ||
version: "3.9" | ||
services: | ||
hysteria: | ||
image: ghcr.io/rebecca554owen/hysteria:latest | ||
container_name: hysteria | ||
restart: always | ||
network_mode: "host" | ||
volumes: | ||
- ./server.yaml:/etc/hysteria/server.yaml # 这里不用改。 | ||
- ./example.com.crt:/etc/hysteria/example.com.crt # 这里不用改。 | ||
- ./example.com.key:/etc/hysteria/example.com.key # 这里不用改。 | ||
command: ["server", "-c", "/etc/hysteria/server.yaml"] | ||
EOF | ||
``` | ||
---配置文件server.yaml参考 | ||
``` | ||
vim server.yaml | ||
``` | ||
### 示例配置 | ||
``` | ||
v2board: | ||
apiHost: https://example.com # xboard面板域名 | ||
apiKey: 123456789 # 通讯密钥 | ||
nodeID: 1 # Hysteria节点id | ||
apiHost: https://面板地址 | ||
apiKey: 面板节点密钥 | ||
nodeID: 节点ID | ||
tls: | ||
type: tls | ||
cert: /etc/hysteria/example.com.crt # 这里不要改。 | ||
key: /etc/hysteria/example.com.key # 这里不要改。 | ||
cert: /etc/hysteria/tls.crt | ||
key: /etc/hysteria/tls.key | ||
auth: | ||
type: v2board | ||
trafficStats: | ||
listen: 127.0.0.1:7653 | ||
acl: | ||
inline: | ||
- reject(pincong.rocks) #acl规则自行查阅hysteria2文档 | ||
``` | ||
启动docker compose | ||
``` | ||
docker compose up -d | ||
``` | ||
停止docker compose(不用的话记得停止运行,避免删除Hysteria2节点后数据库v2_log存在大量报错记录) | ||
``` | ||
docker compose down | ||
- reject(10.0.0.0/8) | ||
- reject(172.16.0.0/12) | ||
- reject(192.168.0.0/16) | ||
- reject(127.0.0.0/8) | ||
- reject(fc00::/7) | ||
``` | ||
> 其他配置完全与hysteria文档的一致,可以查看hysteria2官方文档 [点击查看](https://hysteria.network/zh/docs/getting-started/Installation/) | ||
查看日志: | ||
``` | ||
docker logs -f hysteria | ||
``` | ||
更新,在 hysteria 目录执行。 | ||
### docker 仓库 | ||
``` | ||
docker compose pull && docker compose up -d | ||
docker pull ghcr.io/cedar2025/hysteria:latest | ||
``` |