Merge branch 'main' into 3x-ui
2
.github/FUNDING.yml
vendored
@ -10,5 +10,5 @@ liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
polar: # Replace with a single Polar username
|
||||
buy_me_a_coffee: mhsanaei
|
||||
buy_me_a_coffee: xeefeiz
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
|
||||
6
.github/workflows/docker.yml
vendored
@ -19,8 +19,8 @@ jobs:
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
hsanaeii/3x-ui
|
||||
ghcr.io/mhsanaei/3x-ui
|
||||
xeefei/3x-ui
|
||||
ghcr.io/xeefei/3x-ui
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=tag
|
||||
@ -54,4 +54,4 @@ jobs:
|
||||
push: true
|
||||
platforms: linux/amd64, linux/arm64/v8, linux/arm/v7, linux/arm/v6, linux/386
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
811
README.md
@ -1,56 +1,783 @@
|
||||
[English](/README.md) | [فارسی](/README.fa_IR.md) | [العربية](/README.ar_EG.md) | [中文](/README.zh_CN.md) | [Español](/README.es_ES.md) | [Русский](/README.ru_RU.md)
|
||||
<p align="center"><a href="#"><img src="./media/3X-UI.png" alt="Image"></a></p>
|
||||
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./media/3x-ui-dark.png">
|
||||
<img alt="3x-ui" src="./media/3x-ui-light.png">
|
||||
</picture>
|
||||
</p>
|
||||
**---------------------------------------一个更好的面板 • 基于Xray Core构建------------------------------**
|
||||
|
||||
[](https://github.com/MHSanaei/3x-ui/releases)
|
||||
[](https://github.com/MHSanaei/3x-ui/actions)
|
||||
[](#)
|
||||
[](https://github.com/MHSanaei/3x-ui/releases/latest)
|
||||
|
||||
[](https://github.com/xeefei/3x-ui/releases)
|
||||
[](https://github.com/xeefei/3x-ui/actions)
|
||||
[](#)
|
||||
[](https://github.com/xeefei/3x-ui/releases/latest)
|
||||
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||
|
||||
**3X-UI** — advanced, open-source web-based control panel designed for managing Xray-core server. It offers a user-friendly interface for configuring and monitoring various VPN and proxy protocols.
|
||||
> **声明:** 此项目仅供个人学习、交流使用,请遵守当地法律法规,勿用于非法用途;请勿用于生产环境。
|
||||
|
||||
> [!IMPORTANT]
|
||||
> This project is only for personal using, please do not use it for illegal purposes, please do not use it in a production environment.
|
||||
> **注意:** 在使用此项目和〔教程〕过程中,若因违反以上声明使用规则而产生的一切后果由使用者自负。
|
||||
|
||||
As an enhanced fork of the original X-UI project, 3X-UI provides improved stability, broader protocol support, and additional features.
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)
|
||||
```
|
||||
|
||||
For full documentation, please visit the [project Wiki](https://github.com/MHSanaei/3x-ui/wiki).
|
||||
|
||||
## A Special Thanks to
|
||||
|
||||
- [alireza0](https://github.com/alireza0/)
|
||||
|
||||
## Acknowledgment
|
||||
|
||||
- [Iran v2ray rules](https://github.com/chocolate4u/Iran-v2ray-rules) (License: **GPL-3.0**): _Enhanced v2ray/xray and v2ray/xray-clients routing rules with built-in Iranian domains and a focus on security and adblocking._
|
||||
- [Russia v2ray rules](https://github.com/runetfreedom/russia-v2ray-rules-dat) (License: **GPL-3.0**): _This repository contains automatically updated V2Ray routing rules based on data on blocked domains and addresses in Russia._
|
||||
|
||||
## Support project
|
||||
|
||||
**If this project is helpful to you, you may wish to give it a**:star2:
|
||||
**如果此项目对你有用,请给一个**:star2:
|
||||
|
||||
<p align="left">
|
||||
<a href="https://buymeacoffee.com/mhsanaei" target="_blank">
|
||||
<a href="https://buymeacoffee.com/xeefeiz" target="_blank">
|
||||
<img src="./media/buymeacoffe.png" alt="Image">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
- USDT (TRC20): `TXncxkvhkDWGts487Pjqq1qT9JmwRUz8CC`
|
||||
- MATIC (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A`
|
||||
- LTC (Litecoin): `ltc1q2ach7x6d2zq0n4l0t4zl7d7xe2s6fs7a3vspwv`
|
||||
- 赞助地址(USDT/TRC20):`TYQEmQp1P65u9bG7KPehgJdvuokfb72YkZ`
|
||||
|
||||
## Stargazers over Time
|
||||
## [【3X-UI】中文交流群:https://t.me/XUI_CN](https://t.me/XUI_CN)
|
||||
## [【3X-UI】详细安装流程步骤:https://xeefei.blogspot.com/2025/07/3x-ui.html](https://xeefei.blogspot.com/2025/07/3x-ui.html)
|
||||
|
||||
[](https://starchart.cc/MHSanaei/3x-ui)
|
||||
------------
|
||||
## ✰〔3X-UI优化版〕跟原版3X-UI的区别?✰
|
||||
### 大部分功能基于原版3X-UI进行汉化优化,主要的优化内容如下:
|
||||
#### 1、最大限度地汉化了面板项目,更适合中文宝宝体质,包括:
|
||||
##### ①优化在VPS中进行〔脚本安装过程〕的汉化提示,增加相应的安装中文提示,让中文用户能明白清楚自己安装到了哪个环节?在细节方面,增加了安装成功之后的〔用户设置信息〕提示,在脚本中加入〔面板登录地址〕显示,
|
||||
##### ②管理后台进行了相应的〔图标和按钮〕汉化,让中文宝宝能够看得懂,
|
||||
##### ③安装成功后〔自动更改〕后台管理界面和电报机器人界面默认为〔中文〕,
|
||||
##### ④在管理后台中〔设置证书处〕,增加了acme方式填入路径的提示;
|
||||
#### 2、优化了电报机器人响应〔按钮〕的名称和排序;
|
||||
#### 3、创建了〔3X-UI〕中文交流群,各位中文宝宝可以一起讨论交流;
|
||||
#### 4、管理后台中增加了〔实用导航〕页面,里面包含实用内容;
|
||||
#### 5、优化了后台〔二维码〕显示模式,点击打开会更加丝滑美观;
|
||||
#### 6、在创建reality协议时,更改uTLS指纹默认使用chrome;
|
||||
#### 7、更新README内容添加备份&恢复操作说明,以及更多其他图文介绍;
|
||||
#### 8、管理后台中增加〔端口检测〕和〔网络测速〕,点击可以跳转直达;
|
||||
#### 9、增加了详细的项目〔安装配置教程〕,解决小白用户不懂配置的烦恼。
|
||||
|
||||
------------
|
||||
## ✰你必须要看的【重要安全提示/警告】✰
|
||||
#### 1、请规避使用【http明文模式】登录管理面板,因为明文会造成信息泄露;
|
||||
#### 2、可使用设置【SSH端口转发功能】去登录面板或安装证书之后用https加密方式登录;
|
||||
#### 3、给大部分新手小白或懒人的建议:若你无法实现步骤2中的方法,请参考接下来的步骤4;
|
||||
#### 4、若在搭建之前没有翻墙加密,则【http明文模式】登录面板有很大的信息泄露安全风险,那建议你第一次搭建成功之后,去修改用户/密码,和访问路径,后期则通过搭建好的代理加密访问。
|
||||
|
||||
------------
|
||||
## ✰如何从其他x-ui版本迁移到〔3X-UI优化版〕?✰
|
||||
#### 1、若你用的是伊朗老哥的原版3X-UI,是可以直接〔覆盖安装〕的,因为〔3X-UI优化版〕是fork了原版3X-UI的项目,基于原有的功能进行优化的,大功能是没有变化的,主要是进行了脚本的〔汉化处理〕,其他诸如数据库文件等位置是没有改变的,所以直接覆盖安装,并不会影响你〔原有节点及配置〕等数据;安装命令如下:
|
||||
```
|
||||
bash <(curl -Ls https://raw.githubusercontent.com/xeefei/3x-ui/master/install.sh)
|
||||
```
|
||||
#### 2、若你之前用的是Docker方式安装,那先进入容器里面/命令:docker exec -it 容器id /bin/sh,再执行以上脚本命令直接【覆盖安装】即可,
|
||||
#### 3、若你用的是之前F佬的x-ui或者其他分支版本,那直接覆盖安装的话,并不能确保一定就能够兼容?建议你先去备份〔数据库〕配置文件,再进行安装〔3X-UI优化版〕。
|
||||
|
||||
|
||||
------------
|
||||
## 安装之前的准备
|
||||
- 购买一台性能还不错的VPS,可通过本页底部链接购买,
|
||||
- PS:若你不想升级系统,则可以跳过此步骤。
|
||||
- 若你需要更新/升级系统,Debian系统可用如下命令:
|
||||
```
|
||||
apt update
|
||||
apt upgrade -y
|
||||
apt dist-upgrade -y
|
||||
apt autoclean
|
||||
apt autoremove -y
|
||||
```
|
||||
- 查看系统当前版本:
|
||||
```
|
||||
cat /etc/debian_version
|
||||
```
|
||||
- 查看内核版本:
|
||||
```
|
||||
uname -r
|
||||
```
|
||||
- 列出所有内核:
|
||||
```
|
||||
dpkg --list | grep linux-image
|
||||
```
|
||||
- 更新完成后执行重新引导:
|
||||
```
|
||||
update-grub
|
||||
```
|
||||
- 完成以上步骤之后输入reboot重启系统
|
||||
|
||||
------------
|
||||
## 【搬瓦工】重装/升级系统之后SSH连不上如何解决?
|
||||
- 【搬瓦工】重装/升级系统会恢复默认22端口,如果需要修改SSH的端口号,您需要进行以下步骤:
|
||||
- 以管理员身份使用默认22端口登录到SSH服务器
|
||||
- 打开SSH服务器的配置文件进行编辑,SSH配置文件通常位于/etc/ssh/sshd_config
|
||||
- 找到"Port"选项,并将其更改为您想要的端口号
|
||||
- Port <新端口号>,请将<新端口号>替换为您想要使用的端口号
|
||||
- 保存文件并退出编辑器
|
||||
- 重启服务器以使更改生效
|
||||
|
||||
------------
|
||||
## 安装 & 升级
|
||||
- 使用3x-ui脚本一般情况下,安装完成创建入站之后,端口是默认关闭的,所以必须进入脚本选择【22】去放行端口
|
||||
- 要使用【自动续签】证书功能,也必须放行【80】端口,保持80端口是打开的,才会每3个月自动续签一次
|
||||
|
||||
- 【全新安装】请执行以下脚本:
|
||||
```
|
||||
bash <(curl -Ls https://raw.githubusercontent.com/xeefei/3x-ui/master/install.sh)
|
||||
```
|
||||
#### 如果执行了上面的代码但是报错,证明你的系统里面没有curl这个软件,请执行以下命令先安装curl软件,安装curl之后再去执行上面代码,
|
||||
```
|
||||
apt update -y&&apt install -y curl&&apt install -y socat
|
||||
```
|
||||
|
||||
- 若要对版本进行升级,可直接通过脚本选择【2】,如下图:
|
||||

|
||||

|
||||
- 在到这一步必须要注意:要保留旧设置的话,需要输入【n】
|
||||

|
||||
|
||||
|
||||
## 安装指定版本
|
||||
|
||||
若要安装指定的版本,请使用以下安装命令。 e.g., ver `v2.4.5`:
|
||||
|
||||
```
|
||||
VERSION=v2.4.5 && bash <(curl -Ls "https://raw.githubusercontent.com/xeefei/3x-ui/$VERSION/install.sh") $VERSION
|
||||
```
|
||||
------------
|
||||
## 若你的VPS默认有防火墙,请在安装完成之后放行指定端口
|
||||
- 放行【面板登录端口】
|
||||
- 放行出入站管理协议端口
|
||||
- 如果要申请安装证书并每3个月【自动续签】证书,请确保80和443端口是放行打开的
|
||||
- 可通过此脚本的第【22】选项去安装防火墙进行管理,如下图:
|
||||

|
||||
- 若要一次性放行多个端口或一整个段的端口,用英文逗号隔开。
|
||||
#### PS:若你的VPS没有防火墙,则所有端口都是能够ping通的,可自行选择是否进入脚本安装防火墙保证安全,但安装了防火墙必须放行相应端口。
|
||||
|
||||
------------
|
||||
## 安装证书开启https方式实现域名登录访问管理面板/----->>偷自己
|
||||
#### PS:如果不需要以上功能或无域名,可以跳过这步;建议申请证书,
|
||||
##### 1、把自己的域名托管到CF,并解析到自己VPS的IP,不要开启【小云朵】,
|
||||
##### 2、如果要申请安装证书并每3个月【自动续签】证书,请确保80和443端口是放行打开的,
|
||||
##### 3、输入x-ui命令进入面板管理脚本,通过选择第【18】选项去进行安装,
|
||||
##### 4、在安装证书的最后一步,请输入【y】设置面板证书路径,如下图所示:
|
||||

|
||||
##### 5、进入后台【面板设置】—–>【常规】中,会看到脚本已经自动填好了证书公钥、私钥路径,
|
||||
##### 6、点击左上角的【保存】和【重启面板】,即可用自己域名进行登录管理;也可按照后续方法实现【自己偷自己】。
|
||||
|
||||
------------
|
||||
## 登录面板进行【常规】设置
|
||||
### 特别是如果在安装过程中,全部都是默认【回车键】安装的话,用户名/密码/访问路径是随机的,而面板监听端口默认是2053,最好进入面板更改,
|
||||
##### 1、填写自己想要设置的【面板监听端口】,并去登录SSH放行,
|
||||
##### 2、更改自己想要设置的【面板登录访问路径】,后续加上路径登录访问,
|
||||

|
||||
##### 3、其他:安全设定和电报机器人等配置,可自行根据需求去进行设置,
|
||||
##### 4、建议申请证书保护并在【脚本中】设置路径,建议配置电报机器人方便管理,
|
||||

|
||||
##### 5、面板设置【改动保存】之后,都需要点击左上角【重启面板】,才能生效。
|
||||
#### PS:若你在正确完成了上述步骤之后,你没有安装证书的情况下,去用IP+端口号/路径的方式却不能访问面板,那请检查一下是不是你的浏览器自动默认开启了https模式,需要手动调整一下改成http方式,把“s”去掉,即可访问成功。
|
||||
|
||||
------------
|
||||
## 创建【入站协议】和添加【客户端】,并测试上网
|
||||
##### 1、点击左边【入站列表】,然后【添加入站】,传输方式保持【TCP】不变,尽量选择主流的vless+reality+vision协议组合,
|
||||

|
||||
##### 2、在选择reality安全选项时,偷的域名可以使用默认的,要使用其他的,请替换尽量保持一致就行,比如Apple、Yahoo,VPS所在地区的旅游、学校网站等;如果要实现【偷自己】,请参看后续【如何偷自己】的说明部分;而私钥/公钥部分,可以直接点击下方的【Get New Cert】获取一个随机的,
|
||||
##### 3、在创建reality安全选项过程中,至于其他诸如:PROXY Protocol,HTTP 伪装,TPROXY,External Proxy等等选项,若无特殊要求,保持默认设置即可,不用去动它们,
|
||||

|
||||
##### 4、创建好入站协议之后,默认只有一个客户端,可根据自己需求继续添加;重点:并编辑客户端,选择【Flow流控】为xtls-rprx-vision-udp443,
|
||||

|
||||
##### 5、其他:流量限制,到期时间,客户TG的ID等选项根据自己需求填写,
|
||||

|
||||
##### 6、一定要放行端口之后,确保端口能够ping通,再导入软件,
|
||||
##### 7、点击二维码或者复制链接导入到v2rayN等软件中进行测试。
|
||||
|
||||
------------
|
||||
## 备份与恢复/迁移数据库(以Debian系统为例)
|
||||
#### 一、备份:通过配置好电报管理机器人,并去设置开启【自动备份】,每天凌晨12点会通过VPS管理机器人获取【备份配置】文件,有x-ui.db和config.json两个文件,可自行下载保存到自己电脑里面,
|
||||

|
||||
#### 二、搭建:在新的VPS中全新安装好3x-ui面板,通过脚本放行之前配置的所有端口,一次性放行多个端口请用【英文逗号】分隔,
|
||||
#### 三、若需要安装证书,则提前把域名解析到新的VPS对应的IP,并且去输入x-ui选择第【18】选项去安装,并记录公钥/私钥的路径,无域名则跳过这一步,
|
||||
#### 四、恢复:SSH登录服务器找到/etc/x-ui/x-ui.db和/usr/local/x-ui/bin/config.json文件位置,上传之前的两个备份文件,进行覆盖,
|
||||

|
||||
##### PS:把之前通过自动备份下载得到的两个文件上传覆盖掉旧文件,重启3x-ui面板即可【迁移成功】;即使迁移过程中出现问题,你是有备份文件的,不用担心,多试几次。
|
||||

|
||||
#### 五、若安装了证书,去核对/更改一下证书的路径,一般是同一个域名的话,位置在:/root/cert/域名/fullchain.pem,路径是相同的就不用更改,
|
||||
#### 六、重启面板/重启服务器,让上述步骤生效即可,这时可以看到所有配置都是之前自己常用的,包括面板用户名、密码,入站、客户端,电报机器人配置等。
|
||||
|
||||
------------
|
||||
## 安装完成后如何设置调整成【中文界面】?
|
||||
- 方法一:通过管理后台【登录页面】调整,登录时可以选择,如下图:
|
||||

|
||||
- 方法二:通过在管理后台-->【面板设置】中去选择设置,如下图:
|
||||

|
||||
- 【TG机器人】设置中文:通过在管理后台-->【面板设置】-->【机器人配置】中去选择设置,并建议打开数据库备份和登录通知,如下图:
|
||||

|
||||
|
||||
------------
|
||||
## 用3x-ui如何实现【自己偷自己】?
|
||||
- 其实很简单,只要你为面板设置了证书,
|
||||
- 开启了HTTPS登录,就可以将3x-ui自身作为Web Server,
|
||||
- 无需Nginx等,这里给一个示例:
|
||||
- 其中目标网站(Dest)请填写面板监听端口,
|
||||
- 可选域名(SNI)填写面板登录域名,
|
||||
- 如果您使用其他web server(如nginx)等,
|
||||
- 将目标网站改为对应监听端口也可。
|
||||
- 需要说明的是,如果您处于白名单地区,自己“偷”自己并不适合你;
|
||||
- 其次,可选域名一项实际上可以填写任意SNI,只要客户端保持一致即可,不过并不推荐这样做。
|
||||
- 配置方法如下图所示:
|
||||

|
||||
|
||||
------------
|
||||
## 〔子域名〕被墙针对特征
|
||||
#### 网络表现:
|
||||
##### 1、可以Ping通域名和IP地址,
|
||||
##### 2、子域名无法打开3X-UI管理界面,
|
||||
##### 3、什么都正常就是不能上网;
|
||||
|
||||
#### 问题:
|
||||
##### 你的子域名被墙针对了:无法上网!
|
||||
|
||||
#### 解决方案:
|
||||
##### 1、更换为新的子域名,
|
||||
##### 2、解析新的子域名到VPS的IP,
|
||||
##### 3、重新去安装新证书,
|
||||
##### 4、重启3X-UI和服务器,
|
||||
##### 5、重新去获取链接并测试上网。
|
||||
#### PS:若通过以上步骤还是不能正常上网,则重装VPS服务器OS系统,以及3X-UI面板全部重新安装,之后就正常了!
|
||||
|
||||
------------
|
||||
## 用3x-ui如何开启【每月流量自动重置】?
|
||||
##### 1、进入后台的【入站列表】,选择需要设置的【客户端】,
|
||||

|
||||
##### 2、要注意是编辑【入站】下面的【客户端】,才会有效果,
|
||||
##### 2、并不是编辑【入站】,所以不要弄错对象,如下图所示:
|
||||

|
||||
|
||||
|
||||
------------
|
||||
## 在自己的VPS服务器部署【订阅转换】功能
|
||||
### 如何把vless/vmess等协议转换成Clash/Surge等软件支持的格式?
|
||||
##### 1、进入脚本输入x-ui命令调取面板,选择第【24】选项安装订阅转换模块,如下图:
|
||||

|
||||
##### 2、等待安装【订阅转换】成功之后,访问地址:你的IP:18080(端口号)进行转换,
|
||||

|
||||
##### 3、因为在转换过程中需要调取后端API,所以请确保端口25500是打开放行的,
|
||||
##### 4、在得到【转换链接】之后,只要你的VPS服务器25500端口是能ping通的,就能导入Clash/Surge等软件成功下载配置,
|
||||
##### 5、此功能集成到3x-ui面板中,是为了保证安全,通过调取24选项把【订阅转换】功能部署在自己的VPS中,不会造成链接泄露。
|
||||
### 【订阅转换】功能在自己的VPS中安装部署成功之后的界面如下图所示:
|
||||

|
||||
|
||||
------------
|
||||
## 常见的翻墙软件/工具:
|
||||
- [1、Windows系统v2rayN:https://github.com/2dust/v2rayN](https://github.com/2dust/v2rayN)
|
||||
- [2、安卓手机版【v2rayNG】:https://github.com/2dust/v2rayNG](https://github.com/2dust/v2rayNG)
|
||||
- [3、苹果手机IOS【小火箭】:https://apple02.com/(自己购买)](https://apple02.com/)
|
||||
- [4、苹果MacOS电脑【Clash Verge】:https://github.com/clash-verge-rev/clash-verge-rev/releases](https://github.com/clash-verge-rev/clash-verge-rev/releases)
|
||||
[或v2rayN:https://github.com/2dust/v2rayN](https://github.com/2dust/v2rayN)
|
||||
|
||||
------------
|
||||
## 如何保护自己的IP不被墙被封?
|
||||
##### 1、使用的代理协议要安全,加密是必备,推荐使用vless+reality+vision协议组合,
|
||||
##### 2、因为有时节点会共享,在不同的地区,多个省份之间不要共同连接同一个IP,
|
||||
##### 3、连接同一个IP就算了,不要同一个端口,不要同IP+同端口到处漫游,要分开,
|
||||
##### 4、同一台VPS,不要在一天内一直大流量去下载东西使用,不要流量过高要切换,
|
||||
##### 5、创建【入站协议】的时候,尽量用【高位端口】,比如40000--65000之间的端口号。
|
||||
#### 提醒:为什么在特殊时期,比如:两会,春节等被封得最严重最惨?
|
||||
##### 尼玛同一个IP+同一个端口号,多个省份去漫游,跟开飞机场一样!不封你,封谁的IP和端口?
|
||||
#### 总结:不要多终端/多省份/多个朋友/共同使用同一个IP和端口号!使用3x-ui多创建几个【入站】,
|
||||
#### 多做几条备用,各用各的!各行其道才比较安全!GFW的思维模式是干掉机场,机场的特征个人用户不要去沾染,自然IP就保护好了。
|
||||
|
||||
------------
|
||||
## SSL 认证
|
||||
|
||||
<details>
|
||||
<summary>点击查看 SSL 认证</summary>
|
||||
|
||||
### ACME
|
||||
|
||||
要使用 ACME 管理 SSL 证书:
|
||||
|
||||
1. 确保您的域名已正确解析到服务器,
|
||||
2. 输入“x-ui”命令并选择“SSL 证书管理”,
|
||||
3. 您将看到以下选项:
|
||||
|
||||
- **获取证书** ----获取SSL证书
|
||||
- **吊销证书** ----吊销现有的SSL证书
|
||||
- **续签证书** ----强制续签SSL证书
|
||||
- **显示所有证书** ----显示服务器中所有能用的证书
|
||||
- **设置面板证书路径** ----指定面板要使用的证书
|
||||
|
||||
|
||||
### Certbot
|
||||
|
||||
安装和使用 Certbot:
|
||||
|
||||
```sh
|
||||
apt-get install certbot -y
|
||||
certbot certonly --standalone --agree-tos --register-unsafely-without-email -d yourdomain.com
|
||||
certbot renew --dry-run
|
||||
```
|
||||
|
||||
### Cloudflare
|
||||
|
||||
管理脚本具有用于 Cloudflare 的内置 SSL 证书应用程序。若要使用此脚本申请证书,需要满足以下条件:
|
||||
|
||||
- Cloudflare 邮箱地址
|
||||
- Cloudflare Global API Key
|
||||
- 域名已通过 cloudflare 解析到当前服务器
|
||||
|
||||
**如何获取 Cloudflare全局API密钥:**
|
||||
|
||||
1. 在终端中输入“x-ui”命令,然后选择“CF SSL 证书”。
|
||||
2. 访问链接: [Cloudflare API Tokens](https://dash.cloudflare.com/profile/api-tokens).
|
||||
3. 点击“查看全局 API 密钥”(如下图所示):
|
||||

|
||||
4. 您可能需要重新验证您的帐户。之后,将显示 API 密钥(请参见下面的屏幕截图):
|
||||

|
||||
|
||||
使用时,只需输入您的“域名”、“电子邮件”和“API KEY”即可。示意图如下:
|
||||

|
||||
|
||||
|
||||
</details>
|
||||
|
||||
------------
|
||||
## 手动安装 & 升级
|
||||
|
||||
<details>
|
||||
<summary>点击查看 手动安装 & 升级</summary>
|
||||
|
||||
#### 使用
|
||||
|
||||
1. 若要将最新版本的压缩包直接下载到服务器,请运行以下命令:
|
||||
|
||||
```sh
|
||||
ARCH=$(uname -m)
|
||||
case "${ARCH}" in
|
||||
x86_64 | x64 | amd64) XUI_ARCH="amd64" ;;
|
||||
i*86 | x86) XUI_ARCH="386" ;;
|
||||
armv8* | armv8 | arm64 | aarch64) XUI_ARCH="arm64" ;;
|
||||
armv7* | armv7) XUI_ARCH="armv7" ;;
|
||||
armv6* | armv6) XUI_ARCH="armv6" ;;
|
||||
armv5* | armv5) XUI_ARCH="armv5" ;;
|
||||
s390x) echo 's390x' ;;
|
||||
*) XUI_ARCH="amd64" ;;
|
||||
esac
|
||||
|
||||
|
||||
wget https://github.com/xeefei/3x-ui/releases/latest/download/x-ui-linux-${XUI_ARCH}.tar.gz
|
||||
```
|
||||
|
||||
2. 下载压缩包后,执行以下命令安装或升级 x-ui:
|
||||
|
||||
```sh
|
||||
ARCH=$(uname -m)
|
||||
case "${ARCH}" in
|
||||
x86_64 | x64 | amd64) XUI_ARCH="amd64" ;;
|
||||
i*86 | x86) XUI_ARCH="386" ;;
|
||||
armv8* | armv8 | arm64 | aarch64) XUI_ARCH="arm64" ;;
|
||||
armv7* | armv7) XUI_ARCH="armv7" ;;
|
||||
armv6* | armv6) XUI_ARCH="armv6" ;;
|
||||
armv5* | armv5) XUI_ARCH="armv5" ;;
|
||||
s390x) echo 's390x' ;;
|
||||
*) XUI_ARCH="amd64" ;;
|
||||
esac
|
||||
|
||||
cd /root/
|
||||
rm -rf x-ui/ /usr/local/x-ui/ /usr/bin/x-ui
|
||||
tar zxvf x-ui-linux-${XUI_ARCH}.tar.gz
|
||||
chmod +x x-ui/x-ui x-ui/bin/xray-linux-* x-ui/x-ui.sh
|
||||
cp x-ui/x-ui.sh /usr/bin/x-ui
|
||||
cp -f x-ui/x-ui.service /etc/systemd/system/
|
||||
mv x-ui/ /usr/local/
|
||||
systemctl daemon-reload
|
||||
systemctl enable x-ui
|
||||
systemctl restart x-ui
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
------------
|
||||
## 通过Docker安装
|
||||
|
||||
<details>
|
||||
<summary>点击查看 通过Docker安装</summary>
|
||||
|
||||
#### 使用
|
||||
|
||||
|
||||
1. **安装Docker**
|
||||
|
||||
```sh
|
||||
bash <(curl -sSL https://get.docker.com)
|
||||
```
|
||||
|
||||
|
||||
2. **克隆项目仓库**
|
||||
|
||||
```sh
|
||||
git clone https://github.com/xeefei/3x-ui.git
|
||||
cd 3x-ui
|
||||
```
|
||||
|
||||
3. **启动服务**:
|
||||
|
||||
```sh
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
添加 ```--pull always``` 标志使 docker 在拉取更新的镜像时自动重新创建容器。有关更多信息,请参阅:https://docs.docker.com/reference/cli/docker/container/run/#pull
|
||||
|
||||
**或**
|
||||
|
||||
```sh
|
||||
docker run -itd \
|
||||
-e XRAY_VMESS_AEAD_FORCED=false \
|
||||
-v $PWD/db/:/etc/x-ui/ \
|
||||
-v $PWD/cert/:/root/cert/ \
|
||||
--network=host \
|
||||
--restart=unless-stopped \
|
||||
--name 3x-ui \
|
||||
ghcr.io/xeefei/3x-ui:latest
|
||||
```
|
||||
|
||||
4. **更新至最新版本**
|
||||
|
||||
```sh
|
||||
cd 3x-ui
|
||||
docker compose down
|
||||
docker compose pull 3x-ui
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
5. **从Docker中删除3x-ui **
|
||||
|
||||
```sh
|
||||
docker stop 3x-ui
|
||||
docker rm 3x-ui
|
||||
cd --
|
||||
rm -r 3x-ui
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
------------
|
||||
## 建议使用的操作系统
|
||||
|
||||
- Ubuntu 20.04+
|
||||
- Debian 11+
|
||||
- CentOS 8+
|
||||
- OpenEuler 22.03+
|
||||
- Fedora 36+
|
||||
- Arch Linux
|
||||
- Manjaro
|
||||
- Armbian
|
||||
- AlmaLinux 8.0+
|
||||
- Rocky Linux 8+
|
||||
- Oracle Linux 8+
|
||||
- OpenSUSE Tubleweed
|
||||
- Amazon Linux 2023
|
||||
|
||||
------------
|
||||
## 支持的架构和设备
|
||||
<details>
|
||||
<summary>点击查看 支持的架构和设备</summary>
|
||||
|
||||
我们的平台提供与各种架构和设备的兼容性,确保在各种计算环境中的灵活性。以下是我们支持的关键架构:
|
||||
|
||||
- **amd64**: 这种流行的架构是个人计算机和服务器的标准,可以无缝地适应大多数现代操作系统。
|
||||
|
||||
- **x86 / i386**: 这种架构在台式机和笔记本电脑中被广泛采用,得到了众多操作系统和应用程序的广泛支持,包括但不限于 Windows、macOS 和 Linux 系统。
|
||||
|
||||
- **armv8 / arm64 / aarch64**: 这种架构专为智能手机和平板电脑等当代移动和嵌入式设备量身定制,以 Raspberry Pi 4、Raspberry Pi 3、Raspberry Pi Zero 2/Zero 2 W、Orange Pi 3 LTS 等设备为例。
|
||||
|
||||
- **armv7 / arm / arm32**: 作为较旧的移动和嵌入式设备的架构,它仍然广泛用于Orange Pi Zero LTS、Orange Pi PC Plus、Raspberry Pi 2等设备。
|
||||
|
||||
- **armv6 / arm / arm32**: 这种架构面向非常老旧的嵌入式设备,虽然不太普遍,但仍在使用中。Raspberry Pi 1、Raspberry Pi Zero/Zero W 等设备都依赖于这种架构。
|
||||
|
||||
- **armv5 / arm / arm32**: 它是一种主要与早期嵌入式系统相关的旧架构,目前不太常见,但仍可能出现在早期 Raspberry Pi 版本和一些旧智能手机等传统设备中。
|
||||
</details>
|
||||
|
||||
------------
|
||||
## Languages
|
||||
|
||||
- English(英语)
|
||||
- Farsi(伊朗语)
|
||||
- Simplified Chinese(简体中文)
|
||||
- Traditional Chinese(繁体中文)
|
||||
- Russian(俄语)
|
||||
- Vietnamese(越南语)
|
||||
- Spanish(西班牙语)
|
||||
- Indonesian (印度尼西亚语)
|
||||
- Ukrainian(乌克兰语)
|
||||
- Turkish(土耳其语)
|
||||
- Português (葡萄牙语)
|
||||
|
||||
------------
|
||||
## 项目特点
|
||||
|
||||
- 系统状态查看与监控
|
||||
- 可搜索所有入站和客户端信息
|
||||
- 深色/浅色主题随意切换
|
||||
- 支持多用户和多协议
|
||||
- 支持多种协议,包括 VMess、VLESS、Trojan、Shadowsocks、Dokodemo-door、Socks、HTTP、wireguard
|
||||
- 支持 XTLS 原生协议,包括 RPRX-Direct、Vision、REALITY
|
||||
- 流量统计、流量限制、过期时间限制
|
||||
- 可自定义的 Xray配置模板
|
||||
- 支持HTTPS访问面板(自备域名+SSL证书)
|
||||
- 支持一键式SSL证书申请和自动续签证书
|
||||
- 更多高级配置项目请参考面板去进行设定
|
||||
- 修复了 API 路由(用户设置将使用 API 创建)
|
||||
- 支持通过面板中提供的不同项目更改配置。
|
||||
- 支持从面板导出/导入数据库
|
||||
|
||||
## 默认面板设置
|
||||
|
||||
<details>
|
||||
|
||||
<summary>点击查看 默认设置</summary>
|
||||
|
||||
### 默认信息
|
||||
|
||||
- **端口**
|
||||
- 2053
|
||||
- **用户名 & 密码 & 访问路径**
|
||||
- 当您跳过设置时,这些信息会随机生成,
|
||||
- 您也可以在安装的时候自定义访问路径。
|
||||
- **数据库路径:**
|
||||
- /etc/x-ui/x-ui.db
|
||||
- **Xray 配置路径:**
|
||||
- /usr/local/x-ui/bin/config.json
|
||||
- **面板链接(无SSL):**
|
||||
- http://ip:2053/访问路径/panel
|
||||
- **面板链接(有SSL):**
|
||||
- https://你的域名:2053/访问路径/panel
|
||||
|
||||
</details>
|
||||
|
||||
------------
|
||||
## [WARP 配置](https://gitlab.com/fscarmen/warp)
|
||||
|
||||
<details>
|
||||
<summary>点击查看 WARP 配置</summary>
|
||||
|
||||
#### 使用
|
||||
|
||||
**对于版本 `v2.1.0` 及更高版本:**
|
||||
|
||||
WARP 是内置的,无需额外安装;只需在面板中打开必要的配置即可。
|
||||
|
||||
**如果要在 v2.1.0 之前使用 WARP 路由**,请按照以下步骤操作:
|
||||
|
||||
**1.** 在 **SOCKS Proxy Mode** 模式中安装Wrap
|
||||
|
||||
- **Account Type (free, plus, team):** Choose the appropriate account type.
|
||||
- **Enable/Disable WireProxy:** Toggle WireProxy on or off.
|
||||
- **Uninstall WARP:** Remove the WARP application.
|
||||
|
||||
**2.** 如果您已经安装了 warp,您可以使用以下命令卸载:
|
||||
|
||||
```sh
|
||||
warp u
|
||||
```
|
||||
|
||||
**3.** 在面板中打开您需要的配置
|
||||
|
||||
配置:
|
||||
|
||||
- Block Ads
|
||||
- Route Google, Netflix, Spotify, and OpenAI (ChatGPT) traffic to WARP
|
||||
- Fix Google 403 error
|
||||
|
||||
|
||||
</details>
|
||||
|
||||
------------
|
||||
## IP 限制
|
||||
|
||||
<details>
|
||||
<summary>点击查看 IP 限制</summary>
|
||||
|
||||
#### 使用
|
||||
|
||||
**注意:** 使用 IP 隧道时,IP 限制无法正常工作。
|
||||
|
||||
- 对于 `v1.6.1`之前的版本 :
|
||||
|
||||
- IP 限制 已被集成在面板中。
|
||||
|
||||
- 对于 `v1.7.0` 以及更新的版本:
|
||||
|
||||
- 要使 IP 限制正常工作,您需要按照以下步骤安装 fail2ban 及其所需的文件:
|
||||
|
||||
1. 使用面板内置的 `x-ui` 指令
|
||||
2. 选择 `IP Limit Management`.
|
||||
3. 根据您的需要选择合适的选项。
|
||||
|
||||
- 确保您的 Xray 配置上有 ./access.log 。在 v2.1.3 之后,我们有一个选项。
|
||||
|
||||
```sh
|
||||
"log": {
|
||||
"access": "./access.log",
|
||||
"dnsLog": false,
|
||||
"loglevel": "warning"
|
||||
},
|
||||
```
|
||||
- 您需要在Xray配置中手动设置〔访问日志〕的路径。
|
||||
|
||||
</details>
|
||||
|
||||
------------
|
||||
## Telegram 机器人
|
||||
|
||||
<details>
|
||||
<summary>点击查看 Telegram 机器人</summary>
|
||||
|
||||
#### 使用
|
||||
|
||||
Web 面板通过 Telegram Bot 支持每日流量、面板登录、数据库备份、系统状态、客户端信息等通知和功能。要使用机器人,您需要在面板中设置机器人相关参数,包括:
|
||||
|
||||
- 电报令牌
|
||||
- 管理员聊天 ID
|
||||
- 通知时间(cron 语法)
|
||||
- 到期日期通知
|
||||
- 流量上限通知
|
||||
- 数据库备份
|
||||
- CPU 负载通知
|
||||
|
||||
|
||||
**参考:**
|
||||
|
||||
- `30 \* \* \* \* \*` - 在每个点的 30 秒处通知
|
||||
- `0 \*/10 \* \* \* \*` - 每 10 分钟的第一秒通知
|
||||
- `@hourly` - 每小时通知
|
||||
- `@daily` - 每天通知 (00:00)
|
||||
- `@weekly` - 每周通知
|
||||
- `@every 8h` - 每8小时通知
|
||||
|
||||
### Telegram Bot 功能
|
||||
|
||||
- 定期报告
|
||||
- 登录通知
|
||||
- CPU 阈值通知
|
||||
- 提前报告的过期时间和流量阈值
|
||||
- 如果将客户的电报用户名添加到用户的配置中,则支持客户端报告菜单
|
||||
- 支持使用UUID(VMESS/VLESS)或密码(TROJAN)搜索报文流量报告 - 匿名
|
||||
- 基于菜单的机器人
|
||||
- 通过电子邮件搜索客户端(仅限管理员)
|
||||
- 检查所有入库
|
||||
- 检查服务器状态
|
||||
- 检查耗尽的用户
|
||||
- 根据请求和定期报告接收备份
|
||||
- 多语言机器人
|
||||
|
||||
### 注册 Telegram bot
|
||||
|
||||
- 与 [Botfather](https://t.me/BotFather) 对话:
|
||||

|
||||
|
||||
- 使用 /newbot 创建新机器人:你需要提供机器人名称以及用户名,注意名称中末尾要包含“bot”
|
||||

|
||||
|
||||
- 启动您刚刚创建的机器人。可以在此处找到机器人的链接。
|
||||

|
||||
|
||||
- 输入您的面板并配置 Telegram 机器人设置,如下所示:
|
||||

|
||||
|
||||
在输入字段编号 3 中输入机器人令牌。
|
||||
在输入字段编号 4 中输入用户 ID。具有此 id 的 Telegram 帐户将是机器人管理员。 (您可以输入多个,只需将它们用“ ,”分开即可)
|
||||
|
||||
- 如何获取TG ID? 使用 [bot](https://t.me/useridinfobot), 启动机器人,它会给你 Telegram 用户 ID。
|
||||

|
||||
|
||||
</details>
|
||||
|
||||
------------
|
||||
## API 路由
|
||||
|
||||
<details>
|
||||
<summary>点击查看 API 路由</summary>
|
||||
|
||||
#### 使用
|
||||
|
||||
- `/login` 使用 `POST` 用户名称 & 密码: `{username: '', password: ''}` 登录
|
||||
- `/panel/api/inbounds` 以下操作的基础:
|
||||
|
||||
| 方法 | 路径 | 操作 |
|
||||
| :----: | ---------------------------------- | ------------------------------------------- |
|
||||
| `GET` | `"/list"` | 获取所有入站 |
|
||||
| `GET` | `"/get/:id"` | 获取所有入站以及inbound.id |
|
||||
| `GET` | `"/getClientTraffics/:email"` | 通过电子邮件获取客户端流量 |
|
||||
| `GET` | `"/getClientTrafficsById/:id"` | 通过用户ID获取客户端流量 |
|
||||
| `GET` | `"/createbackup"` | Telegram 机器人向管理员发送备份 |
|
||||
| `POST` | `"/add"` | 添加入站 |
|
||||
| `POST` | `"/del/:id"` | 删除入站 |
|
||||
| `POST` | `"/update/:id"` | 更新入站 |
|
||||
| `POST` | `"/clientIps/:email"` | 客户端 IP 地址 |
|
||||
| `POST` | `"/clearClientIps/:email"` | 清除客户端 IP 地址 |
|
||||
| `POST` | `"/addClient"` | 将客户端添加到入站 |
|
||||
| `POST` | `"/:id/delClient/:clientId"` | 通过 clientId\* 删除客户端 |
|
||||
| `POST` | `"/updateClient/:clientId"` | 通过 clientId\* 更新客户端 |
|
||||
| `POST` | `"/:id/resetClientTraffic/:email"` | 重置客户端的流量 |
|
||||
| `POST` | `"/resetAllTraffics"` | 重置所有入站的流量 |
|
||||
| `POST` | `"/resetAllClientTraffics/:id"` | 重置入站中所有客户端的流量 |
|
||||
| `POST` | `"/delDepletedClients/:id"` | 删除入站耗尽的客户端 (-1: all) |
|
||||
| `POST` | `"/onlines"` | 获取在线用户 ( 电子邮件列表 ) |
|
||||
|
||||
- 使用`clientId` 项应该填写下列数据:
|
||||
|
||||
- `client.id` for VMESS and VLESS
|
||||
- `client.password` for TROJAN
|
||||
- `client.email` for Shadowsocks
|
||||
|
||||
|
||||
|
||||
- [API 文档](https://documenter.getpostman.com/view/16802678/2s9YkgD5jm)
|
||||
|
||||
- [<img src="https://run.pstmn.io/button.svg" alt="Run In Postman" style="width: 128px; height: 32px;">](https://app.getpostman.com/run-collection/16802678-1a4c9270-ac77-40ed-959a-7aa56dc4a415?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D16802678-1a4c9270-ac77-40ed-959a-7aa56dc4a415%26entityType%3Dcollection%26workspaceId%3D2cd38c01-c851-4a15-a972-f181c23359d9)
|
||||
</details>
|
||||
|
||||
------------
|
||||
## 环境变量
|
||||
|
||||
<details>
|
||||
<summary>点击查看 环境变量</summary>
|
||||
|
||||
#### Usage
|
||||
|
||||
| 变量 | Type | 默认 |
|
||||
| -------------- | :--------------------------------------------: | :------------ |
|
||||
| XUI_LOG_LEVEL | `"debug"` \| `"info"` \| `"warn"` \| `"error"` | `"info"` |
|
||||
| XUI_DEBUG | `boolean` | `false` |
|
||||
| XUI_BIN_FOLDER | `string` | `"bin"` |
|
||||
| XUI_DB_FOLDER | `string` | `"/etc/x-ui"` |
|
||||
| XUI_LOG_FOLDER | `string` | `"/var/log"` |
|
||||
|
||||
例子:
|
||||
|
||||
```sh
|
||||
XUI_BIN_FOLDER="bin" XUI_DB_FOLDER="/etc/x-ui" go build main.go
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
------------
|
||||
## 预览
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
------------
|
||||
## 广告赞助
|
||||
- 如果你觉得本项目对你有用,而且你也恰巧有这方面的需求,你也可以选择通过我的购买链接赞助我。
|
||||
- [1、搬瓦工GIA高端线路,仅推荐购买GIA套餐:https://bandwagonhost.com/aff.php?aff=75015](https://bandwagonhost.com/aff.php?aff=75015)
|
||||
- [2、Dmit高端GIA线路:https://www.dmit.io/aff.php?aff=9326](https://www.dmit.io/aff.php?aff=9326)
|
||||
- [3、白丝云【4837线路】实惠量大管饱:https://cloudsilk.io/aff.php?aff=706](https://cloudsilk.io/aff.php?aff=706)
|
||||
|
||||
------------
|
||||
## 特别感谢
|
||||
|
||||
- [MHSanaei](https://github.com/MHSanaei/)
|
||||
- [alireza0](https://github.com/alireza0/)
|
||||
- [FranzKafkaYu](https://github.com/FranzKafkaYu/)
|
||||
- [vaxilu](https://github.com/vaxilu/)
|
||||
|
||||
------------
|
||||
## 致谢
|
||||
|
||||
- [Iran v2ray rules](https://github.com/chocolate4u/Iran-v2ray-rules) (License: **GPL-3.0**): _Enhanced v2ray/xray and v2ray/xray-clients routing rules with built-in Iranian domains and a focus on security and adblocking._
|
||||
- [Vietnam Adblock rules](https://github.com/vuong2023/vn-v2ray-rules) (License: **GPL-3.0**): _A hosted domain hosted in Vietnam and blocklist with the most efficiency for Vietnamese._
|
||||
|
||||
------------
|
||||
## Star 趋势
|
||||
|
||||
[](https://starchart.cc/xeefei/3x-ui)
|
||||
|
||||
476
README.zh.md
Normal file
@ -0,0 +1,476 @@
|
||||
[English](/README.md) | [Chinese](/README.zh.md) | [Español](/README.es_ES.md)
|
||||
|
||||
<p align="center"><a href="#"><img src="./media/3X-UI.png" alt="Image"></a></p>
|
||||
|
||||
**一个更好的面板 • 基于Xray Core构建**
|
||||
|
||||
[](https://github.com/xeefei/3x-ui/releases)
|
||||
[](#)
|
||||
[](#)
|
||||
[](#)
|
||||
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||
|
||||
> **Disclaimer:** 此项目仅供个人学习交流,请不要用于非法目的,请不要在生产环境中使用。
|
||||
|
||||
**如果此项目对你有用,请给一个**:star2:
|
||||
|
||||
<p align="left">
|
||||
<a href="https://buymeacoffee.com/xeefeiz" target="_blank">
|
||||
<img src="./media/buymeacoffe.png" alt="Image">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
- USDT (TRC20): `TYQEmQp1P65u9bG7KPehgJdvuokfb72YkZ`
|
||||
|
||||
## 安装 & 升级
|
||||
|
||||
```
|
||||
bash <(curl -Ls https://raw.githubusercontent.com/xeefei/3x-ui/master/install.sh)
|
||||
```
|
||||
|
||||
## 安装指定版本
|
||||
|
||||
若需要安装指定的版本,请将该版本添加到安装命令的末尾。 e.g., ver `v2.3.13`:
|
||||
|
||||
```
|
||||
bash <(curl -Ls https://raw.githubusercontent.com/xeefei/3x-ui/master/install.sh) v2.3.13
|
||||
```
|
||||
|
||||
## SSL 认证
|
||||
|
||||
<details>
|
||||
<summary>点击查看 SSL 认证</summary>
|
||||
|
||||
### Cloudflare
|
||||
|
||||
管理脚本具有用于 Cloudflare 的内置 SSL 证书应用程序。若要使用此脚本申请证书,需要满足以下条件:
|
||||
|
||||
- Cloudflare 邮箱地址
|
||||
- Cloudflare Global API Key
|
||||
- 域名已通过 cloudflare 解析到当前服务器
|
||||
|
||||
**1:** 在终端中运行`x-ui`, 选择 `Cloudflare SSL Certificate`.
|
||||
|
||||
|
||||
### Certbot
|
||||
```
|
||||
apt-get install certbot -y
|
||||
certbot certonly --standalone --agree-tos --register-unsafely-without-email -d yourdomain.com
|
||||
certbot renew --dry-run
|
||||
```
|
||||
|
||||
***Tip:*** *管理脚本具有 Certbot 。使用 `x-ui` 命令, 选择 `SSL Certificate Management`.*
|
||||
|
||||
</details>
|
||||
|
||||
## 手动安装 & 升级
|
||||
|
||||
<details>
|
||||
<summary>点击查看 手动安装 & 升级</summary>
|
||||
|
||||
#### 使用
|
||||
|
||||
1. 若要将最新版本的压缩包直接下载到服务器,请运行以下命令:
|
||||
|
||||
```sh
|
||||
ARCH=$(uname -m)
|
||||
case "${ARCH}" in
|
||||
x86_64 | x64 | amd64) XUI_ARCH="amd64" ;;
|
||||
i*86 | x86) XUI_ARCH="386" ;;
|
||||
armv8* | armv8 | arm64 | aarch64) XUI_ARCH="arm64" ;;
|
||||
armv7* | armv7) XUI_ARCH="armv7" ;;
|
||||
armv6* | armv6) XUI_ARCH="armv6" ;;
|
||||
armv5* | armv5) XUI_ARCH="armv5" ;;
|
||||
*) XUI_ARCH="amd64" ;;
|
||||
esac
|
||||
|
||||
|
||||
wget https://github.com/xeefei/3x-ui/releases/latest/download/x-ui-linux-${XUI_ARCH}.tar.gz
|
||||
```
|
||||
|
||||
2. 下载压缩包后,执行以下命令安装或升级 x-ui:
|
||||
|
||||
```sh
|
||||
ARCH=$(uname -m)
|
||||
case "${ARCH}" in
|
||||
x86_64 | x64 | amd64) XUI_ARCH="amd64" ;;
|
||||
i*86 | x86) XUI_ARCH="386" ;;
|
||||
armv8* | armv8 | arm64 | aarch64) XUI_ARCH="arm64" ;;
|
||||
armv7* | armv7) XUI_ARCH="armv7" ;;
|
||||
armv6* | armv6) XUI_ARCH="armv6" ;;
|
||||
armv5* | armv5) XUI_ARCH="armv5" ;;
|
||||
*) XUI_ARCH="amd64" ;;
|
||||
esac
|
||||
|
||||
cd /root/
|
||||
rm -rf x-ui/ /usr/local/x-ui/ /usr/bin/x-ui
|
||||
tar zxvf x-ui-linux-${XUI_ARCH}.tar.gz
|
||||
chmod +x x-ui/x-ui x-ui/bin/xray-linux-* x-ui/x-ui.sh
|
||||
cp x-ui/x-ui.sh /usr/bin/x-ui
|
||||
cp -f x-ui/x-ui.service /etc/systemd/system/
|
||||
mv x-ui/ /usr/local/
|
||||
systemctl daemon-reload
|
||||
systemctl enable x-ui
|
||||
systemctl restart x-ui
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## 通过Docker安装
|
||||
|
||||
<details>
|
||||
<summary>点击查看 通过Docker安装</summary>
|
||||
|
||||
#### 使用
|
||||
|
||||
1. 安装Docker:
|
||||
|
||||
```sh
|
||||
bash <(curl -sSL https://get.docker.com)
|
||||
```
|
||||
|
||||
2. 克隆仓库:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/xeefei/3x-ui.git
|
||||
cd 3x-ui
|
||||
```
|
||||
|
||||
3. 运行服务:
|
||||
|
||||
```sh
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
或
|
||||
|
||||
```sh
|
||||
docker run -itd \
|
||||
-e XRAY_VMESS_AEAD_FORCED=false \
|
||||
-v $PWD/db/:/etc/x-ui/ \
|
||||
-v $PWD/cert/:/root/cert/ \
|
||||
--network=host \
|
||||
--restart=unless-stopped \
|
||||
--name 3x-ui \
|
||||
ghcr.io/xeefei/3x-ui:latest
|
||||
```
|
||||
|
||||
更新至最新版本
|
||||
|
||||
```sh
|
||||
cd 3x-ui
|
||||
docker compose down
|
||||
docker compose pull 3x-ui
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
从Docker中删除3x-ui
|
||||
|
||||
```sh
|
||||
docker stop 3x-ui
|
||||
docker rm 3x-ui
|
||||
cd --
|
||||
rm -r 3x-ui
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
## 建议使用的操作系统
|
||||
|
||||
- Ubuntu 20.04+
|
||||
- Debian 11+
|
||||
- CentOS 8+
|
||||
- Fedora 36+
|
||||
- Arch Linux
|
||||
- Manjaro
|
||||
- Armbian
|
||||
- AlmaLinux 9+
|
||||
- Rockylinux 9+
|
||||
- OpenSUSE Tubleweed
|
||||
|
||||
## 支持的架构和设备
|
||||
<details>
|
||||
<summary>点击查看 支持的架构和设备</summary>
|
||||
|
||||
我们的平台提供与各种架构和设备的兼容性,确保在各种计算环境中的灵活性。以下是我们支持的关键架构:
|
||||
|
||||
- **amd64**: 这种流行的架构是个人计算机和服务器的标准,可以无缝地适应大多数现代操作系统。
|
||||
|
||||
- **x86 / i386**: 这种架构在台式机和笔记本电脑中被广泛采用,得到了众多操作系统和应用程序的广泛支持,包括但不限于 Windows、macOS 和 Linux 系统。
|
||||
|
||||
- **armv8 / arm64 / aarch64**: 这种架构专为智能手机和平板电脑等当代移动和嵌入式设备量身定制,以 Raspberry Pi 4、Raspberry Pi 3、Raspberry Pi Zero 2/Zero 2 W、Orange Pi 3 LTS 等设备为例。
|
||||
|
||||
- **armv7 / arm / arm32**: 作为较旧的移动和嵌入式设备的架构,它仍然广泛用于Orange Pi Zero LTS、Orange Pi PC Plus、Raspberry Pi 2等设备。
|
||||
|
||||
- **armv6 / arm / arm32**: 这种架构面向非常老旧的嵌入式设备,虽然不太普遍,但仍在使用中。Raspberry Pi 1、Raspberry Pi Zero/Zero W 等设备都依赖于这种架构。
|
||||
|
||||
- **armv5 / arm / arm32**: 它是一种主要与早期嵌入式系统相关的旧架构,目前不太常见,但仍可能出现在早期 Raspberry Pi 版本和一些旧智能手机等传统设备中。
|
||||
</details>
|
||||
|
||||
## Languages
|
||||
|
||||
- English(英语)
|
||||
- Farsi(伊朗语)
|
||||
- Chinese(中文)
|
||||
- Russian(俄语)
|
||||
- Vietnamese(越南语)
|
||||
- Spanish(西班牙语)
|
||||
- Indonesian (印度尼西亚语)
|
||||
- Ukrainian(乌克兰语)
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
- 系统状态监控
|
||||
- 在所有入站和客户端中搜索
|
||||
- 深色/浅色主题
|
||||
- 支持多用户和多协议
|
||||
- 支持多种协议,包括 VMess、VLESS、Trojan、Shadowsocks、Dokodemo-door、Socks、HTTP、wireguard
|
||||
- 支持 XTLS 原生协议,包括 RPRX-Direct、Vision、REALITY
|
||||
- 流量统计、流量限制、过期时间限制
|
||||
- 可自定义的 Xray配置模板
|
||||
- 支持HTTPS访问面板(自建域名+SSL证书)
|
||||
- 支持一键式SSL证书申请和自动续费
|
||||
- 更多高级配置项目请参考面板
|
||||
- 修复了 API 路由(用户设置将使用 API 创建)
|
||||
- 支持通过面板中提供的不同项目更改配置。
|
||||
- 支持从面板导出/导入数据库
|
||||
|
||||
|
||||
## 默认设置
|
||||
|
||||
<details>
|
||||
<summary>点击查看 默认设置</summary>
|
||||
|
||||
### 信息
|
||||
|
||||
- **端口:** 2053
|
||||
- **用户名 & 密码:** 当您跳过设置时,此项会随机生成。
|
||||
- **数据库路径:**
|
||||
- /etc/x-ui/x-ui.db
|
||||
- **Xray 配置路径:**
|
||||
- /usr/local/x-ui/bin/config.json
|
||||
- **面板链接(无SSL):**
|
||||
- http://ip:2053/panel
|
||||
- http://domain:2053/panel
|
||||
- **面板链接(有SSL):**
|
||||
- https://domain:2053/panel
|
||||
|
||||
</details>
|
||||
|
||||
## WARP 配置
|
||||
|
||||
<details>
|
||||
<summary>点击查看 WARP 配置</summary>
|
||||
|
||||
#### 使用
|
||||
|
||||
如果要在 v2.1.0 之前使用 WARP 路由,请按照以下步骤操作:
|
||||
|
||||
**1.** 在 **SOCKS Proxy Mode** 模式中安装Wrap
|
||||
|
||||
```sh
|
||||
bash <(curl -sSL https://raw.githubusercontent.com/hamid-gh98/x-ui-scripts/main/install_warp_proxy.sh)
|
||||
```
|
||||
|
||||
**2.** 如果您已经安装了 warp,您可以使用以下命令卸载:
|
||||
|
||||
```sh
|
||||
warp u
|
||||
```
|
||||
|
||||
**3.** 在面板中打开您需要的配置
|
||||
|
||||
配置:
|
||||
|
||||
- Block Ads
|
||||
- Route Google + Netflix + Spotify + OpenAI (ChatGPT) to WARP
|
||||
- Fix Google 403 error
|
||||
|
||||
</details>
|
||||
|
||||
## IP 限制
|
||||
|
||||
<details>
|
||||
<summary>点击查看 IP 限制</summary>
|
||||
|
||||
#### 使用
|
||||
|
||||
**注意:** 使用 IP 隧道时,IP 限制无法正常工作。
|
||||
|
||||
- 适用于最高 `v1.6.1` :
|
||||
|
||||
- IP 限制 已被集成在面板中。
|
||||
|
||||
- 适用于 `v1.7.0` 以及更新的版本:
|
||||
|
||||
- 要使 IP 限制正常工作,您需要按照以下步骤安装 fail2ban 及其所需的文件:
|
||||
|
||||
1. 使用面板内置的 `x-ui` 指令
|
||||
2. 选择 `IP Limit Management`.
|
||||
3. 根据您的需要选择合适的选项。
|
||||
|
||||
- 确保您的 Xray 配置上有 ./access.log 。在 v2.1.3 之后,我们有一个选项。
|
||||
|
||||
```sh
|
||||
"log": {
|
||||
"access": "./access.log",
|
||||
"dnsLog": false,
|
||||
"loglevel": "warning"
|
||||
},
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Telegram 机器人
|
||||
|
||||
<details>
|
||||
<summary>点击查看 Telegram 机器人</summary>
|
||||
|
||||
#### 使用
|
||||
|
||||
Web 面板通过 Telegram Bot 支持每日流量、面板登录、数据库备份、系统状态、客户端信息等通知和功能。要使用机器人,您需要在面板中设置机器人相关参数,包括:
|
||||
|
||||
- 电报令牌
|
||||
- 管理员聊天 ID
|
||||
- 通知时间(cron 语法)
|
||||
- 到期日期通知
|
||||
- 流量上限通知
|
||||
- 数据库备份
|
||||
- CPU 负载通知
|
||||
|
||||
|
||||
**参考:**
|
||||
|
||||
- `30 \* \* \* \* \*` - 在每个点的 30 秒处通知
|
||||
- `0 \*/10 \* \* \* \*` - 每 10 分钟的第一秒通知
|
||||
- `@hourly` - 每小时通知
|
||||
- `@daily` - 每天通知 (00:00)
|
||||
- `@weekly` - 每周通知
|
||||
- `@every 8h` - 每8小时通知
|
||||
|
||||
### Telegram Bot 功能
|
||||
|
||||
- 定期报告
|
||||
- 登录通知
|
||||
- CPU 阈值通知
|
||||
- 提前报告的过期时间和流量阈值
|
||||
- 如果将客户的电报用户名添加到用户的配置中,则支持客户端报告菜单
|
||||
- 支持使用UUID(VMESS/VLESS)或密码(TROJAN)搜索报文流量报告 - 匿名
|
||||
- 基于菜单的机器人
|
||||
- 通过电子邮件搜索客户端(仅限管理员)
|
||||
- 检查所有入库
|
||||
- 检查服务器状态
|
||||
- 检查耗尽的用户
|
||||
- 根据请求和定期报告接收备份
|
||||
- 多语言机器人
|
||||
|
||||
### 注册 Telegram bot
|
||||
|
||||
- 与 [Botfather](https://t.me/BotFather) 对话:
|
||||

|
||||
|
||||
- 使用 /newbot 创建新机器人:你需要提供机器人名称以及用户名,注意名称中末尾要包含“bot”
|
||||

|
||||
|
||||
- 启动您刚刚创建的机器人。可以在此处找到机器人的链接。
|
||||

|
||||
|
||||
- 输入您的面板并配置 Telegram 机器人设置,如下所示:
|
||||

|
||||
|
||||
在输入字段编号 3 中输入机器人令牌。
|
||||
在输入字段编号 4 中输入用户 ID。具有此 id 的 Telegram 帐户将是机器人管理员。 (您可以输入多个,只需将它们用“ ,”分开即可)
|
||||
|
||||
- 如何获取TG ID? 使用 [bot](https://t.me/useridinfobot), 启动机器人,它会给你 Telegram 用户 ID。
|
||||

|
||||
|
||||
</details>
|
||||
|
||||
## API 路由
|
||||
|
||||
<details>
|
||||
<summary>点击查看 API 路由</summary>
|
||||
|
||||
#### 使用
|
||||
|
||||
- `/login` 使用 `POST` 用户名称 & 密码: `{username: '', password: ''}` 登录
|
||||
- `/panel/api/inbounds` 以下操作的基础:
|
||||
|
||||
| 方法 | 路径 | 操作 |
|
||||
| :----: | ---------------------------------- | --------------------------------- |
|
||||
| `GET` | `"/list"` | 获取所有入站 |
|
||||
| `GET` | `"/get/:id"` | 获取所有入站以及inbound.id |
|
||||
| `GET` | `"/getClientTraffics/:email"` | 通过电子邮件获取客户端流量 |
|
||||
| `GET` | `"/createbackup"` | Telegram 机器人向管理员发送备份 |
|
||||
| `POST` | `"/add"` | 添加入站 |
|
||||
| `POST` | `"/del/:id"` | 删除入站 |
|
||||
| `POST` | `"/update/:id"` | 更新入站 |
|
||||
| `POST` | `"/clientIps/:email"` | 客户端 IP 地址 |
|
||||
| `POST` | `"/clearClientIps/:email"` | 清除客户端 IP 地址 |
|
||||
| `POST` | `"/addClient"` | 将客户端添加到入站 |
|
||||
| `POST` | `"/:id/delClient/:clientId"` | 通过 clientId\* 删除客户端 |
|
||||
| `POST` | `"/updateClient/:clientId"` | 通过 clientId\* 更新客户端 |
|
||||
| `POST` | `"/:id/resetClientTraffic/:email"` | 重置客户端的流量 |
|
||||
| `POST` | `"/resetAllTraffics"` | 重置所有入站的流量 |
|
||||
| `POST` | `"/resetAllClientTraffics/:id"` | 重置入站中所有客户端的流量 |
|
||||
| `POST` | `"/delDepletedClients/:id"` | 删除入站耗尽的客户端 (-1: all) |
|
||||
| `POST` | `"/onlines"` | 获取在线用户 ( 电子邮件列表 ) |
|
||||
|
||||
\*- `clientId` 项应该使用下列数据
|
||||
|
||||
- `client.id` VMESS and VLESS
|
||||
- `client.password` TROJAN
|
||||
- `client.email` Shadowsocks
|
||||
|
||||
|
||||
- [API 文档](https://documenter.getpostman.com/view/16802678/2s9YkgD5jm)
|
||||
- [<img src="https://run.pstmn.io/button.svg" alt="Run In Postman" style="width: 128px; height: 32px;">](https://app.getpostman.com/run-collection/16802678-1a4c9270-ac77-40ed-959a-7aa56dc4a415?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D16802678-1a4c9270-ac77-40ed-959a-7aa56dc4a415%26entityType%3Dcollection%26workspaceId%3D2cd38c01-c851-4a15-a972-f181c23359d9)
|
||||
</details>
|
||||
|
||||
## 环境变量
|
||||
|
||||
<details>
|
||||
<summary>点击查看 环境变量</summary>
|
||||
|
||||
#### Usage
|
||||
|
||||
| 变量 | Type | 默认 |
|
||||
| -------------- | :--------------------------------------------: | :------------ |
|
||||
| XUI_LOG_LEVEL | `"debug"` \| `"info"` \| `"warn"` \| `"error"` | `"info"` |
|
||||
| XUI_DEBUG | `boolean` | `false` |
|
||||
| XUI_BIN_FOLDER | `string` | `"bin"` |
|
||||
| XUI_DB_FOLDER | `string` | `"/etc/x-ui"` |
|
||||
| XUI_LOG_FOLDER | `string` | `"/var/log"` |
|
||||
|
||||
例子:
|
||||
|
||||
```sh
|
||||
XUI_BIN_FOLDER="bin" XUI_DB_FOLDER="/etc/x-ui" go build main.go
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## 预览
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
## 特别感谢
|
||||
|
||||
- [alireza0](https://github.com/alireza0/)
|
||||
|
||||
## 致谢
|
||||
|
||||
- [Iran v2ray rules](https://github.com/chocolate4u/Iran-v2ray-rules) (License: **GPL-3.0**): _Enhanced v2ray/xray and v2ray/xray-clients routing rules with built-in Iranian domains and a focus on security and adblocking._
|
||||
- [Vietnam Adblock rules](https://github.com/vuong2023/vn-v2ray-rules) (License: **GPL-3.0**): _A hosted domain hosted in Vietnam and blocklist with the most efficiency for Vietnamese._
|
||||
|
||||
## Star趋势
|
||||
|
||||
[](https://starchart.cc/xeefei/3x-ui)
|
||||
373
install.sh
@ -10,7 +10,7 @@ cur_dir=$(pwd)
|
||||
show_ip_service_lists=("https://api.ipify.org" "https://4.ident.me")
|
||||
|
||||
# check root
|
||||
[[ $EUID -ne 0 ]] && echo -e "${red}Fatal error: ${plain} Please run this script with root privilege \n " && exit 1
|
||||
[[ $EUID -ne 0 ]] && echo -e "${red}致命错误: ${plain} 请使用 root 权限运行此脚本\n" && exit 1
|
||||
|
||||
# Check OS and set release variable
|
||||
if [[ -f /etc/os-release ]]; then
|
||||
@ -20,39 +20,126 @@ elif [[ -f /usr/lib/os-release ]]; then
|
||||
source /usr/lib/os-release
|
||||
release=$ID
|
||||
else
|
||||
echo "Failed to check the system OS, please contact the author!" >&2
|
||||
echo ""
|
||||
echo -e "${red}检查服务器操作系统失败,请联系作者!${plain}" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "The OS release is: $release"
|
||||
echo ""
|
||||
echo -e "${green}---------->>>>>目前服务器的操作系统为: $release${plain}"
|
||||
|
||||
arch() {
|
||||
case "$(uname -m)" in
|
||||
x86_64 | x64 | amd64) echo 'amd64' ;;
|
||||
i*86 | x86) echo '386' ;;
|
||||
armv8* | armv8 | arm64 | aarch64) echo 'arm64' ;;
|
||||
armv7* | armv7 | arm) echo 'armv7' ;;
|
||||
armv6* | armv6) echo 'armv6' ;;
|
||||
armv5* | armv5) echo 'armv5' ;;
|
||||
s390x) echo 's390x' ;;
|
||||
*) echo -e "${green}Unsupported CPU architecture! ${plain}" && rm -f install.sh && exit 1 ;;
|
||||
x86_64 | x64 | amd64 ) echo 'amd64' ;;
|
||||
i*86 | x86 ) echo '386' ;;
|
||||
armv8* | armv8 | arm64 | aarch64 ) echo 'arm64' ;;
|
||||
armv7* | armv7 | arm ) echo 'armv7' ;;
|
||||
armv6* | armv6 ) echo 'armv6' ;;
|
||||
armv5* | armv5 ) echo 'armv5' ;;
|
||||
s390x) echo 's390x' ;;
|
||||
*) echo -e "${green}不支持的CPU架构! ${plain}" && rm -f install.sh && exit 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
echo "Arch: $(arch)"
|
||||
|
||||
echo ""
|
||||
check_glibc_version() {
|
||||
glibc_version=$(ldd --version | head -n1 | awk '{print $NF}')
|
||||
|
||||
|
||||
required_version="2.32"
|
||||
if [[ "$(printf '%s\n' "$required_version" "$glibc_version" | sort -V | head -n1)" != "$required_version" ]]; then
|
||||
echo -e "${red}GLIBC version $glibc_version is too old! Required: 2.32 or higher${plain}"
|
||||
echo "Please upgrade to a newer version of your operating system to get a higher GLIBC version."
|
||||
echo -e "${red}------>>>GLIBC版本 $glibc_version 太旧了! 要求2.32或以上版本${plain}"
|
||||
echo -e "${green}-------->>>>请升级到较新版本的操作系统以便获取更高版本的GLIBC${plain}"
|
||||
exit 1
|
||||
fi
|
||||
echo "GLIBC version: $glibc_version (meets requirement of 2.32+)"
|
||||
echo -e "${green}-------->>>>GLIBC版本: $glibc_version(符合高于2.32的要求)${plain}"
|
||||
}
|
||||
check_glibc_version
|
||||
|
||||
echo ""
|
||||
echo -e "${yellow}---------->>>>>当前系统的架构为: $(arch)${plain}"
|
||||
echo ""
|
||||
last_version=$(curl -Ls "https://api.github.com/repos/xeefei/3x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||
# 获取 x-ui 版本
|
||||
xui_version=$(/usr/local/x-ui/x-ui -v)
|
||||
|
||||
# 检查 xui_version 是否为空
|
||||
if [[ -z "$xui_version" ]]; then
|
||||
echo ""
|
||||
echo -e "${red}------>>>当前服务器没有安装任何 x-ui 系列代理面板${plain}"
|
||||
echo ""
|
||||
echo -e "${green}-------->>>>片刻之后脚本将会自动引导安装〔3X-UI优化版〕${plain}"
|
||||
else
|
||||
# 检查版本号中是否包含冒号
|
||||
if [[ "$xui_version" == *:* ]]; then
|
||||
echo -e "${green}---------->>>>>当前代理面板的版本为: ${red}其他 x-ui 分支版本${plain}"
|
||||
echo ""
|
||||
echo -e "${green}-------->>>>片刻之后脚本将会自动引导安装〔3X-UI优化版〕${plain}"
|
||||
else
|
||||
echo -e "${green}---------->>>>>当前代理面板的版本为: ${red}〔3X-UI优化版〕v${xui_version}${plain}"
|
||||
fi
|
||||
fi
|
||||
echo ""
|
||||
echo -e "${yellow}---------------------->>>>>〔3X-UI优化版〕最新版为:${last_version}${plain}"
|
||||
sleep 4
|
||||
|
||||
os_version=$(grep -i version_id /etc/os-release | cut -d \" -f2 | cut -d . -f1)
|
||||
|
||||
if [[ "${release}" == "arch" ]]; then
|
||||
echo "您的操作系统是 ArchLinux"
|
||||
elif [[ "${release}" == "manjaro" ]]; then
|
||||
echo "您的操作系统是 Manjaro"
|
||||
elif [[ "${release}" == "armbian" ]]; then
|
||||
echo "您的操作系统是 Armbian"
|
||||
elif [[ "${release}" == "alpine" ]]; then
|
||||
echo "您的操作系统是 Alpine Linux"
|
||||
elif [[ "${release}" == "opensuse-tumbleweed" ]]; then
|
||||
echo "您的操作系统是 OpenSUSE Tumbleweed"
|
||||
elif [[ "${release}" == "centos" ]]; then
|
||||
if [[ ${os_version} -lt 8 ]]; then
|
||||
echo -e "${red} 请使用 CentOS 8 或更高版本 ${plain}\n" && exit 1
|
||||
fi
|
||||
elif [[ "${release}" == "ubuntu" ]]; then
|
||||
if [[ ${os_version} -lt 20 ]]; then
|
||||
echo -e "${red} 请使用 Ubuntu 20 或更高版本!${plain}\n" && exit 1
|
||||
fi
|
||||
elif [[ "${release}" == "fedora" ]]; then
|
||||
if [[ ${os_version} -lt 36 ]]; then
|
||||
echo -e "${red} 请使用 Fedora 36 或更高版本!${plain}\n" && exit 1
|
||||
fi
|
||||
elif [[ "${release}" == "debian" ]]; then
|
||||
if [[ ${os_version} -lt 11 ]]; then
|
||||
echo -e "${red} 请使用 Debian 11 或更高版本 ${plain}\n" && exit 1
|
||||
fi
|
||||
elif [[ "${release}" == "almalinux" ]]; then
|
||||
if [[ ${os_version} -lt 9 ]]; then
|
||||
echo -e "${red} 请使用 AlmaLinux 9 或更高版本 ${plain}\n" && exit 1
|
||||
fi
|
||||
elif [[ "${release}" == "rocky" ]]; then
|
||||
if [[ ${os_version} -lt 9 ]]; then
|
||||
echo -e "${red} 请使用 RockyLinux 9 或更高版本 ${plain}\n" && exit 1
|
||||
fi
|
||||
elif [[ "${release}" == "oracle" ]]; then
|
||||
if [[ ${os_version} -lt 8 ]]; then
|
||||
echo -e "${red} 请使用 Oracle Linux 8 或更高版本 ${plain}\n" && exit 1
|
||||
fi
|
||||
else
|
||||
echo -e "${red}此脚本不支持您的操作系统。${plain}\n"
|
||||
echo "请确保您使用的是以下受支持的操作系统之一:"
|
||||
echo "- Ubuntu 20.04+"
|
||||
echo "- Debian 11+"
|
||||
echo "- CentOS 8+"
|
||||
echo "- Fedora 36+"
|
||||
echo "- Arch Linux"
|
||||
echo "- Manjaro"
|
||||
echo "- Armbian"
|
||||
echo "- Alpine Linux"
|
||||
echo "- AlmaLinux 9+"
|
||||
echo "- Rocky Linux 9+"
|
||||
echo "- Oracle Linux 8+"
|
||||
echo "- OpenSUSE Tumbleweed"
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
||||
install_base() {
|
||||
case "${release}" in
|
||||
ubuntu | debian | armbian)
|
||||
@ -67,6 +154,9 @@ install_base() {
|
||||
arch | manjaro | parch)
|
||||
pacman -Syu && pacman -Syu --noconfirm wget curl tar tzdata
|
||||
;;
|
||||
alpine)
|
||||
apk update && apk add --no-cache wget curl tar tzdata
|
||||
;;
|
||||
opensuse-tumbleweed)
|
||||
zypper refresh && zypper -q install -y wget curl tar timezone
|
||||
;;
|
||||
@ -82,112 +172,119 @@ gen_random_string() {
|
||||
echo "$random_string"
|
||||
}
|
||||
|
||||
# This function will be called when user installed x-ui out of security
|
||||
config_after_install() {
|
||||
local existing_hasDefaultCredential=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'hasDefaultCredential: .+' | awk '{print $2}')
|
||||
local existing_webBasePath=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'webBasePath: .+' | awk '{print $2}')
|
||||
local existing_port=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'port: .+' | awk '{print $2}')
|
||||
|
||||
for ip_service_addr in "${show_ip_service_lists[@]}"; do
|
||||
local server_ip=$(curl -s --max-time 3 ${ip_service_addr} 2>/dev/null)
|
||||
if [ -n "${server_ip}" ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ${#existing_webBasePath} -lt 4 ]]; then
|
||||
if [[ "$existing_hasDefaultCredential" == "true" ]]; then
|
||||
local config_webBasePath=$(gen_random_string 18)
|
||||
local config_username=$(gen_random_string 10)
|
||||
local config_password=$(gen_random_string 10)
|
||||
|
||||
read -rp "Would you like to customize the Panel Port settings? (If not, a random port will be applied) [y/n]: " config_confirm
|
||||
if [[ "${config_confirm}" == "y" || "${config_confirm}" == "Y" ]]; then
|
||||
read -rp "Please set up the panel port: " config_port
|
||||
echo -e "${yellow}Your Panel Port is: ${config_port}${plain}"
|
||||
else
|
||||
local config_port=$(shuf -i 1024-62000 -n 1)
|
||||
echo -e "${yellow}Generated random port: ${config_port}${plain}"
|
||||
fi
|
||||
|
||||
/usr/local/x-ui/x-ui setting -username "${config_username}" -password "${config_password}" -port "${config_port}" -webBasePath "${config_webBasePath}"
|
||||
echo -e "This is a fresh installation, generating random login info for security concerns:"
|
||||
echo -e "###############################################"
|
||||
echo -e "${green}Username: ${config_username}${plain}"
|
||||
echo -e "${green}Password: ${config_password}${plain}"
|
||||
echo -e "${green}Port: ${config_port}${plain}"
|
||||
echo -e "${green}WebBasePath: ${config_webBasePath}${plain}"
|
||||
echo -e "${green}Access URL: http://${server_ip}:${config_port}/${config_webBasePath}${plain}"
|
||||
echo -e "###############################################"
|
||||
else
|
||||
local config_webBasePath=$(gen_random_string 18)
|
||||
echo -e "${yellow}WebBasePath is missing or too short. Generating a new one...${plain}"
|
||||
/usr/local/x-ui/x-ui setting -webBasePath "${config_webBasePath}"
|
||||
echo -e "${green}New WebBasePath: ${config_webBasePath}${plain}"
|
||||
echo -e "${green}Access URL: http://${server_ip}:${existing_port}/${config_webBasePath}${plain}"
|
||||
fi
|
||||
echo -e "${yellow}安装/更新完成! 为了您的面板安全,建议修改面板设置 ${plain}"
|
||||
echo ""
|
||||
read -p "$(echo -e "${green}想继续修改吗?${red}选择“n”以保留旧设置${plain} [y/n]?--->>请输入:")" config_confirm
|
||||
if [[ "${config_confirm}" == "y" || "${config_confirm}" == "Y" ]]; then
|
||||
read -p "请设置您的用户名: " config_account
|
||||
echo -e "${yellow}您的用户名将是: ${config_account}${plain}"
|
||||
read -p "请设置您的密码: " config_password
|
||||
echo -e "${yellow}您的密码将是: ${config_password}${plain}"
|
||||
read -p "请设置面板端口: " config_port
|
||||
echo -e "${yellow}您的面板端口号为: ${config_port}${plain}"
|
||||
read -p "请设置面板登录访问路径(访问方式演示:ip:端口号/路径/): " config_webBasePath
|
||||
echo -e "${yellow}您的面板访问路径为: ${config_webBasePath}${plain}"
|
||||
echo -e "${yellow}正在初始化,请稍候...${plain}"
|
||||
/usr/local/x-ui/x-ui setting -username ${config_account} -password ${config_password}
|
||||
echo -e "${yellow}用户名和密码设置成功!${plain}"
|
||||
/usr/local/x-ui/x-ui setting -port ${config_port}
|
||||
echo -e "${yellow}面板端口号设置成功!${plain}"
|
||||
/usr/local/x-ui/x-ui setting -webBasePath ${config_webBasePath}
|
||||
echo -e "${yellow}面板登录访问路径设置成功!${plain}"
|
||||
echo ""
|
||||
else
|
||||
if [[ "$existing_hasDefaultCredential" == "true" ]]; then
|
||||
local config_username=$(gen_random_string 10)
|
||||
local config_password=$(gen_random_string 10)
|
||||
|
||||
echo -e "${yellow}Default credentials detected. Security update required...${plain}"
|
||||
/usr/local/x-ui/x-ui setting -username "${config_username}" -password "${config_password}"
|
||||
echo -e "Generated new random login credentials:"
|
||||
echo ""
|
||||
sleep 1
|
||||
echo -e "${red}--------------->>>>Cancel...--------------->>>>>>>取消修改...${plain}"
|
||||
echo ""
|
||||
if [[ ! -f "/etc/x-ui/x-ui.db" ]]; then
|
||||
local usernameTemp=$(head -c 6 /dev/urandom | base64)
|
||||
local passwordTemp=$(head -c 6 /dev/urandom | base64)
|
||||
local webBasePathTemp=$(gen_random_string 10)
|
||||
/usr/local/x-ui/x-ui setting -username ${usernameTemp} -password ${passwordTemp} -webBasePath ${webBasePathTemp}
|
||||
echo -e "${yellow}检测到为全新安装,出于安全考虑将生成随机登录信息:${plain}"
|
||||
echo -e "###############################################"
|
||||
echo -e "${green}Username: ${config_username}${plain}"
|
||||
echo -e "${green}Password: ${config_password}${plain}"
|
||||
echo -e "${green}用户名: ${usernameTemp}${plain}"
|
||||
echo -e "${green}密 码: ${passwordTemp}${plain}"
|
||||
echo -e "${green}访问路径: ${webBasePathTemp}${plain}"
|
||||
echo -e "###############################################"
|
||||
echo -e "${green}如果您忘记了登录信息,可以在安装后通过 x-ui 命令然后输入${red}数字 10 选项${green}进行查看${plain}"
|
||||
else
|
||||
echo -e "${green}Username, Password, and WebBasePath are properly set. Exiting...${plain}"
|
||||
echo -e "${green}此次操作属于版本升级,保留之前旧设置项,登录方式保持不变${plain}"
|
||||
echo ""
|
||||
echo -e "${green}如果您忘记了登录信息,您可以通过 x-ui 命令然后输入${red}数字 10 选项${green}进行查看${plain}"
|
||||
echo ""
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
echo -e ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
|
||||
echo ""
|
||||
/usr/local/x-ui/x-ui migrate
|
||||
}
|
||||
|
||||
echo ""
|
||||
install_x-ui() {
|
||||
cd /usr/local/
|
||||
|
||||
# Download resources
|
||||
if [ $# == 0 ]; then
|
||||
tag_version=$(curl -Ls "https://api.github.com/repos/MHSanaei/3x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||
if [[ ! -n "$tag_version" ]]; then
|
||||
echo -e "${red}Failed to fetch x-ui version, it may be due to GitHub API restrictions, please try it later${plain}"
|
||||
last_version=$(curl -Ls "https://api.github.com/repos/xeefei/3x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||
if [[ ! -n "$last_version" ]]; then
|
||||
echo -e "${red}获取 3x-ui 版本失败,可能是 Github API 限制,请稍后再试${plain}"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "Got x-ui latest version: ${tag_version}, beginning the installation..."
|
||||
wget -N -O /usr/local/x-ui-linux-$(arch).tar.gz https://github.com/MHSanaei/3x-ui/releases/download/${tag_version}/x-ui-linux-$(arch).tar.gz
|
||||
echo ""
|
||||
echo -e "-----------------------------------------------------"
|
||||
echo -e "${green}--------->>获取 3x-ui 最新版本:${yellow}${last_version}${plain}${green},开始安装...${plain}"
|
||||
echo -e "-----------------------------------------------------"
|
||||
echo ""
|
||||
sleep 2
|
||||
echo -e "${green}---------------->>>>>>>>>安装进度50%${plain}"
|
||||
sleep 3
|
||||
echo ""
|
||||
echo -e "${green}---------------->>>>>>>>>>>>>>>>>>>>>安装进度100%${plain}"
|
||||
echo ""
|
||||
sleep 2
|
||||
wget -N --no-check-certificate -O /usr/local/x-ui-linux-$(arch).tar.gz https://github.com/xeefei/3x-ui/releases/download/${last_version}/x-ui-linux-$(arch).tar.gz
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo -e "${red}Downloading x-ui failed, please be sure that your server can access GitHub ${plain}"
|
||||
echo -e "${red}下载 3x-ui 失败, 请检查服务器是否可以连接至 GitHub? ${plain}"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
tag_version=$1
|
||||
tag_version_numeric=${tag_version#v}
|
||||
min_version="2.3.5"
|
||||
|
||||
if [[ "$(printf '%s\n' "$min_version" "$tag_version_numeric" | sort -V | head -n1)" != "$min_version" ]]; then
|
||||
echo -e "${red}Please use a newer version (at least v2.3.5). Exiting installation.${plain}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
url="https://github.com/MHSanaei/3x-ui/releases/download/${tag_version}/x-ui-linux-$(arch).tar.gz"
|
||||
echo -e "Beginning to install x-ui $1"
|
||||
wget -N -O /usr/local/x-ui-linux-$(arch).tar.gz ${url}
|
||||
last_version=$1
|
||||
url="https://github.com/xeefei/3x-ui/releases/download/${last_version}/x-ui-linux-$(arch).tar.gz"
|
||||
echo ""
|
||||
echo -e "--------------------------------------------"
|
||||
echo -e "${green}---------------->>>>开始安装 3x-ui $1${plain}"
|
||||
echo -e "--------------------------------------------"
|
||||
echo ""
|
||||
sleep 2
|
||||
echo -e "${green}---------------->>>>>>>>>安装进度50%${plain}"
|
||||
sleep 3
|
||||
echo ""
|
||||
echo -e "${green}---------------->>>>>>>>>>>>>>>>>>>>>安装进度100%${plain}"
|
||||
echo ""
|
||||
sleep 2
|
||||
wget -N --no-check-certificate -O /usr/local/x-ui-linux-$(arch).tar.gz ${url}
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo -e "${red}Download x-ui $1 failed, please check if the version exists ${plain}"
|
||||
echo -e "${red}下载 3x-ui $1 失败, 请检查此版本是否存在 ${plain}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
wget -O /usr/bin/x-ui-temp https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.sh
|
||||
wget -O /usr/bin/x-ui-temp https://raw.githubusercontent.com/xeefei/3x-ui/main/x-ui.sh
|
||||
|
||||
# Stop x-ui service and remove old resources
|
||||
if [[ -e /usr/local/x-ui/ ]]; then
|
||||
systemctl stop x-ui
|
||||
rm /usr/local/x-ui/ -rf
|
||||
fi
|
||||
|
||||
# Extract resources and set permissions
|
||||
|
||||
sleep 3
|
||||
echo -e "${green}------->>>>>>>>>>>检查并保存安装目录${plain}"
|
||||
echo ""
|
||||
tar zxvf x-ui-linux-$(arch).tar.gz
|
||||
rm x-ui-linux-$(arch).tar.gz -f
|
||||
|
||||
@ -205,34 +302,82 @@ install_x-ui() {
|
||||
# Update x-ui cli and se set permission
|
||||
mv -f /usr/bin/x-ui-temp /usr/bin/x-ui
|
||||
chmod +x /usr/bin/x-ui
|
||||
sleep 2
|
||||
echo -e "${green}------->>>>>>>>>>>保存成功${plain}"
|
||||
sleep 2
|
||||
echo ""
|
||||
config_after_install
|
||||
|
||||
cp -f x-ui.service /etc/systemd/system/
|
||||
systemctl daemon-reload
|
||||
systemctl enable x-ui
|
||||
systemctl start x-ui
|
||||
echo -e "${green}x-ui ${tag_version}${plain} installation finished, it is running now..."
|
||||
echo -e ""
|
||||
echo -e "┌───────────────────────────────────────────────────────┐
|
||||
│ ${blue}x-ui control menu usages (subcommands):${plain} │
|
||||
│ │
|
||||
│ ${blue}x-ui${plain} - Admin Management Script │
|
||||
│ ${blue}x-ui start${plain} - Start │
|
||||
│ ${blue}x-ui stop${plain} - Stop │
|
||||
│ ${blue}x-ui restart${plain} - Restart │
|
||||
│ ${blue}x-ui status${plain} - Current Status │
|
||||
│ ${blue}x-ui settings${plain} - Current Settings │
|
||||
│ ${blue}x-ui enable${plain} - Enable Autostart on OS Startup │
|
||||
│ ${blue}x-ui disable${plain} - Disable Autostart on OS Startup │
|
||||
│ ${blue}x-ui log${plain} - Check logs │
|
||||
│ ${blue}x-ui banlog${plain} - Check Fail2ban ban logs │
|
||||
│ ${blue}x-ui update${plain} - Update │
|
||||
│ ${blue}x-ui legacy${plain} - legacy version │
|
||||
│ ${blue}x-ui install${plain} - Install │
|
||||
│ ${blue}x-ui uninstall${plain} - Uninstall │
|
||||
└───────────────────────────────────────────────────────┘"
|
||||
}
|
||||
systemctl stop warp-go >/dev/null 2>&1
|
||||
wg-quick down wgcf >/dev/null 2>&1
|
||||
ipv4=$(curl -s4m8 ip.p3terx.com -k | sed -n 1p)
|
||||
ipv6=$(curl -s6m8 ip.p3terx.com -k | sed -n 1p)
|
||||
systemctl start warp-go >/dev/null 2>&1
|
||||
wg-quick up wgcf >/dev/null 2>&1
|
||||
|
||||
echo -e "${green}Running...${plain}"
|
||||
echo ""
|
||||
echo -e "------->>>>${green}3x-ui ${last_version}${plain}<<<<安装成功,正在启动..."
|
||||
sleep 1
|
||||
echo ""
|
||||
echo -e " ---------------------"
|
||||
echo -e " |${green}3X-UI 控制菜单用法 ${plain}|${plain}"
|
||||
echo -e " | ${yellow}一个更好的面板 ${plain}|${plain}"
|
||||
echo -e " | ${yellow}基于Xray Core构建 ${plain}|${plain}"
|
||||
echo -e "--------------------------------------------"
|
||||
echo -e "x-ui - 进入管理脚本"
|
||||
echo -e "x-ui start - 启动 3x-ui 面板"
|
||||
echo -e "x-ui stop - 关闭 3x-ui 面板"
|
||||
echo -e "x-ui restart - 重启 3x-ui 面板"
|
||||
echo -e "x-ui status - 查看 3x-ui 状态"
|
||||
echo -e "x-ui settings - 查看当前设置信息"
|
||||
echo -e "x-ui enable - 启用 3x-ui 开机启动"
|
||||
echo -e "x-ui disable - 禁用 3x-ui 开机启动"
|
||||
echo -e "x-ui log - 查看 3x-ui 运行日志"
|
||||
echo -e "x-ui banlog - 检查 Fail2ban 禁止日志"
|
||||
echo -e "x-ui update - 更新 3x-ui 面板"
|
||||
echo -e "x-ui custom - 自定义 3x-ui 版本"
|
||||
echo -e "x-ui install - 安装 3x-ui 面板"
|
||||
echo -e "x-ui uninstall - 卸载 3x-ui 面板"
|
||||
echo -e "--------------------------------------------"
|
||||
echo ""
|
||||
# if [[ -n $ipv4 ]]; then
|
||||
# echo -e "${yellow}面板 IPv4 访问地址为:${green}http://$ipv4:${config_port}/${config_webBasePath}${plain}"
|
||||
# fi
|
||||
# if [[ -n $ipv6 ]]; then
|
||||
# echo -e "${yellow}面板 IPv6 访问地址为:${green}http://[$ipv6]:${config_port}/${config_webBasePath}${plain}"
|
||||
# fi
|
||||
# echo -e "请自行确保此端口没有被其他程序占用,${yellow}并且确保${red} ${config_port} ${yellow}端口已放行${plain}"
|
||||
sleep 3
|
||||
echo -e ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
|
||||
echo ""
|
||||
echo -e "${yellow}----->>>3X-UI面板和Xray启动成功<<<-----${plain}"
|
||||
}
|
||||
install_base
|
||||
install_x-ui $1
|
||||
echo ""
|
||||
echo -e "----------------------------------------------"
|
||||
sleep 4
|
||||
info=$(/usr/local/x-ui/x-ui setting -show true)
|
||||
echo -e "${info}${plain}"
|
||||
echo ""
|
||||
echo -e "若您忘记了上述面板信息,后期可通过x-ui命令进入脚本${red}输入数字〔10〕选项获取${plain}"
|
||||
echo ""
|
||||
echo -e "----------------------------------------------"
|
||||
echo ""
|
||||
sleep 2
|
||||
echo -e "${green}安装/更新完成,若在使用过程中有任何问题${plain}"
|
||||
echo -e "${yellow}请先描述清楚所遇问题加〔3X-UI〕中文交流群${plain}"
|
||||
echo -e "${yellow}在TG群中${red} https://t.me/XUI_CN ${yellow}截图进行反馈${plain}"
|
||||
echo ""
|
||||
echo -e "----------------------------------------------"
|
||||
echo ""
|
||||
echo -e "${green}〔3X-UI〕优化版项目地址:${yellow}https://github.com/xeefei/3x-ui${plain}"
|
||||
echo ""
|
||||
echo -e "${green} 详细安装教程:${yellow}https://xeefei.blogspot.com/2025/07/3x-ui.html${plain}"
|
||||
echo ""
|
||||
echo -e "----------------------------------------------"
|
||||
echo ""
|
||||
|
||||
153
main.go
@ -6,6 +6,8 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"syscall"
|
||||
_ "unsafe"
|
||||
|
||||
@ -121,23 +123,47 @@ func resetSetting() {
|
||||
settingService := service.SettingService{}
|
||||
err = settingService.ResetSettings()
|
||||
if err != nil {
|
||||
fmt.Println("Failed to reset settings:", err)
|
||||
fmt.Println("Failed to reset settings(重置设置失败):", err)
|
||||
} else {
|
||||
fmt.Println("Settings successfully reset.")
|
||||
fmt.Println("Settings successfully reset ---->>重置设置成功")
|
||||
}
|
||||
}
|
||||
|
||||
func showSetting(show bool) {
|
||||
// 执行 shell 命令获取 IPv4 地址
|
||||
cmdIPv4 := exec.Command("sh", "-c", "curl -s4m8 ip.p3terx.com -k | sed -n 1p")
|
||||
outputIPv4, err := cmdIPv4.Output()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
// 执行 shell 命令获取 IPv6 地址
|
||||
cmdIPv6 := exec.Command("sh", "-c", "curl -s6m8 ip.p3terx.com -k | sed -n 1p")
|
||||
outputIPv6, err := cmdIPv6.Output()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
// 去除命令输出中的换行符
|
||||
ipv4 := strings.TrimSpace(string(outputIPv4))
|
||||
ipv6 := strings.TrimSpace(string(outputIPv6))
|
||||
// 定义转义字符,定义不同颜色的转义字符
|
||||
const (
|
||||
Reset = "\033[0m"
|
||||
Red = "\033[31m"
|
||||
Green = "\033[32m"
|
||||
Yellow = "\033[33m"
|
||||
)
|
||||
if show {
|
||||
settingService := service.SettingService{}
|
||||
port, err := settingService.GetPort()
|
||||
if err != nil {
|
||||
fmt.Println("get current port failed, error info:", err)
|
||||
fmt.Println("get current port failed, error info(获取当前端口失败,错误信息):", err)
|
||||
}
|
||||
|
||||
webBasePath, err := settingService.GetBasePath()
|
||||
if err != nil {
|
||||
fmt.Println("get webBasePath failed, error info:", err)
|
||||
fmt.Println("get webBasePath failed, error info(获取访问路径失败,错误信息):", err)
|
||||
}
|
||||
|
||||
certFile, err := settingService.GetCertFile()
|
||||
@ -152,28 +178,77 @@ func showSetting(show bool) {
|
||||
userService := service.UserService{}
|
||||
userModel, err := userService.GetFirstUser()
|
||||
if err != nil {
|
||||
fmt.Println("get current user info failed, error info:", err)
|
||||
fmt.Println("get current user info failed, error info(获取当前用户信息失败,错误信息):", err)
|
||||
}
|
||||
|
||||
if userModel.Username == "" || userModel.Password == "" {
|
||||
fmt.Println("current username or password is empty")
|
||||
fmt.Println("current username or password is empty --->>当前用户名或密码为空")
|
||||
}
|
||||
|
||||
fmt.Println("current panel settings as follows:")
|
||||
fmt.Println("")
|
||||
fmt.Println(Yellow + "----->>>以下为面板重要信息,请自行记录保存<<<-----" + Reset)
|
||||
fmt.Println(Green + "Current panel settings as follows (当前面板设置如下):" + Reset)
|
||||
fmt.Println("")
|
||||
if certFile == "" || keyFile == "" {
|
||||
fmt.Println("Warning: Panel is not secure with SSL")
|
||||
fmt.Println(Red + "------>> 警告:面板未安装证书进行SSL保护" + Reset)
|
||||
} else {
|
||||
fmt.Println("Panel is secure with SSL")
|
||||
fmt.Println(Green + "------>> 面板已安装证书采用SSL保护" + Reset)
|
||||
}
|
||||
|
||||
fmt.Println("")
|
||||
hasDefaultCredential := func() bool {
|
||||
return userModel.Username == "admin" && crypto.CheckPasswordHash(userModel.Password, "admin")
|
||||
}()
|
||||
if hasDefaultCredential == true {
|
||||
fmt.Println(Red + "------>> 警告:使用了默认的admin账号/密码,容易被扫描" + Reset)
|
||||
} else {
|
||||
fmt.Println(Green + "------>> 为非默认admin账号/密码,请牢记" + Reset)
|
||||
}
|
||||
fmt.Println("")
|
||||
fmt.Println(Green + fmt.Sprintf("port(端口号): %d", port) + Reset)
|
||||
fmt.Println(Green + fmt.Sprintf("webBasePath(访问路径): %s", webBasePath) + Reset)
|
||||
fmt.Println(Green + "PS:为安全起见,不显示账号和密码" + Reset)
|
||||
fmt.Println(Green + "若您已经忘记账号/密码,请用脚本选项〔6〕重新设置" + Reset)
|
||||
|
||||
fmt.Println("hasDefaultCredential:", hasDefaultCredential)
|
||||
fmt.Println("port:", port)
|
||||
fmt.Println("webBasePath:", webBasePath)
|
||||
fmt.Println("")
|
||||
fmt.Println("--------------------------------------------------")
|
||||
// 根据条件打印带颜色的字符串
|
||||
if ipv4 != "" {
|
||||
fmt.Println("")
|
||||
formattedIPv4 := fmt.Sprintf("%s %s%s:%d%s" + Reset,
|
||||
Green+"面板 IPv4 访问地址------>>",
|
||||
Yellow+"http://",
|
||||
ipv4,
|
||||
port,
|
||||
Yellow+webBasePath + Reset)
|
||||
fmt.Println(formattedIPv4)
|
||||
fmt.Println("")
|
||||
}
|
||||
|
||||
if ipv6 != "" {
|
||||
fmt.Println("")
|
||||
formattedIPv6 := fmt.Sprintf("%s %s[%s%s%s]:%d%s%s",
|
||||
Green+"面板 IPv6 访问地址------>>", // 绿色的提示信息
|
||||
Yellow+"http://", // 黄色的 http:// 部分
|
||||
Yellow, // 黄色的[ 左方括号
|
||||
ipv6, // IPv6 地址
|
||||
Yellow, // 黄色的] 右方括号
|
||||
port, // 端口号
|
||||
Yellow+webBasePath, // 黄色的 Web 基础路径
|
||||
Reset) // 重置颜色
|
||||
fmt.Println(formattedIPv6)
|
||||
fmt.Println("")
|
||||
}
|
||||
fmt.Println(Green + ">>>>>>>>注:若您安装了〔证书〕,请把IP换成您的域名用https方式登录" + Reset)
|
||||
fmt.Println("")
|
||||
fmt.Println("--------------------------------------------------")
|
||||
fmt.Println("↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑")
|
||||
fmt.Println(fmt.Sprintf("%s请确保 %s%d%s 端口已打开放行%s",Green, Red, port, Green, Reset))
|
||||
fmt.Println("请自行确保此端口没有被其他程序占用")
|
||||
fmt.Println(Green + "若要登录访问面板,请复制上面的地址到浏览器" + Reset)
|
||||
fmt.Println("")
|
||||
fmt.Println("--------------------------------------------------")
|
||||
fmt.Println("")
|
||||
}
|
||||
}
|
||||
|
||||
func updateTgbotEnableSts(status bool) {
|
||||
@ -198,7 +273,7 @@ func updateTgbotEnableSts(status bool) {
|
||||
func updateTgbotSetting(tgBotToken string, tgBotChatid string, tgBotRuntime string) {
|
||||
err := database.InitDB(config.GetDBPath())
|
||||
if err != nil {
|
||||
fmt.Println("Error initializing database:", err)
|
||||
fmt.Println("Error initializing database(初始化数据库出错):", err)
|
||||
return
|
||||
}
|
||||
|
||||
@ -207,35 +282,35 @@ func updateTgbotSetting(tgBotToken string, tgBotChatid string, tgBotRuntime stri
|
||||
if tgBotToken != "" {
|
||||
err := settingService.SetTgBotToken(tgBotToken)
|
||||
if err != nil {
|
||||
fmt.Printf("Error setting Telegram bot token: %v\n", err)
|
||||
fmt.Printf("Error setting Telegram bot token(设置TG电报机器人令牌出错): %v\n", err)
|
||||
return
|
||||
}
|
||||
logger.Info("Successfully updated Telegram bot token.")
|
||||
logger.Info("Successfully updated Telegram bot token ----->>已成功更新TG电报机器人令牌")
|
||||
}
|
||||
|
||||
if tgBotRuntime != "" {
|
||||
err := settingService.SetTgbotRuntime(tgBotRuntime)
|
||||
if err != nil {
|
||||
fmt.Printf("Error setting Telegram bot runtime: %v\n", err)
|
||||
fmt.Printf("Error setting Telegram bot runtime(设置TG电报机器人通知周期出错): %v\n", err)
|
||||
return
|
||||
}
|
||||
logger.Infof("Successfully updated Telegram bot runtime to [%s].", tgBotRuntime)
|
||||
logger.Infof("Successfully updated Telegram bot runtime to (已成功将TG电报机器人通知周期设置为) [%s].", tgBotRuntime)
|
||||
}
|
||||
|
||||
if tgBotChatid != "" {
|
||||
err := settingService.SetTgBotChatId(tgBotChatid)
|
||||
if err != nil {
|
||||
fmt.Printf("Error setting Telegram bot chat ID: %v\n", err)
|
||||
fmt.Printf("Error setting Telegram bot chat ID(设置TG电报机器人管理者聊天ID出错): %v\n", err)
|
||||
return
|
||||
}
|
||||
logger.Info("Successfully updated Telegram bot chat ID.")
|
||||
logger.Info("Successfully updated Telegram bot chat ID ----->>已成功更新TG电报机器人管理者聊天ID")
|
||||
}
|
||||
}
|
||||
|
||||
func updateSetting(port int, username string, password string, webBasePath string, listenIP string, resetTwoFactor bool) {
|
||||
err := database.InitDB(config.GetDBPath())
|
||||
if err != nil {
|
||||
fmt.Println("Database initialization failed:", err)
|
||||
fmt.Println("Database initialization failed(初始化数据库失败):", err)
|
||||
return
|
||||
}
|
||||
|
||||
@ -245,27 +320,27 @@ func updateSetting(port int, username string, password string, webBasePath strin
|
||||
if port > 0 {
|
||||
err := settingService.SetPort(port)
|
||||
if err != nil {
|
||||
fmt.Println("Failed to set port:", err)
|
||||
fmt.Println("Failed to set port(设置端口失败):", err)
|
||||
} else {
|
||||
fmt.Printf("Port set successfully: %v\n", port)
|
||||
fmt.Printf("Port set successfully(端口设置成功): %v\n", port)
|
||||
}
|
||||
}
|
||||
|
||||
if username != "" || password != "" {
|
||||
err := userService.UpdateFirstUser(username, password)
|
||||
if err != nil {
|
||||
fmt.Println("Failed to update username and password:", err)
|
||||
fmt.Println("Failed to update username and password(更新用户名和密码失败):", err)
|
||||
} else {
|
||||
fmt.Println("Username and password updated successfully")
|
||||
fmt.Println("Username and password updated successfully ------>>用户名和密码更新成功")
|
||||
}
|
||||
}
|
||||
|
||||
if webBasePath != "" {
|
||||
err := settingService.SetBasePath(webBasePath)
|
||||
if err != nil {
|
||||
fmt.Println("Failed to set base URI path:", err)
|
||||
fmt.Println("Failed to set base URI path(设置访问路径失败):", err)
|
||||
} else {
|
||||
fmt.Println("Base URI path set successfully")
|
||||
fmt.Println("Base URI path set successfully ------>>设置访问路径成功")
|
||||
}
|
||||
}
|
||||
|
||||
@ -273,19 +348,19 @@ func updateSetting(port int, username string, password string, webBasePath strin
|
||||
err := settingService.SetTwoFactorEnable(false)
|
||||
|
||||
if err != nil {
|
||||
fmt.Println("Failed to reset two-factor authentication:", err)
|
||||
fmt.Println("Failed to reset two-factor authentication(设置两步验证失败):", err)
|
||||
} else {
|
||||
settingService.SetTwoFactorToken("")
|
||||
fmt.Println("Two-factor authentication reset successfully")
|
||||
fmt.Println("Two-factor authentication reset successfully --------->>设置两步验证成功")
|
||||
}
|
||||
}
|
||||
|
||||
if listenIP != "" {
|
||||
err := settingService.SetListen(listenIP)
|
||||
if err != nil {
|
||||
fmt.Println("Failed to set listen IP:", err)
|
||||
fmt.Println("Failed to set listen IP(设置监听IP失败):", err)
|
||||
} else {
|
||||
fmt.Printf("listen %v set successfully", listenIP)
|
||||
fmt.Printf("listen %v set successfully --------->>设置监听IP成功", listenIP)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -301,19 +376,19 @@ func updateCert(publicKey string, privateKey string) {
|
||||
settingService := service.SettingService{}
|
||||
err = settingService.SetCertFile(publicKey)
|
||||
if err != nil {
|
||||
fmt.Println("set certificate public key failed:", err)
|
||||
fmt.Println("set certificate public key failed(设置证书公钥失败):", err)
|
||||
} else {
|
||||
fmt.Println("set certificate public key success")
|
||||
fmt.Println("set certificate public key success --------->>设置证书公钥成功")
|
||||
}
|
||||
|
||||
err = settingService.SetKeyFile(privateKey)
|
||||
if err != nil {
|
||||
fmt.Println("set certificate private key failed:", err)
|
||||
fmt.Println("set certificate private key failed(设置证书私钥失败):", err)
|
||||
} else {
|
||||
fmt.Println("set certificate private key success")
|
||||
fmt.Println("set certificate private key success --------->>设置证书私钥成功")
|
||||
}
|
||||
} else {
|
||||
fmt.Println("both public and private key should be entered.")
|
||||
fmt.Println("both public and private key should be entered ------>>必须同时输入证书公钥和私钥")
|
||||
}
|
||||
}
|
||||
|
||||
@ -355,9 +430,9 @@ func migrateDb() {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println("Start migrating database...")
|
||||
fmt.Println("Start migrating database... ---->>开始迁移数据库...")
|
||||
inboundService.MigrateDB()
|
||||
fmt.Println("Migration done!")
|
||||
fmt.Println("Migration done! ------------>>迁移完成!")
|
||||
}
|
||||
|
||||
func main() {
|
||||
@ -469,7 +544,7 @@ func main() {
|
||||
updateCert(webCertFile, webKeyFile)
|
||||
}
|
||||
default:
|
||||
fmt.Println("Invalid subcommands")
|
||||
fmt.Println("Invalid subcommands ----->>无效命令")
|
||||
fmt.Println()
|
||||
runCmd.Usage()
|
||||
fmt.Println()
|
||||
|
||||
BIN
media/1.png
Normal file
|
After Width: | Height: | Size: 321 KiB |
BIN
media/10.png
Normal file
|
After Width: | Height: | Size: 681 KiB |
BIN
media/11.png
Normal file
|
After Width: | Height: | Size: 636 KiB |
BIN
media/12.png
Normal file
|
After Width: | Height: | Size: 990 KiB |
BIN
media/13.png
Normal file
|
After Width: | Height: | Size: 965 KiB |
BIN
media/14.png
Normal file
|
After Width: | Height: | Size: 94 KiB |
BIN
media/15.png
Normal file
|
After Width: | Height: | Size: 88 KiB |
BIN
media/16.png
Normal file
|
After Width: | Height: | Size: 122 KiB |
BIN
media/17.png
Normal file
|
After Width: | Height: | Size: 153 KiB |
BIN
media/18.png
Normal file
|
After Width: | Height: | Size: 101 KiB |
BIN
media/19.png
Normal file
|
After Width: | Height: | Size: 78 KiB |
BIN
media/2.png
Normal file
|
After Width: | Height: | Size: 385 KiB |
BIN
media/20.png
Normal file
|
After Width: | Height: | Size: 288 KiB |
BIN
media/21.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
media/22.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
media/23.png
Normal file
|
After Width: | Height: | Size: 85 KiB |
BIN
media/24.png
Normal file
|
After Width: | Height: | Size: 128 KiB |
BIN
media/25.png
Normal file
|
After Width: | Height: | Size: 404 KiB |
BIN
media/26.png
Normal file
|
After Width: | Height: | Size: 245 KiB |
BIN
media/27.png
Normal file
|
After Width: | Height: | Size: 385 KiB |
BIN
media/28.png
Normal file
|
After Width: | Height: | Size: 256 KiB |
BIN
media/29.png
Normal file
|
After Width: | Height: | Size: 221 KiB |
BIN
media/3.png
Normal file
|
After Width: | Height: | Size: 63 KiB |
BIN
media/3X-UI.png
Normal file
|
After Width: | Height: | Size: 223 KiB |
BIN
media/4.png
Normal file
|
After Width: | Height: | Size: 92 KiB |
BIN
media/5.png
Normal file
|
After Width: | Height: | Size: 346 KiB |
BIN
media/6.png
Normal file
|
After Width: | Height: | Size: 244 KiB |
BIN
media/7.png
Normal file
|
After Width: | Height: | Size: 249 KiB |
BIN
media/8.png
Normal file
|
After Width: | Height: | Size: 591 KiB |
BIN
media/9.png
Normal file
|
After Width: | Height: | Size: 555 KiB |
@ -725,8 +725,8 @@ class RealityStreamSettings extends XrayCommonClass {
|
||||
constructor(
|
||||
show = false,
|
||||
xver = 0,
|
||||
dest = 'google.com:443',
|
||||
serverNames = 'google.com,www.google.com',
|
||||
dest = 'tesla.com:443',
|
||||
serverNames = 'tesla.com,www.tesla.com',
|
||||
privateKey = '',
|
||||
minClientVer = '',
|
||||
maxClientVer = '',
|
||||
|
||||
@ -26,6 +26,7 @@ func (a *XUIController) initRouter(g *gin.RouterGroup) {
|
||||
g.GET("/inbounds", a.inbounds)
|
||||
g.GET("/settings", a.settings)
|
||||
g.GET("/xray", a.xraySettings)
|
||||
g.GET("/navigation", a.navigation)
|
||||
|
||||
a.inboundController = NewInboundController(g)
|
||||
a.settingController = NewSettingController(g)
|
||||
@ -47,3 +48,7 @@ func (a *XUIController) settings(c *gin.Context) {
|
||||
func (a *XUIController) xraySettings(c *gin.Context) {
|
||||
html(c, "xray.html", "pages.xray.title", nil)
|
||||
}
|
||||
|
||||
func (a *XUIController) navigation(c *gin.Context) {
|
||||
html(c, "navigation.html", "pages.navigation.title", nil)
|
||||
}
|
||||
|
||||
@ -64,6 +64,11 @@
|
||||
icon: 'tool',
|
||||
title: '{{ i18n "menu.xray"}}'
|
||||
},
|
||||
{
|
||||
key: '{{ .base_path }}panel/navigation',
|
||||
icon: 'link',
|
||||
title: '{{ i18n "menu.navigation"}}'
|
||||
},
|
||||
{
|
||||
key: '{{ .base_path }}logout/',
|
||||
icon: 'logout',
|
||||
@ -100,4 +105,4 @@
|
||||
template: `{{template "component/sidebar/content"}}`,
|
||||
});
|
||||
</script>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
<a-input v-model="inbound.stream.reality.privateKey"></a-input>
|
||||
</a-form-item>
|
||||
<a-form-item label=" ">
|
||||
<a-button type="primary" icon="import" @click="getNewX25519Cert">Get New Cert</a-button>
|
||||
<a-button type="primary" icon="import" @click="getNewX25519Cert">Get New Cert(随机获取新证书)</a-button>
|
||||
</a-form-item>
|
||||
<a-form-item label="mldsa65 Seed">
|
||||
<a-input v-model="inbound.stream.reality.mldsa65Seed"></a-input>
|
||||
@ -60,4 +60,4 @@
|
||||
<a-button type="primary" icon="import" @click="getNewmldsa65">Get New Seed</a-button>
|
||||
</a-form-item>
|
||||
</template>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
@ -215,20 +215,20 @@
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :sm="24" :lg="12">
|
||||
<a-card title='3X-UI' hoverable>
|
||||
<a rel="noopener" href="https://github.com/MHSanaei/3x-ui/releases" target="_blank">
|
||||
<a-card title='3X-UI中文优化版' hoverable>
|
||||
<a rel="noopener" href="https://github.com/xeefei/3x-ui/releases" target="_blank">
|
||||
<a-tag color="green">
|
||||
<span>v{{ .cur_ver }}</span>
|
||||
</a-tag>
|
||||
</a>
|
||||
<a rel="noopener" href="https://t.me/XrayUI" target="_blank">
|
||||
<a rel="noopener" href="https://t.me/is_Chat_Bot" target="_blank">
|
||||
<a-tag color="green">
|
||||
<span>@XrayUI</span>
|
||||
<span>TG私聊交流</span>
|
||||
</a-tag>
|
||||
</a>
|
||||
<a rel="noopener" href="https://github.com/MHSanaei/3x-ui/wiki" target="_blank">
|
||||
<a rel="noopener" href="https://t.me/XUI_CN" target="_blank">
|
||||
<a-tag color="purple">
|
||||
<span>{{ i18n "pages.index.documentation" }}</span>
|
||||
<span>〔3X-UI〕中文交流群</span>
|
||||
</a-tag>
|
||||
</a>
|
||||
</a-card>
|
||||
@ -249,6 +249,8 @@
|
||||
</template>
|
||||
</a-tooltip>
|
||||
</a-tag>
|
||||
<a rel="noopener" href="https://ping.pe" target="_blank"><a-tag color="green">端口检测</a-tag></a>
|
||||
<a rel="noopener" href="https://www.speedtest.net" target="_blank"><a-tag color="green">网络测速</a-tag></a>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :sm="24" :lg="12">
|
||||
@ -784,4 +786,4 @@
|
||||
},
|
||||
});
|
||||
</script>
|
||||
{{ template "page/body_end" .}}
|
||||
{{ template "page/body_end" .}}
|
||||
|
||||
165
web/html/navigation.html
Normal file
@ -0,0 +1,165 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>实用导航&技巧</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #151F31;
|
||||
color: white;
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
}
|
||||
.sidebar {
|
||||
width: 150px;
|
||||
background-color: #151F31;
|
||||
padding: 20px;
|
||||
}
|
||||
.sidebar h2 {
|
||||
color: #fff;
|
||||
margin-top: 0;
|
||||
}
|
||||
.sidebar button {
|
||||
background-color: #2C3E56;
|
||||
color: #008000; /* 绿色字体 */
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
margin-bottom: 10px;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
width: 100%;
|
||||
border-radius: 15px; /* 增加圆角幅度 */
|
||||
font-weight: bold; /* 加粗字体 */
|
||||
}
|
||||
.sidebar button:hover {
|
||||
background-color: #4A90E2;
|
||||
}
|
||||
.sidebar .friend-links {
|
||||
margin-top: auto;
|
||||
text-align: center;
|
||||
margin-bottom: 12px; /* 调整友情链接下边距 */
|
||||
}
|
||||
.sidebar .friend-links a {
|
||||
color: #0080FF; /* 蓝色字体 */
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.separator {
|
||||
width: 15px;
|
||||
background-color: #34495e;
|
||||
}
|
||||
.content {
|
||||
flex: 1;
|
||||
padding: 20px;
|
||||
padding-top: 0; /* 移除顶部空白 */
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="sidebar">
|
||||
<button onclick="history.back()">返回上一步</button>
|
||||
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
|
||||
<div class="friend-links">
|
||||
<a href="https://chat.openai.com/">ChatGPT</a>
|
||||
<a href="https://github.com/xeefei/3x-ui">项目地址</a>
|
||||
<a href="https://t.me/XUI_CN">3X-UI交流群</a>
|
||||
<a href="https://www.youtube.com/results?search_query=4k%E6%B5%8B%E9%80%9F">油管4K测速</a>
|
||||
<a href="https://whatismyipaddress.com/">我的IP查询</a>
|
||||
<a href="https://translate.google.com/?hl=zh-CN">Google翻译</a>
|
||||
<a href="https://xtls.github.io/">Project X</a>
|
||||
<a href="https://t.me/is_Haotian_Bot">预留&占位</a>
|
||||
<a href="https://t.me/is_Chat_Bot">联系作者</a>
|
||||
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
|
||||
<button onclick="window.scrollTo(0, 0)">回滚至顶部</button>
|
||||
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
|
||||
<button onclick="history.back()">返回到面板</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="separator"></div>
|
||||
<div class="content">
|
||||
<h3>一、【3x-ui】中文交流群:<a href="https://t.me/XUI_CN">https://t.me/XUI_CN</a></h3>
|
||||
<h3> 【3x-ui】详细安装流程步骤:<a href="https://xeefei.blogspot.com/2025/07/3x-ui.html">https://xeefei.blogspot.com/2025/07/3x-ui.html</a></h3>
|
||||
|
||||
<h3>二、判断VPS服务器的IP是否【送中】?</h3>
|
||||
<p>***点击打开:<a href="https://music.youtube.com/">https://music.youtube.com/</a>,能正常打开访问,就代表【没送中】,反之就是送中了。</p>
|
||||
<p>***如果送中了如何解决去【拉回来】?</p>
|
||||
<p>1:关闭/取消登录了谷歌账户的APP定位权限/授权;2:将常用的一个谷歌账号的位置记录功能打开;3:在电脑上打开Chrome/谷歌浏览器,登录开了位置记录功能的谷歌账号,安装Location Guard拓展插件<a href="https://chrome.google.com/webstore/detail/location-guard/cfohepagpmnodfdmjliccbbigdkfcgia">https://chrome.google.com/webstore/detail/location-guard/cfohepagpmnodfdmjliccbbigdkfcgia</a>(也可在其他支持此插件的浏览器使用);4:打开Location Guard插件,选择Fixed Location,并在给出的地图上单击,即可标记上你想要IP所处的国家/地区
|
||||
Google IP定位错误,使用Location Guard修改;5:转换到Options选项,Default level默认设置为Use fixed location;6:打开谷歌地图google.com/maps,点击右下角定位授权图标,使google maps获取当前“我的GPS位置”
|
||||
Google IP定位错误,使用Location Guard修改GPS位置地址;7:谷歌搜索my ip,即可看到谷歌IP定位到了刚才地图上标记的位置;8:在此网页向谷歌报告IP问题:<a href="https://support.google.com/websearch/workflow/9308722">https://support.google.com/websearch/workflow/9308722</a></p>
|
||||
|
||||
<h3>三、在自己的VPS服务器部署【订阅转换】功能</h3>
|
||||
<p>如何把vless/vmess等协议转换成Clash/Surge等软件支持的格式?
|
||||
1、进入脚本输入x-ui命令调取面板,选择第【24】选项安装订阅转换模块,
|
||||
2、等待安装【订阅转换】成功之后,访问地址:你的IP:18080(端口号)进行转换,
|
||||
3、因为在转换过程中需要调取后端API,所以请确保端口25500是打开放行的,
|
||||
4、在得到【转换链接】之后,只要你的VPS服务器25500端口是能ping通的,就能导入Clash/Surge等软件成功下载配置,
|
||||
5、此功能集成到3x-ui面板中,是为了保证安全,通过调取24选项把【订阅转换】功能部署在自己的VPS中,不会造成链接泄露。</p>
|
||||
|
||||
<h3>四、如何保护自己的IP不被墙被封?</h3>
|
||||
<p>1、使用的代理协议要安全,加密是必备,推荐使用vless+reality+vision协议组合,
|
||||
2、因为有时节点会共享,在不同的地区,多个省份之间不要共同连接同一个IP,
|
||||
3、连接同一个IP就算了,不要同一个端口,不要同IP+同端口到处漫游,要分开,
|
||||
4、同一台VPS,不要在一天内一直大流量去下载东西使用,不要流量过高要切换,
|
||||
5、创建【入站协议】的时候,尽量用【高位端口】,比如40000--65000之间的端口号。
|
||||
提醒:为什么在特殊时期,比如:两会,春节等被封得最严重最惨?
|
||||
尼玛同一个IP+同一个端口号,多个省份去漫游,跟开飞机场一样!不封你,封谁的IP和端口?
|
||||
总结:不要多终端/多省份/多个朋友/共同使用同一个IP和端口号!使用3x-ui多创建几个【入站】,
|
||||
多做几条备用,各用各的!各行其道才比较安全!GFW的思维模式是干掉机场,机场的特征个人用户不要去沾染,自然IP就保护好了。</p>
|
||||
|
||||
<h3>五、检测IP纯净度的方法:</h3>
|
||||
<p>网址:<a href="https://scamalytics.com/">https://scamalytics.com/</a>,输入IP进行检测,看【欺诈分数】,分数越高IP越脏。</p>
|
||||
|
||||
<h3>六、常见的翻墙软件/工具:</h3>
|
||||
<ol>
|
||||
<p>1、Windows系统v2rayN:<a href="https://github.com/2dust/v2rayN">https://github.com/2dust/v2rayN</a></p>
|
||||
<p>2、安卓手机版【v2rayNG】:<a href="https://github.com/2dust/v2rayNG">https://github.com/2dust/v2rayNG</a></p>
|
||||
<p>3、苹果手机IOS【小火箭】:<a href="https://apple02.com/">https://apple02.com/</a></p>
|
||||
<p>4、苹果MacOS电脑【Clash Verge】:<a href="https://github.com/clash-verge-rev/clash-verge-rev/releases">https://github.com/clash-verge-rev/clash-verge-rev/releases</a>或v2rayN:<a href="https://github.com/2dust/v2rayN">https://github.com/2dust/v2rayN</a></p>
|
||||
</ol>
|
||||
|
||||
<h3>七、查看节点【指定端口】的网络连接数/命令:</h3>
|
||||
<p>netstat -ntu | grep :节点端口 | grep ESTABLISHED | awk '{print $5}'</p>
|
||||
|
||||
<h3>八、用3x-ui如何实现【自己偷自己】?</h3>
|
||||
<p>其实很简单,只要你为面板设置了证书,
|
||||
开启了HTTPS登录,就可以将3x-ui自身作为web server,
|
||||
无需Nginx等,这里给一个示例:
|
||||
其中目标网站(Dest)请填写面板监听端口,
|
||||
可选域名(SNI)填写面板登录域名,
|
||||
如果您使用其他web server(如nginx)等,
|
||||
将目标网站改为对应监听端口也可。
|
||||
需要说明的是,如果您处于白名单地区,自己“偷”自己并不适合你;其次,可选域名一项实际上可以填写任意SNI,只要客户端保持一致即可,不过并不推荐这样做。</p>
|
||||
|
||||
<h3>九、【接码】网站:</h3>
|
||||
<p>网址:<a href="https://sms-activate.org/cn">https://sms-activate.org/cn</a>,直接注册账号购买。</p>
|
||||
|
||||
<h3>十、一些MJJ经常逛的网站和群组:</h3>
|
||||
<ol>
|
||||
<p>1、NodeSeek论坛:<a href="https://www.nodeseek.com/">https://www.nodeseek.com/</a></p>
|
||||
<p>2、V2EX论坛:<a href="https://www.v2ex.com/">https://www.v2ex.com/</a></p>
|
||||
<p>3、搬瓦工TG群:<a href="https://t.me/BWHOfficial">https://t.me/BWHOfficial</a></p>
|
||||
<p>4、Xray的官方群:<a href="https://t.me/projectXray">https://t.me/projectXray</a></p>
|
||||
<p>5、Dmit交流群:<a href="https://t.me/DmitChat">https://t.me/DmitChat</a></p>
|
||||
<p>6、白丝云用户群:<a href="https://t.me/+VHZLKELTQyzPNgOV">https://t.me/+VHZLKELTQyzPNgOV</a></p>
|
||||
<p>7、NameSilo域名注册:<a href="https://www.namesilo.com/">https://www.namesilo.com/</a></p>
|
||||
</ol>
|
||||
|
||||
<h3>十一、若此项目对你有帮助,你正想购买VPS的话,可以走一下我的AFF:</h3>
|
||||
<ol>
|
||||
<p>1、搬瓦工GIA线路:<a href="https://bandwagonhost.com/aff.php?aff=75015">https://bandwagonhost.com/aff.php?aff=75015</a></p>
|
||||
<p>2、Dmit高端GIA:<a href="https://www.dmit.io/aff.php?aff=9326">https://www.dmit.io/aff.php?aff=9326</a></p>
|
||||
<p>3、白丝云【4837】:<a href="https://cloudsilk.io/aff.php?aff=706">https://cloudsilk.io/aff.php?aff=706</a></p>
|
||||
</ol>
|
||||
|
||||
<h3>十二、项目〔声明和注意〕</h3>
|
||||
<ol>
|
||||
<p>1、声明: 此项目仅供个人学习、交流使用,请遵守当地法律法规,勿用于非法用途;请勿用于生产环境;</a></p>
|
||||
<p>2、注意: 在使用此项目和〔教程〕过程中,若因违反以上声明使用规则而产生的一切后果由使用者自负。</a></p>
|
||||
</ol>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,4 +1,10 @@
|
||||
{{define "settings/panel/general"}}
|
||||
<style>
|
||||
.red-placeholder input::-webkit-input-placeholder { color: red !important; }
|
||||
.red-placeholder input::-moz-placeholder { color: red !important; }
|
||||
.red-placeholder input:-ms-input-placeholder { color: red !important; }
|
||||
.red-placeholder input::placeholder { color: red !important; }
|
||||
</style>
|
||||
<a-collapse default-active-key="1">
|
||||
<a-collapse-panel key="1" header='{{ i18n "pages.xray.generalConfigs"}}'>
|
||||
<a-setting-list-item paddings="small">
|
||||
@ -97,14 +103,14 @@
|
||||
<template #title>{{ i18n "pages.settings.publicKeyPath"}}</template>
|
||||
<template #description>{{ i18n "pages.settings.publicKeyPathDesc"}}</template>
|
||||
<template #control>
|
||||
<a-input type="text" v-model="allSetting.webCertFile"></a-input>
|
||||
<a-input type="text" v-model="allSetting.webCertFile" placeholder="/root/cert/域名/fullchain.pem" class="red-placeholder"></a-input>
|
||||
</template>
|
||||
</a-setting-list-item>
|
||||
<a-setting-list-item paddings="small">
|
||||
<template #title>{{ i18n "pages.settings.privateKeyPath"}}</template>
|
||||
<template #description>{{ i18n "pages.settings.privateKeyPathDesc"}}</template>
|
||||
<template #control>
|
||||
<a-input type="text" v-model="allSetting.webKeyFile"></a-input>
|
||||
<a-input type="text" v-model="allSetting.webKeyFile" placeholder="/root/cert/域名/privkey.pem" class="red-placeholder"></a-input>
|
||||
</template>
|
||||
</a-setting-list-item>
|
||||
</a-collapse-panel>
|
||||
@ -146,4 +152,4 @@
|
||||
</a-setting-list-item>
|
||||
</a-collapse-panel>
|
||||
</a-collapse>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
@ -81,6 +81,7 @@
|
||||
"xray" = "Xray Configs"
|
||||
"logout" = "Log Out"
|
||||
"link" = "Manage"
|
||||
"navigation" = "navigation"
|
||||
|
||||
[pages.login]
|
||||
"hello" = "Hello"
|
||||
@ -446,6 +447,9 @@
|
||||
"statsOutboundDownlink" = "Outbound Download Statistics"
|
||||
"statsOutboundDownlinkDesc" = "Enables the statistics collection for downstream traffic of all outbound proxies."
|
||||
|
||||
[pages.navigation]
|
||||
"title" = "navigation"
|
||||
|
||||
[pages.xray.rules]
|
||||
"first" = "First"
|
||||
"last" = "Last"
|
||||
|
||||
@ -54,6 +54,7 @@
|
||||
"install" = "安装"
|
||||
"clients" = "客户端"
|
||||
"usage" = "使用情况"
|
||||
"secretToken" = "安全密钥"
|
||||
"twoFactorCode" = "代码"
|
||||
"remained" = "剩余"
|
||||
"security" = "安全"
|
||||
@ -78,9 +79,10 @@
|
||||
"dashboard" = "系统状态"
|
||||
"inbounds" = "入站列表"
|
||||
"settings" = "面板设置"
|
||||
"xray" = "Xray 设置"
|
||||
"xray" = "Xray设置"
|
||||
"logout" = "退出登录"
|
||||
"link" = "管理"
|
||||
"navigation" = "实用导航"
|
||||
|
||||
[pages.login]
|
||||
"hello" = "你好"
|
||||
@ -102,6 +104,7 @@
|
||||
"swap" = "交换分区"
|
||||
"storage" = "存储"
|
||||
"memory" = "内存"
|
||||
"hard" = "磁盘"
|
||||
"threads" = "线程"
|
||||
"xrayStatus" = "Xray"
|
||||
"stopXray" = "停止"
|
||||
@ -138,7 +141,7 @@
|
||||
"dontRefresh" = "安装中,请勿刷新此页面"
|
||||
"logs" = "日志"
|
||||
"config" = "配置"
|
||||
"backup" = "备份"
|
||||
"backup" = "备份和恢复"
|
||||
"backupTitle" = "备份和恢复数据库"
|
||||
"exportDatabase" = "备份"
|
||||
"exportDatabaseDesc" = "点击下载包含当前数据库备份的 .db 文件到您的设备。"
|
||||
@ -169,6 +172,8 @@
|
||||
"generalActions" = "通用操作"
|
||||
"autoRefresh" = "自动刷新"
|
||||
"autoRefreshInterval" = "间隔"
|
||||
"create" = "添加"
|
||||
"update" = "修改"
|
||||
"modifyInbound" = "修改入站"
|
||||
"deleteInbound" = "删除入站"
|
||||
"deleteInboundContent" = "确定要删除入站吗?"
|
||||
@ -211,14 +216,14 @@
|
||||
"delDepletedClientsTitle" = "删除流量耗尽的客户端"
|
||||
"delDepletedClientsContent" = "确定要删除所有流量耗尽的客户端吗?"
|
||||
"email" = "电子邮件"
|
||||
"emailDesc" = "电子邮件必须完全唯一"
|
||||
"emailDesc" = "电子邮件必须确保唯一"
|
||||
"IPLimit" = "IP 限制"
|
||||
"IPLimitDesc" = "如果数量超过设置值,则禁用入站流量。(0 = 禁用)"
|
||||
"IPLimitlog" = "IP 日志"
|
||||
"IPLimitlogDesc" = "IP 历史日志(要启用被禁用的入站流量,请清除日志)"
|
||||
"IPLimitlogclear" = "清除日志"
|
||||
"setDefaultCert" = "从面板设置证书"
|
||||
"telegramDesc" = "请提供Telegram聊天ID。(在机器人中使用'/id'命令)或(@userinfobot"
|
||||
"telegramDesc" = "请提供Telegram聊天ID。(在机器人中使用'/id'命令或跟@userinfobot机器人对话获取)"
|
||||
"subscriptionDesc" = "要找到你的订阅 URL,请导航到“详细信息”。此外,你可以为多个客户端使用相同的名称。"
|
||||
"info" = "信息"
|
||||
"same" = "相同"
|
||||
@ -290,7 +295,7 @@
|
||||
"resetDefaultConfig" = "重置为默认配置"
|
||||
"panelSettings" = "常规"
|
||||
"securitySettings" = "安全设定"
|
||||
"TGBotSettings" = "Telegram 机器人配置"
|
||||
"TGBotSettings" = "Telegram机器人配置"
|
||||
"panelListeningIP" = "面板监听 IP"
|
||||
"panelListeningIPDesc" = "默认留空监听所有 IP"
|
||||
"panelListeningDomain" = "面板监听域名"
|
||||
@ -298,10 +303,12 @@
|
||||
"panelPort" = "面板监听端口"
|
||||
"panelPortDesc" = "重启面板生效"
|
||||
"publicKeyPath" = "面板证书公钥文件路径"
|
||||
"publicKeyPathDesc" = "填写一个 '/' 开头的绝对路径"
|
||||
"DefaultpublicKeyPath" = "/root/.acme.sh/域名_ecc/域名.cer"
|
||||
"publicKeyPathDesc" = "填写一个 '/' 开头的绝对路径,〔acme方式〕请自行在填入时修改域名"
|
||||
"privateKeyPath" = "面板证书密钥文件路径"
|
||||
"privateKeyPathDesc" = "填写一个 '/' 开头的绝对路径"
|
||||
"panelUrlPath" = "面板 url 根路径"
|
||||
"DefaultprivateKeyPath" = "/root/.acme.sh/域名_ecc/域名.key"
|
||||
"privateKeyPathDesc" = "填写一个 '/' 开头的绝对路径,〔acme方式〕请自行在填入时修改域名"
|
||||
"panelUrlPath" = "面板登录访问路径"
|
||||
"panelUrlPathDesc" = "必须以 '/' 开头,以 '/' 结尾"
|
||||
"pageSize" = "分页大小"
|
||||
"pageSizeDesc" = "定义入站表的页面大小。设置 0 表示禁用"
|
||||
@ -317,7 +324,7 @@
|
||||
"telegramBotEnable" = "启用 Telegram 机器人"
|
||||
"telegramBotEnableDesc" = "启用 Telegram 机器人功能"
|
||||
"telegramToken" = "Telegram 机器人令牌(token)"
|
||||
"telegramTokenDesc" = "从 '@BotFather' 获取的 Telegram 机器人令牌"
|
||||
"telegramTokenDesc" = "跟 '@BotFather' 对话获取的 Telegram 机器人令牌"
|
||||
"telegramProxy" = "SOCKS5 Proxy"
|
||||
"telegramProxyDesc" = "启用 SOCKS5 代理连接到 Telegram(根据指南调整设置)"
|
||||
"telegramAPIServer" = "Telegram API Server"
|
||||
@ -450,13 +457,16 @@
|
||||
"statsOutboundDownlink" = "出站下载统计"
|
||||
"statsOutboundDownlinkDesc" = "启用所有出站代理的下行流量统计收集。"
|
||||
|
||||
[pages.navigation]
|
||||
"title" = "实用导航"
|
||||
|
||||
[pages.xray.rules]
|
||||
"first" = "置顶"
|
||||
"last" = "置底"
|
||||
"up" = "向上"
|
||||
"down" = "向下"
|
||||
"source" = "来源"
|
||||
"dest" = "目的地址"
|
||||
"dest" = "目标地址"
|
||||
"inbound" = "入站"
|
||||
"outbound" = "出站"
|
||||
"balancer" = "负载均衡"
|
||||
@ -464,6 +474,18 @@
|
||||
"add" = "添加规则"
|
||||
"edit" = "编辑规则"
|
||||
"useComma" = "逗号分隔的项目"
|
||||
"DomainMatcher" = "域匹配类型"
|
||||
"SourceIPs" = "源IP"
|
||||
"SourcePort" = "源端口"
|
||||
"Network" = "网络类型"
|
||||
"Protocol" = "传输协议"
|
||||
"Attributes" = "属性"
|
||||
"Domain" = "域地址"
|
||||
"User" = "用户"
|
||||
"Port" = "端口"
|
||||
"InboundTag" = "入站 Tag"
|
||||
"OutboundTag" = "出站 Tag"
|
||||
"BalancerTag" = "负载均衡 Tag"
|
||||
|
||||
[pages.xray.outbound]
|
||||
"addOutbound" = "添加出站"
|
||||
@ -583,7 +605,7 @@
|
||||
|
||||
[tgbot.commands]
|
||||
"unknown" = "❗ 未知命令"
|
||||
"pleaseChoose" = "👇 请选择:\r\n"
|
||||
"pleaseChoose" = "👇请〔按照需求〕选择下方按钮 :\r\n"
|
||||
"help" = "🤖 欢迎使用本机器人!它旨在为您提供来自服务器的特定数据,并允许您进行必要的修改。\r\n\r\n"
|
||||
"start" = "👋 你好,<i>{{ .Firstname }}</i>。\r\n"
|
||||
"welcome" = "🤖 欢迎来到 <b>{{ .Hostname }}</b> 管理机器人。\r\n"
|
||||
@ -610,7 +632,7 @@
|
||||
"report" = "🕰 定时报告:{{ .RunTime }}\r\n"
|
||||
"datetime" = "⏰ 日期时间:{{ .DateTime }}\r\n"
|
||||
"hostname" = "💻 主机名:{{ .Hostname }}\r\n"
|
||||
"version" = "🚀 X-UI 版本:{{ .Version }}\r\n"
|
||||
"version" = "🚀 3X-UI 版本:{{ .Version }}\r\n"
|
||||
"xrayVersion" = "📡 Xray 版本: {{ .XrayVersion }}\r\n"
|
||||
"ipv6" = "🌐 IPv6:{{ .IPv6 }}\r\n"
|
||||
"ipv4" = "🌐 IPv4:{{ .IPv4 }}\r\n"
|
||||
@ -633,7 +655,7 @@
|
||||
"active" = "💡 激活:{{ .Enable }}\r\n"
|
||||
"enabled" = "🚨 已启用:{{ .Enable }}\r\n"
|
||||
"online" = "🌐 连接状态:{{ .Status }}\r\n"
|
||||
"email" = "📧 邮箱:{{ .Email }}\r\n"
|
||||
"email" = "📧 邮箱(用户):{{ .Email }}\r\n"
|
||||
"upload" = "🔼 上传↑:{{ .Upload }}\r\n"
|
||||
"download" = "🔽 下载↓:{{ .Download }}\r\n"
|
||||
"total" = "📊 总计:{{ .UpDown }} / {{ .Total }}\r\n"
|
||||
@ -678,12 +700,12 @@
|
||||
"confirmRemoveTGUser" = "✅ 确认移除 Telegram 用户?"
|
||||
"confirmToggle" = "✅ 确认启用/禁用用户?"
|
||||
"dbBackup" = "获取数据库备份"
|
||||
"serverUsage" = "服务器使用情况"
|
||||
"serverUsage" = "服务器状态"
|
||||
"getInbounds" = "获取入站信息"
|
||||
"depleteSoon" = "即将耗尽"
|
||||
"clientUsage" = "获取使用情况"
|
||||
"onlines" = "在线客户端"
|
||||
"commands" = "命令"
|
||||
"commands" = "常用命令"
|
||||
"refresh" = "🔄 刷新"
|
||||
"clearIPs" = "❌ 清除 IP"
|
||||
"removeTGUser" = "❌ 移除 Telegram 用户"
|
||||
@ -695,7 +717,7 @@
|
||||
"ipLimit" = "🔢 IP 限制"
|
||||
"setTGUser" = "👤 设置 Telegram 用户"
|
||||
"toggle" = "🔘 启用/禁用"
|
||||
"custom" = "🔢 风俗"
|
||||
"custom" = "🔢 自定义输入"
|
||||
"confirmNumber" = "✅ 确认: {{ .Num }}"
|
||||
"confirmNumberAdd" = "✅ 确认添加:{{ .Num }}"
|
||||
"limitTraffic" = "🚧 流量限制"
|
||||
|
||||