Skip to content

Commit

Permalink
0.0.27
Browse files Browse the repository at this point in the history
Enhance Reality configuration and Dockerfile:
- Add dokodemo-door inbound for improved routing.
- Update Dockerfile build process with verbose flags
- Modify entrypoint script to handle new inbound configuration
- Update routing rules to support server name filtering. Without traffic being stolen if use CDN website  servername such as cloudflare
  • Loading branch information
wulabing committed Jan 31, 2025
1 parent 32f1e83 commit 80d6677
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 10 deletions.
6 changes: 3 additions & 3 deletions reality/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# builder
FROM golang:alpine AS builder
LABEL maintainer="wulabing <[email protected]>"
LABEL version="0.0.26"
LABEL version="0.0.27"


#ENV GOPROXY=https://goproxy.cn,direct
Expand All @@ -11,8 +11,8 @@ RUN apk add --no-cache git curl jq && \
LATEST_VERSION_TAG=$(curl -s https://api.github.com/repos/XTLS/Xray-core/releases | jq -r '.[0].tag_name') && \
git clone https://github.com/XTLS/Xray-core.git . && \
git checkout $LATEST_VERSION_TAG && \
go mod download && \
go build -o xray /app/main/
go mod download -x && \
go build -v -o xray /app/main/

# runner
FROM alpine:latest AS runner
Expand Down
26 changes: 25 additions & 1 deletion reality/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,23 @@
},
"inbounds": [
{
"listen": "0.0.0.0",
"tag": "dokodemo-in",
"port": 443,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1",
"port": 65432,
"network": "tcp"
},
"sniffing": {
"enabled": true,
"destOverride": ["tls"],
"routeOnly": true
}
},
{
"listen": "127.0.0.1",
"port": 65432,
"protocol": "vless",
"settings": {
"clients": [
Expand Down Expand Up @@ -91,6 +106,15 @@
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"inboundTag": ["dokodemo-in"],
"domain": ["xx"],
"outboundTag": "direct"
},
{
"inboundTag": ["dokodemo-in"],
"outboundTag": "blocked"
},
{
"inboundTag": [
"api"
Expand Down
12 changes: 6 additions & 6 deletions reality/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ else
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
jq ".inbounds[1].settings.clients[0].id=\"$UUID\"" /config.json >/config.json_tmp && mv /config.json_tmp /config.json
jq ".inbounds[1].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
jq --argjson serverNames "$SERVERNAMES_JSON_ARRAY" '.inbounds[1].streamSettings.realitySettings.serverNames = $serverNames' /config.json >/config.json_tmp && mv /config.json_tmp /config.json
jq --argjson serverNames "$SERVERNAMES_JSON_ARRAY" '.routing.rules[0].domain = $serverNames' /config.json >/config.json_tmp && mv /config.json_tmp /config.json

jq ".inbounds[1].streamSettings.realitySettings.privateKey=\"$PRIVATEKEY\"" /config.json >/config.json_tmp && mv /config.json_tmp /config.json
jq ".inbounds[1].streamSettings.network=\"$NETWORK\"" /config.json >/config.json_tmp && mv /config.json_tmp /config.json



Expand Down

0 comments on commit 80d6677

Please sign in to comment.