mirror of
https://github.com/kp2pml30/dotfiles.git
synced 2026-04-14 14:21:45 +04:00
upd
This commit is contained in:
parent
c2106ca1a6
commit
68a4779107
14 changed files with 364 additions and 61 deletions
|
|
@ -26,29 +26,28 @@ let
|
|||
${pkgs.openssl}/bin/openssl enc -aes-256-cbc -pbkdf2 -iter 1000000 -base64 -d -k "$KP2_DOTFILES_SECRET_KEY" -in "${./secrets.yaml}" | ${pkgs.yq}/bin/yq '.XRAY_UIDS[]' -r
|
||||
'';
|
||||
|
||||
xray-config-pre = builtins.toFile "xray-pre.json" (builtins.readFile ./xray-pre.json);
|
||||
xray-config-post = builtins.toFile "xray-post.json" (builtins.readFile ./xray-post.json);
|
||||
xray-config-base = builtins.toFile "xray.json" (builtins.readFile ./xray.json);
|
||||
|
||||
# Script to generate complete xray configuration
|
||||
generateXrayConfig = pkgs.writeShellScript "generate-xray-config" ''
|
||||
set -euo pipefail
|
||||
|
||||
cat ${xray-config-pre}
|
||||
ALL_IDS="["
|
||||
|
||||
first=true
|
||||
while IFS= read -r uuid; do
|
||||
if [ "$first" = true ]; then
|
||||
first=false
|
||||
else
|
||||
echo ","
|
||||
ALL_IDS="$ALL_IDS,"
|
||||
fi
|
||||
echo " {"
|
||||
echo " \"id\": \"$uuid\","
|
||||
echo " \"flow\": \"xtls-rprx-vision\""
|
||||
echo " }"
|
||||
ALL_IDS="$ALL_IDS{\"id\":\"$uuid\",\"flow\": \"xtls-rprx-vision\"}"
|
||||
done < <(${decryptSecrets})
|
||||
|
||||
cat ${xray-config-post}
|
||||
ALL_IDS="$ALL_IDS]"
|
||||
|
||||
cat "${xray-config-base}" | \
|
||||
jq --argjson val "$ALL_IDS" '.inbounds.[0].settings.clients = $val'
|
||||
'';
|
||||
|
||||
in {
|
||||
|
|
@ -85,6 +84,8 @@ in {
|
|||
chown xray:xray /run/secrets/xray-config.json
|
||||
chmod 440 /run/secrets/xray-config.json
|
||||
'';
|
||||
|
||||
path = [ pkgs.jq ];
|
||||
};
|
||||
|
||||
# Ensure secrets directory exists
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ map $ssl_preread_server_name $name {
|
|||
updates.signal.org updates;
|
||||
updates2.signal.org updates2;
|
||||
|
||||
www.microsoft.com xray-entrypoint;
|
||||
x.kp2pml30.moe xray-entrypoint;
|
||||
pr.kp2pml30.moe signal-proxy;
|
||||
|
||||
|
|
|
|||
103
nix/server/xray-client.json
Normal file
103
nix/server/xray-client.json
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
{
|
||||
"log": {
|
||||
"loglevel": "warning"
|
||||
},
|
||||
"routing": {
|
||||
"domainStrategy": "IPIfNonMatch",
|
||||
"rules": [
|
||||
{
|
||||
"type": "field",
|
||||
"domain": [
|
||||
"regexp:\\.ru$",
|
||||
"regexp:\\.рф$",
|
||||
"domain:vk.com"
|
||||
],
|
||||
"outboundTag": "direct"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"domain": [
|
||||
"geosite:cn",
|
||||
"geosite:private"
|
||||
],
|
||||
"outboundTag": "direct"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"ip": [
|
||||
"geoip:cn",
|
||||
"geoip:ru",
|
||||
"geoip:private"
|
||||
],
|
||||
"outboundTag": "direct"
|
||||
}
|
||||
]
|
||||
},
|
||||
"inbounds": [
|
||||
{
|
||||
"listen": "127.0.0.1",
|
||||
"port": 10808,
|
||||
"protocol": "socks",
|
||||
"settings": {
|
||||
"udp": true
|
||||
},
|
||||
"sniffing": {
|
||||
"enabled": true,
|
||||
"destOverride": [
|
||||
"http",
|
||||
"tls"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"listen": "127.0.0.1",
|
||||
"port": 10809,
|
||||
"protocol": "http",
|
||||
"sniffing": {
|
||||
"enabled": true,
|
||||
"destOverride": [
|
||||
"http",
|
||||
"tls"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"outbounds": [
|
||||
{
|
||||
"protocol": "vless",
|
||||
"settings": {
|
||||
"vnext": [
|
||||
{
|
||||
"address": "x.kp2pml30.moe",
|
||||
"port": 443,
|
||||
"users": [
|
||||
{
|
||||
"id": "",
|
||||
"encryption": "none",
|
||||
"flow": "xtls-rprx-vision"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"network": "tcp",
|
||||
"security": "tls",
|
||||
"tlsSettings": {
|
||||
"serverName": "",
|
||||
"allowInsecure": false,
|
||||
"fingerprint": "chrome"
|
||||
}
|
||||
},
|
||||
"tag": "proxy"
|
||||
},
|
||||
{
|
||||
"protocol": "freedom",
|
||||
"tag": "direct"
|
||||
},
|
||||
{
|
||||
"protocol": "blackhole",
|
||||
"tag": "block"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
"log": {
|
||||
"loglevel": "warning"
|
||||
},
|
||||
"routing": {
|
||||
"domainStrategy": "IPIfNonMatch",
|
||||
"rules": [
|
||||
{
|
||||
"type": "field",
|
||||
"ip": [
|
||||
"geoip:cn"
|
||||
],
|
||||
"outboundTag": "block"
|
||||
}
|
||||
]
|
||||
},
|
||||
"inbounds": [
|
||||
{
|
||||
"listen": "127.0.0.1",
|
||||
"port": 8010,
|
||||
"protocol": "vless",
|
||||
"settings": {
|
||||
"clients": [
|
||||
81
nix/server/xray-reality-client.json
Normal file
81
nix/server/xray-reality-client.json
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
{
|
||||
"log": {
|
||||
"loglevel": "warning"
|
||||
},
|
||||
"inbounds": [
|
||||
{
|
||||
"port": 1080,
|
||||
"listen": "127.0.0.1",
|
||||
"protocol": "socks",
|
||||
"settings": {
|
||||
"udp": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"port": 1081,
|
||||
"listen": "127.0.0.1",
|
||||
"protocol": "http"
|
||||
}
|
||||
],
|
||||
"outbounds": [
|
||||
{
|
||||
"tag": "proxy",
|
||||
"protocol": "vless",
|
||||
"settings": {
|
||||
"vnext": [
|
||||
{
|
||||
"address": "x.kp2pml30.moe",
|
||||
"port": 443,
|
||||
"users": [
|
||||
{
|
||||
"id": "YOUR-UUID-HERE",
|
||||
"encryption": "none",
|
||||
"flow": "xtls-rprx-vision"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"network": "tcp",
|
||||
"security": "reality",
|
||||
"realitySettings": {
|
||||
"show": false,
|
||||
"fingerprint": "chrome",
|
||||
"serverName": "www.microsoft.com",
|
||||
"publicKey": "dRvlorHTupOukJ7aFZNPx-wXUMYJt3GQNrtSjMm9lAg",
|
||||
"shortId": "deadbabe",
|
||||
"spiderX": "/"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "direct",
|
||||
"protocol": "freedom"
|
||||
},
|
||||
{
|
||||
"tag": "block",
|
||||
"protocol": "blackhole"
|
||||
}
|
||||
],
|
||||
"routing": {
|
||||
"domainStrategy": "AsIs",
|
||||
"rules": [
|
||||
{
|
||||
"type": "field",
|
||||
"domain": [
|
||||
"regexp:\\.ru$",
|
||||
"geosite:category-ru",
|
||||
"regexp:\\.рф$",
|
||||
"regexp:(^|\\.)vk\\.com$"
|
||||
],
|
||||
"outboundTag": "block"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"network": "tcp,udp",
|
||||
"outboundTag": "proxy"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
90
nix/server/xray-reality.json
Normal file
90
nix/server/xray-reality.json
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
{
|
||||
"log": {
|
||||
"loglevel": "debug"
|
||||
},
|
||||
"routing": {
|
||||
"domainStrategy": "IPIfNonMatch",
|
||||
"rules": [
|
||||
{
|
||||
"type": "field",
|
||||
"domain": [
|
||||
"regexp:\\.ru$",
|
||||
"regexp:\\.рф$",
|
||||
"domain:vk.com"
|
||||
],
|
||||
"outboundTag": "block"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"ip": [
|
||||
"geoip:cn",
|
||||
"geoip:ru"
|
||||
],
|
||||
"outboundTag": "block"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"network": "tcp,udp",
|
||||
"outboundTag": "direct"
|
||||
}
|
||||
]
|
||||
},
|
||||
"inbounds": [
|
||||
{
|
||||
"listen": "127.0.0.1",
|
||||
"port": 8010,
|
||||
"protocol": "vless",
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"id": "YOUR-UUID-HERE",
|
||||
"flow": "xtls-rprx-vision"
|
||||
}
|
||||
],
|
||||
"decryption": "none"
|
||||
},
|
||||
"streamSettings": {
|
||||
"network": "tcp",
|
||||
"security": "reality",
|
||||
"realitySettings": {
|
||||
"show": true,
|
||||
"dest": "www.microsoft.com:443",
|
||||
"xver": 0,
|
||||
"serverNames": [
|
||||
"www.microsoft.com"
|
||||
],
|
||||
"privateKey": "",
|
||||
"shortIds": [
|
||||
"deadbabe"
|
||||
],
|
||||
"debug": true
|
||||
}
|
||||
},
|
||||
"sniffing": {
|
||||
"enabled": true,
|
||||
"destOverride": [
|
||||
"http",
|
||||
"tls"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"outbounds": [
|
||||
{
|
||||
"protocol": "freedom",
|
||||
"tag": "direct"
|
||||
},
|
||||
{
|
||||
"protocol": "blackhole",
|
||||
"tag": "block"
|
||||
}
|
||||
],
|
||||
"policy": {
|
||||
"levels": {
|
||||
"0": {
|
||||
"handshake": 3,
|
||||
"connIdle": 127
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,36 @@
|
|||
{
|
||||
"log": {
|
||||
"loglevel": "warning"
|
||||
},
|
||||
"routing": {
|
||||
"domainStrategy": "IPIfNonMatch",
|
||||
"rules": [
|
||||
{
|
||||
"type": "field",
|
||||
"domain": [
|
||||
"regexp:\\.ru$",
|
||||
"regexp:\\.рф$",
|
||||
"domain:vk.com"
|
||||
],
|
||||
"outboundTag": "block"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"ip": [
|
||||
"geoip:cn",
|
||||
"geoip:ru"
|
||||
],
|
||||
"outboundTag": "block"
|
||||
}
|
||||
]
|
||||
},
|
||||
"inbounds": [
|
||||
{
|
||||
"listen": "127.0.0.1",
|
||||
"port": 8010,
|
||||
"protocol": "vless",
|
||||
"settings": {
|
||||
"clients": [
|
||||
],
|
||||
"decryption": "none",
|
||||
"fallbacks": [
|
||||
Loading…
Add table
Add a link
Reference in a new issue