mirror of
https://github.com/EvgenyNerush/easy-xray.git
synced 2025-12-14 05:45:31 +03:00
add minimal working prototype
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1 @@
|
|||||||
*config*.json
|
config*.json
|
||||||
|
|||||||
54
ex.sh
54
ex.sh
@@ -85,22 +85,7 @@ to install xray${normal}"
|
|||||||
echo -e "${red}jq not installed, can't generate configs"
|
echo -e "${red}jq not installed, can't generate configs"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
if curl -L https://raw.githubusercontent.com/XTLS/Xray-examples/main/VLESS-gRPC-REALITY/config_server.json > tmpconfig
|
echo -e "${bold}Enter IPv4 or IPv6 address of your xray server, or its domain name:${normal}"
|
||||||
then
|
|
||||||
cat tmpconfig > template_config_server.json
|
|
||||||
echo -e "${green}template server config downloaded${normal}"
|
|
||||||
else
|
|
||||||
echo -e "${red}can't download template server config, trying to use that have been downloaded before${normal}"
|
|
||||||
fi
|
|
||||||
if curl -L https://raw.githubusercontent.com/XTLS/Xray-examples/main/VLESS-gRPC-REALITY/config_client.json > tmpconfig
|
|
||||||
then
|
|
||||||
cat tmpconfig > template_config_client.json
|
|
||||||
echo -e "${green}template client config downloaded${normal}"
|
|
||||||
else
|
|
||||||
echo -e "${red}can't download template client config, trying to use that have been downloaded before${normal}"
|
|
||||||
fi
|
|
||||||
rm tmpconfig
|
|
||||||
echo -e "${bold}Enter domain name, IPv4 or IPv6 address of your xray server:${normal}"
|
|
||||||
read address
|
read address
|
||||||
id=$(xray uuid)
|
id=$(xray uuid)
|
||||||
keys=$(xray x25519)
|
keys=$(xray x25519)
|
||||||
@@ -163,24 +148,25 @@ or is in the same country. Better if it is popular.
|
|||||||
fake_site="www.yahoo.com"
|
fake_site="www.yahoo.com"
|
||||||
fi
|
fi
|
||||||
echo -e "${green}mimic ${fake_site}${normal}"
|
echo -e "${green}mimic ${fake_site}${normal}"
|
||||||
port=443
|
port=80
|
||||||
|
email="love@xray.com"
|
||||||
clients=" [
|
clients=" [
|
||||||
{
|
{
|
||||||
\"id\": \"${id}\",
|
\"id\": \"${id}\",
|
||||||
\"email\": \"love@xray.com\",
|
\"email\": \"${email}\",
|
||||||
\"flow\": \"xtls-rprx-vision\"
|
\"flow\": \"\"
|
||||||
}
|
}
|
||||||
]"
|
]"
|
||||||
serverRealitySettings=" {
|
serverRealitySettings=" {
|
||||||
\"show\": false,
|
\"show\": false,
|
||||||
\"dest\": \"${fake_site}:${port}\",
|
\"dest\": \"${fake_site}:443\",
|
||||||
\"xver\": 0,
|
\"xver\": 0,
|
||||||
\"serverNames\": [ \"${fake_site}\" ],
|
\"serverNames\": [ \"${fake_site}\" ],
|
||||||
\"privateKey\": \"${private_key}\",
|
\"privateKey\": \"${private_key}\",
|
||||||
\"shortIds\": [ \"${short_id}\" ]
|
\"shortIds\": [ \"${short_id}\" ]
|
||||||
}"
|
}"
|
||||||
# make server config
|
# make server config
|
||||||
cat template_config_server.json | jq ".inbounds[].port=${port} | .settings.clients=${clients} | .inbounds[].streamSettings.realitySettings=${serverRealitySettings}" > config_server.json
|
cat template_config_server.json | jq ".inbounds[].settings.clients=${clients} | .inbounds[].streamSettings.realitySettings=${serverRealitySettings}" > config_server.json
|
||||||
|
|
||||||
vnext=" [
|
vnext=" [
|
||||||
{
|
{
|
||||||
@@ -190,40 +176,24 @@ or is in the same country. Better if it is popular.
|
|||||||
{
|
{
|
||||||
\"id\": \"${id}\",
|
\"id\": \"${id}\",
|
||||||
\"alterId\": 0,
|
\"alterId\": 0,
|
||||||
\"email\": \"love@xray.com\",
|
\"email\": \"${email}\",
|
||||||
\"security\": \"auto\",
|
\"security\": \"auto\",
|
||||||
\"encryption\": \"none\",
|
\"encryption\": \"none\",
|
||||||
\"flow\": \"xtls-rprx-vision\"
|
\"flow\": \"\"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]"
|
]"
|
||||||
clientRealitySettings=" {
|
clientRealitySettings=" {
|
||||||
\"serverName\": \"${serverName}\",
|
\"serverName\": \"${fake_site}\",
|
||||||
\"fingerprint\": \"chrome\",
|
\"fingerprint\": \"chrome\",
|
||||||
\"show\": false,
|
\"show\": false,
|
||||||
\"publicKey\": \"${publicKey}\",
|
\"publicKey\": \"${public_key}\",
|
||||||
\"shortId\": \"${short_id}\",
|
\"shortId\": \"${short_id}\",
|
||||||
\"spiderX\": \"\"
|
\"spiderX\": \"\"
|
||||||
}"
|
}"
|
||||||
rules=" [
|
|
||||||
{
|
|
||||||
\"type\": \"field\",
|
|
||||||
\"domain\": [ \"domain:localhost\", \"domain:ru\", \"domain:su\", \"domain:by\", \"domain:cn\", \"domain:vk.com\" ],
|
|
||||||
\"outboundTag\": \"direct\"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
\"type\": \"field\",
|
|
||||||
\"inboundTag\": [\"api\"],
|
|
||||||
\"outboundTag\": \"api\",
|
|
||||||
\"enabled\": true
|
|
||||||
}
|
|
||||||
]"
|
|
||||||
# make main client config
|
# make main client config
|
||||||
#cat template_config_client.json | grep -v "\/\/ Server IPv4" | jq ".outbounds[].settings.vnext=${vnext} | .outbounds[].streamSettings.realitySettings=${clientRealitySettings} | .routing.rules=${rules}" > config_client.json
|
cat template_config_client.json | jq ".outbounds |= map(if .settings.vnext then .settings.vnext=${vnext} else . end) | .outbounds |= map(if .streamSettings.realitySettings then .streamSettings.realitySettings=${clientRealitySettings} else . end)" > config_client.json
|
||||||
#cat template_config_client.json | grep -v "\/\/ Server IPv4" | jq "if .outbounds[].settings.vnext? then .outbounds[].settings.vnext=${vnext} else . end | if .outbounds[].streamSettings.realitySettings? then .outbounds[].streamSettings.realitySettings=${clientRealitySettings} else . end" > config_client.json
|
|
||||||
#cat template_config_client.json | grep -v "\/\/ Server IPv4" | jq ".outbounds[].settings=(if .settings.vnext? then ${vnext} else .settings end)" > config_client.json
|
|
||||||
cat template_config_client.json | grep -v "\/\/ Server IPv4" | jq ".outbounds |= map(if .settings.vnext then .settings.vnext=${vnext} else . end) | .outbounds[].streamSettings.realitySettings=${clientRealitySettings} | .routing.rules=${rules}" > config_client.json
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
122
template_config_client.json
Normal file
122
template_config_client.json
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
{
|
||||||
|
"log": {
|
||||||
|
"access": "",
|
||||||
|
"error": "",
|
||||||
|
"loglevel": "info"
|
||||||
|
},
|
||||||
|
"inbounds": [
|
||||||
|
{
|
||||||
|
"tag": "socks",
|
||||||
|
"port": 800,
|
||||||
|
"listen": "127.0.0.1",
|
||||||
|
"protocol": "socks",
|
||||||
|
"sniffing": {
|
||||||
|
"enabled": true,
|
||||||
|
"destOverride": [
|
||||||
|
"http",
|
||||||
|
"tls"
|
||||||
|
],
|
||||||
|
"routeOnly": false
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"auth": "noauth",
|
||||||
|
"udp": true,
|
||||||
|
"allowTransparent": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "http",
|
||||||
|
"port": 801,
|
||||||
|
"listen": "127.0.0.1",
|
||||||
|
"protocol": "http",
|
||||||
|
"sniffing": {
|
||||||
|
"enabled": true,
|
||||||
|
"destOverride": [
|
||||||
|
"http",
|
||||||
|
"tls"
|
||||||
|
],
|
||||||
|
"routeOnly": false
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"auth": "noauth",
|
||||||
|
"udp": true,
|
||||||
|
"allowTransparent": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"tag": "proxy",
|
||||||
|
"protocol": "vless",
|
||||||
|
"settings": {
|
||||||
|
"vnext": [
|
||||||
|
{
|
||||||
|
"address": "server_address",
|
||||||
|
"port": 80,
|
||||||
|
"users": [
|
||||||
|
{
|
||||||
|
"id": "client_id",
|
||||||
|
"alterId": 0,
|
||||||
|
"email": "client_email",
|
||||||
|
"security": "auto",
|
||||||
|
"encryption": "none",
|
||||||
|
"flow": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "grpc",
|
||||||
|
"security": "reality",
|
||||||
|
"realitySettings": {
|
||||||
|
"serverName": "www.yahoo.com",
|
||||||
|
"fingerprint": "chrome",
|
||||||
|
"show": false,
|
||||||
|
"publicKey": "public_key",
|
||||||
|
"shortId": "short_id",
|
||||||
|
"spiderX": ""
|
||||||
|
},
|
||||||
|
"grpcSettings": {
|
||||||
|
"serviceName": "",
|
||||||
|
"multiMode": false,
|
||||||
|
"idle_timeout": 60,
|
||||||
|
"health_check_timeout": 20,
|
||||||
|
"permit_without_stream": false,
|
||||||
|
"initial_windows_size": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mux": {
|
||||||
|
"enabled": false,
|
||||||
|
"concurrency": -1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "direct",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "block",
|
||||||
|
"protocol": "blackhole",
|
||||||
|
"settings": {
|
||||||
|
"response": {
|
||||||
|
"type": "http"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"routing": {
|
||||||
|
"domainStrategy": "AsIs",
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"inboundTag": [
|
||||||
|
"api"
|
||||||
|
],
|
||||||
|
"outboundTag": "api",
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
87
template_config_server.json
Normal file
87
template_config_server.json
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
{
|
||||||
|
"log": {
|
||||||
|
"access": "/var/log/xray/access.log",
|
||||||
|
"error": "/var/log/xray/error.log",
|
||||||
|
"loglevel": "info"
|
||||||
|
},
|
||||||
|
"routing": {
|
||||||
|
"domainStrategy": "IPIfNonMatch",
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"port": "80",
|
||||||
|
"network": "udp",
|
||||||
|
"outboundTag": "block"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"ip": [
|
||||||
|
"geoip:private"
|
||||||
|
],
|
||||||
|
"outboundTag": "block"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"inbounds": [
|
||||||
|
{
|
||||||
|
"listen": "0.0.0.0",
|
||||||
|
"port": 80,
|
||||||
|
"protocol": "vless",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"id": "client_id",
|
||||||
|
"email": "client_email",
|
||||||
|
"flow": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"decryption": "none"
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "grpc",
|
||||||
|
"security": "reality",
|
||||||
|
"realitySettings": {
|
||||||
|
"show": false,
|
||||||
|
"dest": "www.yahoo.com:443",
|
||||||
|
"xver": 0,
|
||||||
|
"serverNames": [
|
||||||
|
"www.yahoo.com"
|
||||||
|
],
|
||||||
|
"privateKey": "private_key",
|
||||||
|
"shortIds": [
|
||||||
|
"short_id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"grpcSettings": {
|
||||||
|
"serviceName": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sniffing": {
|
||||||
|
"enabled": true,
|
||||||
|
"destOverride": [
|
||||||
|
"http",
|
||||||
|
"tls",
|
||||||
|
"quic"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"protocol": "freedom",
|
||||||
|
"tag": "direct"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"protocol": "blackhole",
|
||||||
|
"tag": "block"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"policy": {
|
||||||
|
"levels": {
|
||||||
|
"0": {
|
||||||
|
"handshake": 2,
|
||||||
|
"connIdle": 120
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user