Merge pull request #1 from serogaq/feature/1.improvements

1 / Improvements
This commit is contained in:
serogaq 2024-11-06 15:31:45 +03:00 committed by GitHub
commit 2a1d8c9be6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 132 additions and 90 deletions

2
.github/FUNDING.yml vendored
View file

@ -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: # Replace with a single Buy Me a Coffee username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View file

@ -3,5 +3,9 @@
# Start fail2ban
fail2ban-client -x start
# Docker Logs
ln -sf /dev/stdout /app/access.log
ln -sf /dev/stdout /app/error.log
# Run x-ui
exec /app/x-ui

View file

@ -37,4 +37,34 @@ wget -O geoip_IR.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/la
wget -O geosite_IR.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat
wget -O geoip_VN.dat https://github.com/vuong2023/vn-v2ray-rules/releases/latest/download/geoip.dat
wget -O geosite_VN.dat https://github.com/vuong2023/vn-v2ray-rules/releases/latest/download/geosite.dat
cd ../../
cd ../../
# Antizapret
case $2 in
0)
ANTIZAPRET="0"
;;
1)
ANTIZAPRET="1"
;;
*)
ANTIZAPRET="0"
;;
esac
if [[ $ANTIZAPRET == "1" ]]; then
wget https://github.com/warexify/antizapret-xray/archive/refs/heads/main.zip
unzip main.zip
mv antizapret-xray-main antizapret-xray
mkdir -p antizapret-xray/z-i
cd antizapret-xray/z-i
wget -O dump.csv https://github.com/zapret-info/z-i/raw/master/dump.csv
cd ../
go build
chmod +x antizapret-xray
./antizapret-xray
mv publish/geosite.dat ../build/bin/geosite_antizapret.dat
cd ../
echo "Antizapret: ext:geosite_antizapret.dat:zapretinfo"
else
echo "Antizapret: disabled"
fi

View file

@ -4,6 +4,7 @@
FROM golang:1.23-alpine AS builder
WORKDIR /app
ARG TARGETARCH
ARG ANTIZAPRET
RUN apk --no-cache --update add \
build-base \
@ -16,20 +17,22 @@ COPY . .
ENV CGO_ENABLED=1
ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"
RUN go build -o build/x-ui main.go
RUN ./DockerInit.sh "$TARGETARCH"
RUN ./DockerInit.sh "$TARGETARCH" "$ANTIZAPRET"
# ========================================================
# Stage: Final Image of 3x-ui
# ========================================================
FROM alpine
ENV TZ=Asia/Tehran
ENV TZ=Europe/Moscow
WORKDIR /app
RUN apk add --no-cache --update \
ca-certificates \
tzdata \
fail2ban \
bash
bash \
nano \
unzip
COPY --from=builder /app/build/ /app/
COPY --from=builder /app/DockerEntrypoint.sh /app/

View file

