From 0bd9c87777f02f6e9e1b135b8535438b97769738 Mon Sep 17 00:00:00 2001
From: serogaq <36307024+serogaq@users.noreply.github.com>
Date: Wed, 6 Nov 2024 15:26:02 +0300
Subject: [PATCH] initial
---
.github/FUNDING.yml | 2 +-
DockerEntrypoint.sh | 4 ++++
DockerInit.sh | 32 +++++++++++++++++++++++++-
Dockerfile | 9 +++++---
README.md | 30 ++++++------------------
README.ru_RU.md | 30 ++++++------------------
README.zh_CN.md | 30 ++++++------------------
docker-compose.yml | 34 +++++++++++++++++++++++++---
sub/subController.go | 15 ++++++++----
web/html/xui/xray.html | 26 +++++++++++++++++----
web/translation/translate.en_US.toml | 4 ++--
web/translation/translate.ru_RU.toml | 6 ++---
12 files changed, 132 insertions(+), 90 deletions(-)
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index c6175c59..5e395755 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -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']
diff --git a/DockerEntrypoint.sh b/DockerEntrypoint.sh
index 9ebcd1d6..b5a449ea 100644
--- a/DockerEntrypoint.sh
+++ b/DockerEntrypoint.sh
@@ -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
diff --git a/DockerInit.sh b/DockerInit.sh
index 90e83e9b..83a2a1ee 100755
--- a/DockerInit.sh
+++ b/DockerInit.sh
@@ -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 ../../
\ No newline at end of file
+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
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index ac09b531..f16d3422 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -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/
diff --git a/README.md b/README.md
index e60d5a95..aa4c3e23 100644
--- a/README.md
+++ b/README.md
@@ -4,30 +4,18 @@
**An Advanced Web Panel • Built on Xray Core**
-[](https://github.com/MHSanaei/3x-ui/releases)
-[](#)
-[](#)
-[](#)
+[](https://github.com/MHSanaei/3x-ui/releases)
+[](#)
+[](#)
+[](#)
[](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:
-
-
-
-
-
-
-
-- 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
-
-[](https://starchart.cc/MHSanaei/3x-ui)
diff --git a/README.ru_RU.md b/README.ru_RU.md
index e5b05dc0..c9935fc9 100644
--- a/README.ru_RU.md
+++ b/README.ru_RU.md
@@ -4,30 +4,18 @@
**Продвинутая веб-панель • Построена на основе Xray Core**
-[](https://github.com/MHSanaei/3x-ui/releases)
-[](#)
-[](#)
-[](#)
+[](https://github.com/MHSanaei/3x-ui/releases)
+[](#)
+[](#)
+[](#)
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
> **Отказ от ответственности:** Этот проект предназначен только для личного обучения и общения. Пожалуйста, не используйте его в незаконных целях и не применяйте в производственной среде.
-**Если этот проект оказался полезным для вас, вы можете оценить его, поставив звёздочку** :star2:
-
-
-
-
-
-
-
-- 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._
-
-## Число звёзд со временем
-
-[](https://starchart.cc/MHSanaei/3x-ui)
diff --git a/README.zh_CN.md b/README.zh_CN.md
index 6ad22d0c..7a64fdc5 100644
--- a/README.zh_CN.md
+++ b/README.zh_CN.md
@@ -4,30 +4,18 @@
**一个更好的面板 • 基于Xray Core构建**
-[](https://github.com/MHSanaei/3x-ui/releases)
-[](#)
-[](#)
-[](#)
+[](https://github.com/MHSanaei/3x-ui/releases)
+[](#)
+[](#)
+[](#)
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
> **Disclaimer:** 此项目仅供个人学习交流,请不要用于非法目的,请不要在生产环境中使用。
-**如果此项目对你有用,请给一个**:star2:
-
-
-
-
-
-
-
-- 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趋势
-
-[](https://starchart.cc/MHSanaei/3x-ui)
diff --git a/docker-compose.yml b/docker-compose.yml
index b0a89399..715ca068 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -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
\ No newline at end of file
diff --git a/sub/subController.go b/sub/subController.go
index 9afbc8da..edd34481 100644
--- a/sub/subController.go
+++ b/sub/subController.go
@@ -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")
diff --git a/web/html/xui/xray.html b/web/html/xui/xray.html
index ddb4d515..71d29ecd 100644
--- a/web/html/xui/xray.html
+++ b/web/html/xui/xray.html
@@ -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"
},
diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml
index ceceabd5..1d9d0067 100644
--- a/web/translation/translate.en_US.toml
+++ b/web/translation/translate.en_US.toml
@@ -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"
diff --git a/web/translation/translate.ru_RU.toml b/web/translation/translate.ru_RU.toml
index f185ca3d..91fd2853 100644
--- a/web/translation/translate.ru_RU.toml
+++ b/web/translation/translate.ru_RU.toml
@@ -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" = "❌ Не удалось получить клиентов."