update
This commit is contained in:
parent
baa66b8c2b
commit
b737fead0c
49
.github/workflows/xray_docker_reality.yml
vendored
49
.github/workflows/xray_docker_reality.yml
vendored
@ -1,49 +0,0 @@
|
|||||||
name: xray_docker_reality_docker_image_build
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- 'reality/Dockerfile'
|
|
||||||
- '.github/workflows/xray_docker_reality.yml'
|
|
||||||
- 'reality/entrypoint.sh'
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- 'reality/Dockerfile'
|
|
||||||
- '.github/workflows/xray_docker_reality.yml'
|
|
||||||
- 'reality/entrypoint.sh'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3.4.0
|
|
||||||
|
|
||||||
- name: Docker Setup Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2.5.0
|
|
||||||
|
|
||||||
- name: Docker Login
|
|
||||||
uses: docker/login-action@v2.1.0
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Extract first line of commit message
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
COMMIT_MESSAGE=$(git log --format=%B -n 1 ${{ github.sha }})
|
|
||||||
FIRST_LINE=$(echo "$COMMIT_MESSAGE" | head -n1)
|
|
||||||
TAG_NAME=$(echo "$FIRST_LINE" | tr -d '[:space:]') # Remove spaces if needed
|
|
||||||
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v4.0.0
|
|
||||||
with:
|
|
||||||
context: ./reality
|
|
||||||
file: ./reality/Dockerfile
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
|
|
||||||
tags: |
|
|
||||||
wulabing/xray_docker_reality:${{env.TAG_NAME}}
|
|
||||||
wulabing/xray_docker_reality:latest
|
|
||||||
push: true
|
|
||||||
27
README.md
Normal file
27
README.md
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# 说明
|
||||||
|
|
||||||
|
## 前提
|
||||||
|
提前安装好以下软件
|
||||||
|
- docker
|
||||||
|
- docker-compose
|
||||||
|
- jq - 用于查看json文件
|
||||||
|
- qrencode - 用于生成二维码
|
||||||
|
|
||||||
|
## 启动和关闭
|
||||||
|
|
||||||
|
启动
|
||||||
|
```
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
关闭
|
||||||
|
```
|
||||||
|
docker-compose down
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## 查看分享链接
|
||||||
|
|
||||||
|
````
|
||||||
|
bash get_share_link.sh
|
||||||
|
````
|
||||||
|
|
||||||
@ -40,30 +40,30 @@
|
|||||||
"inbounds": [
|
"inbounds": [
|
||||||
{
|
{
|
||||||
"listen": "0.0.0.0",
|
"listen": "0.0.0.0",
|
||||||
"port": 443,
|
"port": 8003,
|
||||||
"protocol": "vless",
|
"protocol": "vless",
|
||||||
"settings": {
|
"settings": {
|
||||||
"clients": [
|
"clients": [
|
||||||
{
|
{
|
||||||
"id": "xx",
|
"id": "d1872fe4-9a9e-442b-87c9-74c779c56476",
|
||||||
"flow": "xtls-rprx-vision"
|
"flow": "xtls-rprx-vision"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"decryption": "none"
|
"decryption": "none"
|
||||||
},
|
},
|
||||||
"streamSettings": {
|
"streamSettings": {
|
||||||
"network": "xx",
|
"network": "tcp",
|
||||||
"security": "reality",
|
"security": "reality",
|
||||||
"realitySettings": {
|
"realitySettings": {
|
||||||
"show": true,
|
"show": true,
|
||||||
"dest": "xx",
|
"dest": "www.expedia.com:443",
|
||||||
"xver": 0,
|
"xver": 0,
|
||||||
"maxTimeDiff": 0,
|
"maxTimeDiff": 0,
|
||||||
"minClientVer": "",
|
"minClientVer": "",
|
||||||
"serverNames": [
|
"serverNames": [
|
||||||
"xx"
|
"www.expedia.com"
|
||||||
],
|
],
|
||||||
"privateKey": "xx",
|
"privateKey": "UArrjC-9qLXdvIHFz0SH1jSZ1CGctYxHYKrHZEH5E3A",
|
||||||
"shortIds": [
|
"shortIds": [
|
||||||
""
|
""
|
||||||
]
|
]
|
||||||
@ -125,4 +125,3 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
2
conf/key.txt
Normal file
2
conf/key.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Private key: UArrjC-9qLXdvIHFz0SH1jSZ1CGctYxHYKrHZEH5E3A
|
||||||
|
Public key: Z-HcL71ZNbPshcMUdNK4pC0XkbS6vjRB8fTQQUsIEV4
|
||||||
10
docker-compose.yml
Normal file
10
docker-compose.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
version: '3.9'
|
||||||
|
|
||||||
|
services:
|
||||||
|
xray:
|
||||||
|
image: teddysun/xray
|
||||||
|
restart: always
|
||||||
|
container_name: xray
|
||||||
|
network_mode: "host"
|
||||||
|
volumes:
|
||||||
|
- './conf:/etc/xray'
|
||||||
30
get_share_link.sh
Normal file
30
get_share_link.sh
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
IPV4=$(curl -4 -sSL --connect-timeout 3 --retry 2 ip.sb || echo "null")
|
||||||
|
UUID=$(jq -r '.inbounds[0].settings.clients[0].id' ./conf/config.json)
|
||||||
|
PORT=$(jq -r '.inbounds[0].port' ./conf/config.json)
|
||||||
|
DEST=$(jq -r '.inbounds[0].streamSettings.realitySettings.dest' ./conf/config.json)
|
||||||
|
NETWORK="tcp"
|
||||||
|
PRIVATE_KEY=$(cat ./confkey.txt | grep "Private " | awk -F ': ' '{print $2}')
|
||||||
|
PUBLIC_KEY=$(cat ./conf/key.txt | grep "Public" | awk -F ': ' '{print $2}')
|
||||||
|
FIRST_SERVERNAME=$(echo $SERVERNAMES | awk '{print $1}')
|
||||||
|
|
||||||
|
# config info with green color
|
||||||
|
echo -e "\033[32m"
|
||||||
|
echo "IPV4: $IPV4"
|
||||||
|
echo "UUID: $UUID"
|
||||||
|
echo "DEST: $DEST"
|
||||||
|
echo "PORT: $PORT"
|
||||||
|
echo "PUBLIC_KEY: $PUBLIC_KEY"
|
||||||
|
echo "NETWORK: $NETWORK"
|
||||||
|
if [ "$IPV4" != "null" ]; then
|
||||||
|
SUB_IPV4="vless://$UUID@$IPV4:$PORT?encryption=none&security=reality&type=$NETWORK&sni=$FIRST_SERVERNAME&fp=chrome&pbk=$PUBLIC_KEY&flow=xtls-rprx-vision#wulabing_docker_vless_reality_vision"
|
||||||
|
echo "IPV4 订阅连接: $SUB_IPV4"
|
||||||
|
echo -e "IPV4 订阅二维码:\n$(echo "$SUB_IPV4" | qrencode -o - -t UTF8)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "\033[0m"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
# builder
|
|
||||||
FROM golang:alpine as builder
|
|
||||||
LABEL maintainer="wulabing <wulabing@gmail.com>"
|
|
||||||
|
|
||||||
|
|
||||||
#ENV GOPROXY=https://goproxy.cn,direct
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
RUN apk add --no-cache git && git clone https://github.com/XTLS/Xray-core.git . && \
|
|
||||||
go mod download && \
|
|
||||||
go build -o xray /app/main/
|
|
||||||
|
|
||||||
# runner
|
|
||||||
FROM alpine:latest as runner
|
|
||||||
|
|
||||||
|
|
||||||
ENV UUID=""
|
|
||||||
ENV DEST=""
|
|
||||||
ENV SERVERNAMES=""
|
|
||||||
ENV PRIVATEKEY=""
|
|
||||||
ENV SHORTIDS=""
|
|
||||||
ENV NETWORK=""
|
|
||||||
ENV INTERNAL_PORT=""
|
|
||||||
ENV HOSTMODE_PORT=""
|
|
||||||
ENV TZ=Asia/Shanghai
|
|
||||||
|
|
||||||
WORKDIR /
|
|
||||||
|
|
||||||
COPY ./entrypoint.sh /
|
|
||||||
COPY ./config.json /
|
|
||||||
|
|
||||||
COPY --from=builder /app/xray /
|
|
||||||
|
|
||||||
RUN apk add --no-cache tzdata ca-certificates jq curl libqrencode && \
|
|
||||||
mkdir -p /var/log/xray &&\
|
|
||||||
wget -O /geosite.dat https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat && \
|
|
||||||
wget -O /geoip.dat https://github.com/v2fly/geoip/releases/latest/download/geoip.dat && \
|
|
||||||
chmod +x /entrypoint.sh
|
|
||||||
|
|
||||||
|
|
||||||
ENTRYPOINT ["./entrypoint.sh"]
|
|
||||||
EXPOSE 443
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
打包镜像执行build.sh
|
|
||||||
bash build.sh
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
## 已知可用的 SERVERNAMES 及 DEST 列表
|
|
||||||
|
|
||||||
| DEST | SERVERMANES | 说明 |
|
|
||||||
|-------------------|--------------------------------|------------------------------------|
|
|
||||||
| www.apple.com:443 | images.apple.com www.apple.com | Apple 使用了 akamai CDN,全球各地存在节点,并且知名 |
|
|
||||||
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
docker pull golang:alpine
|
|
||||||
docker build -t vincent/xray_docker_reality:0.0.1 .
|
|
||||||
|
|
||||||
@ -1,92 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
if [ -f /config_info.txt ]; then
|
|
||||||
echo "config.json exist"
|
|
||||||
else
|
|
||||||
IPV6=$(curl -6 -sSL --connect-timeout 3 --retry 2 ip.sb || echo "null")
|
|
||||||
IPV4=$(curl -4 -sSL --connect-timeout 3 --retry 2 ip.sb || echo "null")
|
|
||||||
if [ -z "$UUID" ]; then
|
|
||||||
echo "UUID is not set, generate random UUID "
|
|
||||||
UUID="$(/xray uuid)"
|
|
||||||
echo "UUID: $UUID"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$EXTERNAL_PORT" ]; then
|
|
||||||
echo "EXTERNAL_PORT is not set, use default value 443"
|
|
||||||
EXTERNAL_PORT=443
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$HOSTMODE_PORT" ];then
|
|
||||||
EXTERNAL_PORT=$HOSTMODE_PORT
|
|
||||||
jq ".inbounds[0].port=$HOSTMODE_PORT" /config.json >/config.json_tmp && mv /config.json_tmp /config.json
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$DEST" ]; then
|
|
||||||
echo "DEST is not set. default value www.apple.com:443"
|
|
||||||
DEST="www.apple.com:443"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$SERVERNAMES" ]; then
|
|
||||||
echo "SERVERNAMES is not set. use default value [\"www.apple.com\",\"images.apple.com\"]"
|
|
||||||
SERVERNAMES="www.apple.com images.apple.com"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$PRIVATEKEY" ]; then
|
|
||||||
echo "PRIVATEKEY is not set. generate new key"
|
|
||||||
/xray x25519 >/key
|
|
||||||
PRIVATEKEY=$(cat /key | grep "Private" | awk -F ': ' '{print $2}')
|
|
||||||
PUBLICKEY=$(cat /key | grep "Public" | awk -F ': ' '{print $2}')
|
|
||||||
echo "Private key: $PRIVATEKEY"
|
|
||||||
echo "Public key: $PUBLICKEY"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$NETWORK" ]; then
|
|
||||||
echo "NETWORK is not set,set default value tcp"
|
|
||||||
NETWORK="tcp"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# change config
|
|
||||||
jq ".inbounds[0].settings.clients[0].id=\"$UUID\"" /config.json >/config.json_tmp && mv /config.json_tmp /config.json
|
|
||||||
jq ".inbounds[0].streamSettings.realitySettings.dest=\"$DEST\"" /config.json >/config.json_tmp && mv /config.json_tmp /config.json
|
|
||||||
|
|
||||||
SERVERNAMES_JSON_ARRAY="$(echo "[$(echo $SERVERNAMES | awk '{for(i=1;i<=NF;i++) printf "\"%s\",", $i}' | sed 's/,$//')]")"
|
|
||||||
jq --argjson serverNames "$SERVERNAMES_JSON_ARRAY" '.inbounds[0].streamSettings.realitySettings.serverNames = $serverNames' /config.json >/config.json_tmp && mv /config.json_tmp /config.json
|
|
||||||
|
|
||||||
jq ".inbounds[0].streamSettings.realitySettings.privateKey=\"$PRIVATEKEY\"" /config.json >/config.json_tmp && mv /config.json_tmp /config.json
|
|
||||||
jq ".inbounds[0].streamSettings.network=\"$NETWORK\"" /config.json >/config.json_tmp && mv /config.json_tmp /config.json
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FIRST_SERVERNAME=$(echo $SERVERNAMES | awk '{print $1}')
|
|
||||||
# config info with green color
|
|
||||||
echo -e "\033[32m" >/config_info.txt
|
|
||||||
echo "IPV6: $IPV6" >>/config_info.txt
|
|
||||||
echo "IPV4: $IPV4" >>/config_info.txt
|
|
||||||
echo "UUID: $UUID" >>/config_info.txt
|
|
||||||
echo "DEST: $DEST" >>/config_info.txt
|
|
||||||
echo "PORT: $EXTERNAL_PORT" >>/config_info.txt
|
|
||||||
echo "SERVERNAMES: $SERVERNAMES (任选其一)" >>/config_info.txt
|
|
||||||
echo "PRIVATEKEY: $PRIVATEKEY" >>/config_info.txt
|
|
||||||
echo "PUBLICKEY: $PUBLICKEY" >>/config_info.txt
|
|
||||||
echo "NETWORK: $NETWORK" >>/config_info.txt
|
|
||||||
if [ "$IPV4" != "null" ]; then
|
|
||||||
SUB_IPV4="vless://$UUID@$IPV4:$EXTERNAL_PORT?encryption=none&security=reality&type=$NETWORK&sni=$FIRST_SERVERNAME&fp=chrome&pbk=$PUBLICKEY&flow=xtls-rprx-vision#wulabing_docker_vless_reality_vision"
|
|
||||||
echo "IPV4 订阅连接: $SUB_IPV4" >>/config_info.txt
|
|
||||||
echo -e "IPV4 订阅二维码:\n$(echo "$SUB_IPV4" | qrencode -o - -t UTF8)" >>/config_info.txt
|
|
||||||
fi
|
|
||||||
if [ "$IPV6" != "null" ];then
|
|
||||||
SUB_IPV6="vless://$UUID@$IPV6:$EXTERNAL_PORT?encryption=none&security=reality&type=$NETWORK&sni=$FIRST_SERVERNAME&fp=chrome&pbk=$PUBLICKEY&flow=xtls-rprx-vision#wulabing_docker_vless_reality_vision"
|
|
||||||
echo "IPV6 订阅连接: $SUB_IPV6" >>/config_info.txt
|
|
||||||
echo -e "IPV6 订阅二维码:\n$(echo "$SUB_IPV6" | qrencode -o - -t UTF8)" >>/config_info.txt
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
echo -e "\033[0m" >>/config_info.txt
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# show config info
|
|
||||||
cat /config_info.txt
|
|
||||||
|
|
||||||
# run xray
|
|
||||||
exec /xray -config /config.json
|
|
||||||
Loading…
Reference in New Issue
Block a user