@ -4,30 +4,18 @@
**An Advanced Web Panel • Built on Xray Core**
[![](https://img.shields.io/github/v/release/mhsanaei/3x-ui.svg)](https://github.com/MHSanaei/3x-ui/releases)
[![](https://img.shields.io/github/actions/workflow/status/mhsanaei/3x-ui/release.yml.svg)](#)
[![GO Version](https://img.shields.io/github/go-mod/go-version/mhsanaei/3x-ui.svg)](#)
[![Downloads](https://img.shields.io/github/downloads/mhsanaei/3x-ui/total.svg)](#)
[![](https://img.shields.io/github/v/release/serogaq/3x-ui.svg)](https://github.com/MHSanaei/3x-ui/releases)
[![](https://img.shields.io/github/actions/workflow/status/serogaq/3x-ui/release.yml.svg)](#)
[![GO Version](https://img.shields.io/github/go-mod/go-version/serogaq/3x-ui.svg)](#)
[![Downloads](https://img.shields.io/github/downloads/serogaq/3x-ui/total.svg)](#)
[![License](https://img.shields.io/badge/license-GPL%20V3-blue.svg?longCache=true)](https://www.gnu.org/licenses/gpl-3.0.en.html)
> **Disclaimer:** This project is only for personal learning and communication, please do not use it for illegal purposes, please do not use it in a production environment
**If this project is helpful to you, you may wish to give it a**:star2:
<p align="left">
<a href="https://buymeacoffee.com/mhsanaei" target="_blank">
<img src="./media/buymeacoffe.png" alt="Image">
</a>
</p>
- USDT (TRC20): `TXncxkvhkDWGts487Pjqq1qT9JmwRUz8CC`
- MATIC (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A`
- LTC (Litecoin): `ltc1q2ach7x6d2zq0n4l0t4zl7d7xe2s6fs7a3vspwv`
## Install & Upgrade
```
bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)
bash <(curl -Ls https://raw.githubusercontent.com/serogaq/3x-ui/master/install.sh)
```
## Install legacy Version (we don't recommend)
@ -35,7 +23,7 @@ bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.
To install your desired version, use following installation command. e.g., ver `v1.7.9`:
```
VERSION=v1.7.9 && bash <(curl -Ls "https://raw.githubusercontent.com/mhsanaei/3x-ui/$VERSION/install.sh") $VERSION
VERSION=v1.7.9 && bash <(curl -Ls "https://raw.githubusercontent.com/serogaq/3x-ui/$VERSION/install.sh") $VERSION
```
## SSL Certificate
@ -183,7 +171,7 @@ systemctl restart x-ui
--network=host \
--restart=unless-stopped \
--name 3x-ui \
ghcr.io/mhsanaei/3x-ui:latest
ghcr.io/serogaq/3x-ui:latest
```
4. **Update to the Latest Version:**
@ -562,7 +550,3 @@ XUI_BIN_FOLDER="bin" XUI_DB_FOLDER="/etc/x-ui" go build main.go
- [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._
## Stargazers over Time
[![Stargazers over time](https://starchart.cc/MHSanaei/3x-ui.svg)](https://starchart.cc/MHSanaei/3x-ui)

View file

@ -4,30 +4,18 @@
**Продвинутая веб-панель • Построена на основе Xray Core**
[![](https://img.shields.io/github/v/release/mhsanaei/3x-ui.svg)](https://github.com/MHSanaei/3x-ui/releases)
[![](https://img.shields.io/github/actions/workflow/status/mhsanaei/3x-ui/release.yml.svg)](#)
[![GO Version](https://img.shields.io/github/go-mod/go-version/mhsanaei/3x-ui.svg)](#)
[![Downloads](https://img.shields.io/github/downloads/mhsanaei/3x-ui/total.svg)](#)
[![](https://img.shields.io/github/v/release/serogaq/3x-ui.svg)](https://github.com/MHSanaei/3x-ui/releases)
[![](https://img.shields.io/github/actions/workflow/status/serogaq/3x-ui/release.yml.svg)](#)
[![GO Version](https://img.shields.io/github/go-mod/go-version/serogaq/3x-ui.svg)](#)
[![Downloads](https://img.shields.io/github/downloads/serogaq/3x-ui/total.svg)](#)
[![License](https://img.shields.io/badge/license-GPL%20V3-blue.svg?longCache=true)](https://www.gnu.org/licenses/gpl-3.0.en.html)
> **Отказ от ответственности:** Этот проект предназначен только для личного обучения и общения. Пожалуйста, не используйте его в незаконных целях и не применяйте в производственной среде.
**Если этот проект оказался полезным для вас, вы можете оценить его, поставив звёздочку** :star2:
<p align="left">
<a href="https://buymeacoffee.com/mhsanaei" target="_blank">
<img src="./media/buymeacoffe.png" alt="Image">
</a>
</p>
- USDT (TRC20): `TXncxkvhkDWGts487Pjqq1qT9JmwRUz8CC`
- MATIC (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A`
- LTC (Litecoin): `ltc1q2ach7x6d2zq0n4l0t4zl7d7xe2s6fs7a3vspwv`
## Установка и обновление
```
bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)
bash <(curl -Ls https://raw.githubusercontent.com/serogaq/3x-ui/master/install.sh)
```
## Установить старую версию (мы не рекомендуем)
@ -35,7 +23,7 @@ bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.
Чтобы установить желаемую версию, используйте следующую команду установки. Например, ver `v1.7.9`:
```
VERSION=v1.7.9 && <(curl -Ls "https://raw.githubusercontent.com/mhsanaei/3x-ui/$VERSION/install.sh") $VERSION
VERSION=v1.7.9 && <(curl -Ls "https://raw.githubusercontent.com/serogaq/3x-ui/$VERSION/install.sh") $VERSION
```
## SSL Сертификат
@ -182,7 +170,7 @@ systemctl restart x-ui
--network=host \
--restart=unless-stopped \
--name 3x-ui \
ghcr.io/mhsanaei/3x-ui:latest
ghcr.io/serogaq/3x-ui:latest
```
4. **Обновление до последней версии:**
@ -559,7 +547,3 @@ XUI_BIN_FOLDER="bin" XUI_DB_FOLDER="/etc/x-ui" go build main.go
- [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._
## Число звёзд со временем
[![Stargazers over time](https://starchart.cc/MHSanaei/3x-ui.svg)](https://starchart.cc/MHSanaei/3x-ui)

View file

@ -4,30 +4,18 @@
**一个更好的面板 • 基于Xray Core构建**
[![](https://img.shields.io/github/v/release/mhsanaei/3x-ui.svg)](https://github.com/MHSanaei/3x-ui/releases)
[![](https://img.shields.io/github/actions/workflow/status/mhsanaei/3x-ui/release.yml.svg)](#)
[![GO Version](https://img.shields.io/github/go-mod/go-version/mhsanaei/3x-ui.svg)](#)
[![Downloads](https://img.shields.io/github/downloads/mhsanaei/3x-ui/total.svg)](#)
[![](https://img.shields.io/github/v/release/serogaq/3x-ui.svg)](https://github.com/MHSanaei/3x-ui/releases)
[![](https://img.shields.io/github/actions/workflow/status/serogaq/3x-ui/release.yml.svg)](#)
[![GO Version](https://img.shields.io/github/go-mod/go-version/serogaq/3x-ui.svg)](#)
[![Downloads](https://img.shields.io/github/downloads/serogaq/3x-ui/total.svg)](#)
[![License](https://img.shields.io/badge/license-GPL%20V3-blue.svg?longCache=true)](https://www.gnu.org/licenses/gpl-3.0.en.html)
> **Disclaimer:** 此项目仅供个人学习交流,请不要用于非法目的,请不要在生产环境中使用。
**如果此项目对你有用,请给一个**:star2:
<p align="left">
<a href="https://buymeacoffee.com/mhsanaei" target="_blank">
<img src="./media/buymeacoffe.png" alt="Image">
</a>
</p>
- USDT (TRC20): `TXncxkvhkDWGts487Pjqq1qT9JmwRUz8CC`
- MATIC (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A`
- LTC (Litecoin): `ltc1q2ach7x6d2zq0n4l0t4zl7d7xe2s6fs7a3vspwv`
## 安装 & 升级
```
bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)
bash <(curl -Ls https://raw.githubusercontent.com/serogaq/3x-ui/master/install.sh)
```
## 安装旧版本 (我们不建议)
@ -35,7 +23,7 @@ bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.
要安装您想要的版本请使用以下安装命令。例如ver `v1.7.9`:
```
VERSION=v1.7.9 && <(curl -Ls "https://raw.githubusercontent.com/mhsanaei/3x-ui/$VERSION/install.sh") $VERSION
VERSION=v1.7.9 && <(curl -Ls "https://raw.githubusercontent.com/serogaq/3x-ui/$VERSION/install.sh") $VERSION
```
### SSL证书
@ -178,7 +166,7 @@ systemctl restart x-ui
--network=host \
--restart=unless-stopped \
--name 3x-ui \
ghcr.io/mhsanaei/3x-ui:latest
ghcr.io/serogaq/3x-ui:latest
```
更新至最新版本
@ -550,7 +538,3 @@ XUI_BIN_FOLDER="bin" XUI_DB_FOLDER="/etc/x-ui" go build main.go
- [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趋势
[![Stargazers over time](https://starchart.cc/MHSanaei/3x-ui.svg)](https://starchart.cc/MHSanaei/3x-ui)

View file

@ -3,14 +3,42 @@ version: "3"
services:
3x-ui:
image: ghcr.io/mhsanaei/3x-ui:latest
build:
context: .
args:
ANTIZAPRET: "1"
container_name: 3x-ui
hostname: yourhostname
hostname: 3x-ui
networks:
traefik:
labels:
- traefik.enable=true
- traefik.http.routers.3x-ui.rule=Host(`<...>`)
- traefik.http.routers.3x-ui.service=3x-ui
- traefik.http.routers.3x-ui.entrypoints=https
- traefik.http.services.3x-ui.loadbalancer.server.port=<...>
#
- traefik.http.routers.3x-ui-sub.rule=Host(`<...>`)
- traefik.http.routers.3x-ui-sub.service=3x-ui-sub
- traefik.http.routers.3x-ui-sub.entrypoints=https
- traefik.http.services.3x-ui-sub.loadbalancer.server.port=<...>
#
- traefik.tcp.routers.vless.rule=HostSNI(`<...>`)
- traefik.tcp.routers.vless.tls.passthrough=true
- traefik.tcp.routers.vless.service=3x-ui-inbound-443
- traefik.tcp.services.3x-ui-inbound-443.loadbalancer.server.port=443
volumes:
- $PWD/db/:/etc/x-ui/
- $PWD/cert/:/root/cert/
environment:
PUID: 1000
PGID: 1000
XRAY_VMESS_AEAD_FORCED: "false"
TZ: Europe/Moscow
XUI_SERVER_IP: "" # Server IP
tty: true
network_mode: host
restart: unless-stopped
networks:
traefik:
external: true

View file

@ -4,6 +4,7 @@ import (
"encoding/base64"
"net"
"strings"
"os"
"github.com/gin-gonic/gin"
)
@ -57,8 +58,11 @@ func (a *SUBController) initRouter(g *gin.RouterGroup) {
func (a *SUBController) subs(c *gin.Context) {
subId := c.Param("subid")
var host string
if h, err := getHostFromXFH(c.GetHeader("X-Forwarded-Host")); err == nil {
host = h
host = os.Getenv("XUI_SERVER_IP")
if host == "" {
if h, err := getHostFromXFH(c.GetHeader("X-Forwarded-Host")); err == nil {
host = h
}
}
if host == "" {
host = c.GetHeader("X-Real-IP")
@ -95,8 +99,11 @@ func (a *SUBController) subs(c *gin.Context) {
func (a *SUBController) subJsons(c *gin.Context) {
subId := c.Param("subid")
var host string
if h, err := getHostFromXFH(c.GetHeader("X-Forwarded-Host")); err == nil {
host = h
host = os.Getenv("XUI_SERVER_IP")
if host == "" {
if h, err := getHostFromXFH(c.GetHeader("X-Forwarded-Host")); err == nil {
host = h
}
}
if host == "" {
host = c.GetHeader("X-Real-IP")

View file

@ -917,6 +917,9 @@
{ label: '🇨🇳 .cn', value: 'regexp:.*\\.cn$' },
{ label: '🇷🇺 Russia', value: 'geosite:category-ru' },
{ label: '🇷🇺 .ru', value: 'regexp:.*\\.ru' },
{ label: '🇷🇺 .su', value: 'regexp:.*\\.su$' },
{ label: '🇷🇺 .рф', value: 'regexp:.*\\.xn--p1ai$' },
{ label: '🇷🇺 Antizapret', value: 'ext:geosite_antizapret.dat:zapretinfo' },
{ label: '🇻🇳 Vietnam', value: 'ext:geosite_VN.dat:vn' },
{ label: '🇻🇳 .vn', value: 'regexp:.*\\.vn$' },
],
@ -927,6 +930,7 @@
{ label: 'Malware 🇮🇷', value: 'ext:geosite_IR.dat:malware' },
{ label: 'Phishing 🇮🇷', value: 'ext:geosite_IR.dat:phishing' },
{ label: 'Cryptominers 🇮🇷', value: 'ext:geosite_IR.dat:cryptominers' },
{ label: 'Antizapret 🇷🇺', value: 'ext:geosite_antizapret.dat:zapretinfo' },
{ label: '🇮🇷 Iran', value: 'ext:geosite_IR.dat:ir' },
{ label: '🇮🇷 .ir', value: 'regexp:.*\\.ir$' },
{ label: '🇮🇷 .ایران', value: 'regexp:.*\\.xn--mgba3a4f16a$' },
@ -934,6 +938,8 @@
{ label: '🇨🇳 .cn', value: 'regexp:.*\\.cn$' },
{ label: '🇷🇺 Russia', value: 'geosite:category-ru' },
{ label: '🇷🇺 .ru', value: 'regexp:.*\\.ru' },
{ label: '🇷🇺 .su', value: 'regexp:.*\\.su$' },
{ label: '🇷🇺 .рф', value: 'regexp:.*\\.xn--p1ai$' },
{ label: '🇻🇳 Vietnam', value: 'ext:geosite_VN.dat:vn' },
{ label: '🇻🇳 .vn', value: 'regexp:.*\\.vn$' },
],
@ -946,13 +952,25 @@
{ label: 'Netflix', value: 'geosite:netflix' },
{ label: 'Reddit', value: 'geosite:reddit' },
{ label: 'Speedtest', value: 'geosite:speedtest' },
{ label: 'Telegram', value: 'geosite:telegram' },
{ label: 'Instagram', value: 'geosite:instagram' },
{ label: 'Stripe', value: 'geosite:stripe' },
{ label: 'Adobe', value: 'geosite:adobe' },
{ label: 'Amazon', value: 'geosite:amazon' },
{ label: 'AWS', value: 'geosite:aws' },
{ label: 'Google Gemini', value: 'geosite:google-gemini' },
{ label: 'Perplexity', value: 'geosite:perplexity' },
{ label: 'Booking', value: 'geosite:booking' },
{ label: 'X (Twitter)', value: 'geosite:x' },
{ label: 'Category: Porn', value: 'geosite:category-porn' },
{ label: 'Category: AI Chats', value: 'geosite:category-ai-chat-!cn' },
],
familyProtectDNS: {
"servers": [
"1.1.1.3", // https://developers.cloudflare.com/1.1.1.1/setup/
"1.0.0.3",
"2606:4700:4700::1113",
"2606:4700:4700::1003"
"1.1.1.1", // https://developers.cloudflare.com/1.1.1.1/setup/
"1.0.0.1",
"2606:4700:4700::1111",
"2606:4700:4700::1001"
],
"queryStrategy": "UseIP"
},

View file

@ -349,8 +349,8 @@
"RoutingStrategyDesc" = "Set the overall traffic routing strategy for resolving all requests."
"Torrent" = "Block BitTorrent Protocol"
"TorrentDesc" = "Blocks BitTorrent protocol."
"Family" = "Family Protection"
"FamilyDesc" = "Blocks adult content, and malware websites."
"Family" = "Cloudflare DNS"
"FamilyDesc" = "DNS servers from Cloudflare (1.1.1.1; 1.0.0.1)."
"Inbounds" = "Inbounds"
"InboundsDesc" = "Accepting the specific clients."
"Outbounds" = "Outbounds"

View file

@ -349,8 +349,8 @@
"RoutingStrategyDesc" = "Установка общей стратегии маршрутизации разрешения DNS"
"Torrent" = "Запрет использования BitTorrent"
"TorrentDesc" = "Изменение шаблона конфигурации для предупреждения использования BitTorrent пользователями"
"Family" = "Блокируйте вредоносное ПО и контент для взрослых"
"FamilyDesc" = "DNS-преобразователи Cloudflare для блокировки вредоносного ПО и контента для взрослых в целях защиты семьи."
"Family" = "Cloudflare DNS"
"FamilyDesc" = "DNS-преобразователи Cloudflare (1.1.1.1; 1.0.0.1)."
"Inbounds" = "Входящие"
"InboundsDesc" = "Изменение шаблона конфигурации для подключения определенных пользователей"
"Outbounds" = "Исходящие"
@ -572,7 +572,7 @@
"allClients" = "Все клиенты"
[tgbot.answers]
"successfulOperation" = "✅ Успешный!"
"successfulOperation" = "✅ OK!"
"errorOperation" = "❗ Ошибка в операции."
"getInboundsFailed" = "❌ Не удалось получить входящие потоки."
"getClientsFailed" = "❌ Не удалось получить клиентов."