Skip to content

Commit

Permalink
remove multi protocol script
Browse files Browse the repository at this point in the history
  • Loading branch information
MHSanaei committed Jan 27, 2024
1 parent 9fba92d commit f9c703e
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 77 deletions.
35 changes: 22 additions & 13 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,50 @@
name: Release 3X-UI for Docker

on:
push:
tags:
- "*"
workflow_dispatch:

jobs:
build_and_push:
build:
runs-on: ubuntu-latest

steps:
- name: Check out the code
- name: Checkout repository
uses: actions/[email protected]
with:
submodules: true

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/mhsanaei/3x-ui
tags: |
type=ref,event=branch
type=ref,event=tag
type=pep440,pattern={{version}}
- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Log in to GitHub Container Registry
- name: Login to GHCR
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/[email protected]
with:
images: ghcr.io/${{ github.repository }}

- name: Build and push Docker image
- name: Build and push
uses: docker/[email protected]
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64, linux/arm64/v8, linux/arm/v7, linux/arm/v6, linux/386
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 }}
10 changes: 1 addition & 9 deletions DockerInit.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh

case $1 in
amd64)
ARCH="64"
Expand All @@ -21,28 +20,21 @@ case $1 in
ARCH="arm32-v6"
FNAME="armv6"
;;
armv5)
ARCH="arm32-v5"
FNAME="armv5"
;;
*)
ARCH="64"
FNAME="amd64"
;;
esac


mkdir -p build/bin
cd build/bin

wget "https://github.com/XTLS/Xray-core/releases/download/v1.8.7/Xray-linux-${ARCH}.zip"
unzip "Xray-linux-${ARCH}.zip"
rm -f "Xray-linux-${ARCH}.zip" geoip.dat geosite.dat
mv xray "xray-linux-${FNAME}"

wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat
wget -O geoip_IR.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geoip.dat
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 ../../
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# ========================================================
# Stage: Builder
# ========================================================
FROM --platform=$BUILDPLATFORM golang:1.21-alpine AS builder
FROM golang:1.21-alpine AS builder
WORKDIR /app
ARG TARGETARCH
ENV CGO_ENABLED=1
ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"

RUN apk --no-cache --update add \
build-base \
Expand All @@ -15,6 +13,8 @@ RUN apk --no-cache --update add \

COPY . .

ENV CGO_ENABLED=1
ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"
RUN go build -o build/x-ui main.go
RUN ./DockerInit.sh "$TARGETARCH"

Expand All @@ -30,9 +30,9 @@ RUN apk add --no-cache --update \
tzdata \
fail2ban

COPY --from=builder /app/build/ /app/
COPY --from=builder /app/DockerEntrypoint.sh /app/
COPY --from=builder /app/x-ui.sh /usr/bin/x-ui
COPY --from=builder /app/build/ /app/
COPY --from=builder /app/DockerEntrypoint.sh /app/
COPY --from=builder /app/x-ui.sh /usr/bin/x-ui

# Configure fail2ban
RUN rm -f /etc/fail2ban/jail.d/alpine-ssh.conf \
Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,19 @@ systemctl restart x-ui
update to latest version

```sh
cd 3x-ui
docker compose down
docker compose pull 3x-ui
docker compose up -d
cd 3x-ui
docker compose down
docker compose pull 3x-ui
docker compose up -d
```

remove 3x-ui from docker

```sh
docker stop 3x-ui
docker rm 3x-ui
cd --
rm -r 3x-ui
```

</details>
Expand Down
4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ config_after_install() {
echo -e "${green}username:${usernameTemp}${plain}"
echo -e "${green}password:${passwordTemp}${plain}"
echo -e "###############################################"
echo -e "${red}if you forgot your login info,you can type x-ui and then type 7 to check after installation${plain}"
echo -e "${red}if you forgot your login info,you can type x-ui and then type 8 to check after installation${plain}"
else
echo -e "${red} this is your upgrade,will keep old settings,if you forgot your login info,you can type x-ui and then type 7 to check${plain}"
echo -e "${red} this is your upgrade,will keep old settings,if you forgot your login info,you can type x-ui and then type 8 to check${plain}"
fi
fi
/usr/local/x-ui/x-ui migrate
Expand Down
54 changes: 11 additions & 43 deletions x-ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -806,34 +806,6 @@ warp_cloudflare() {
esac
}

multi_protocol() {
echo "This script only supports Vless and Vmess. if you use another protocols, DON'T INSTALL or get backup first! "
echo -e "${green}\t1.${plain} Install Multi Protocol Script"
echo -e "${green}\t2.${plain} Uninstall"
echo -e "${green}\t3.${plain} Start Service"
echo -e "${green}\t4.${plain} Stop Service"
echo -e "${green}\t0.${plain} Back to Main Menu"
read -p "Choose an option: " choice
case "$choice" in
0)
show_menu
;;
1)
bash <(curl -Ls https://raw.githubusercontent.com/M4mmad/3xui-multi-protocol/master/install.sh --ipv4)
;;
2)
bash <(curl -Ls https://raw.githubusercontent.com/M4mmad/3xui-multi-protocol/master/unistall.sh --ipv4)
;;
3)
systemctl start 3xui-multi-protocol
;;
4)
systemctl stop 3xui-multi-protocol
;;
*) echo "Invalid choice" ;;
esac
}

run_speedtest() {
# Check if Speedtest is already installed
if ! command -v speedtest &>/dev/null; then
Expand Down Expand Up @@ -1145,22 +1117,21 @@ show_menu() {
${green}12.${plain} Check Status
${green}13.${plain} Check Logs
————————————————
${green}14.${plain} Enable x-ui On System Startup
${green}15.${plain} Disable x-ui On System Startup
${green}14.${plain} Enable Autostart
${green}15.${plain} Disable Autostart
————————————————
${green}16.${plain} SSL Certificate Management
${green}17.${plain} Cloudflare SSL Certificate
${green}18.${plain} IP Limit Management
${green}19.${plain} WARP Management
${green}20.${plain} Multi Protocol Management
————————————————
${green}21.${plain} Enable BBR
${green}22.${plain} Update Geo Files
${green}23.${plain} Active Firewall and open ports
${green}24.${plain} Speedtest by Ookla
${green}20.${plain} Enable BBR
${green}21.${plain} Update Geo Files
${green}22.${plain} Active Firewall and open ports
${green}23.${plain} Speedtest by Ookla
"
show_status
echo && read -p "Please enter your selection [0-24]: " num
echo && read -p "Please enter your selection [0-23]: " num

case "${num}" in
0)
Expand Down Expand Up @@ -1224,22 +1195,19 @@ show_menu() {
warp_cloudflare
;;
20)
multi_protocol
;;
21)
enable_bbr
;;
22)
21)
update_geo
;;
23)
22)
open_ports
;;
24)
23)
run_speedtest
;;
*)
LOGE "Please enter the correct number [0-24]"
LOGE "Please enter the correct number [0-23]"
;;
esac
}
Expand Down

0 comments on commit f9c703e

Please sign in to comment.