Skip to content

Commit

Permalink
[Chore] Add alternative xray endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
rvem committed Nov 28, 2024
1 parent 63d0b64 commit cb1a548
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions servers/mebsuta/xray.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ let
vs = config.vault-secrets.secrets;
dataDir = "/var/lib/xray";
xrayPort = 9433;
xrayPortAlt = 9434;
in
{
networking.firewall.allowedTCPPorts = [
xrayPort
xrayPort xrayPortAlt
];
users.users.xray = {
isSystemUser = true;
Expand Down Expand Up @@ -64,6 +65,36 @@ in
};
};
}
{ port = xrayPortAlt;
protocol = "vless";
tag = "vless-alt";
sniffing = {
enable = true;
destOverrides = ["http" "tls"];
};
settings = {
clients = [
{
id = clientIdPlaceholder;
flow = "xtls-rprx-vision";
}
];
decryption = "none";
};
streamSettings = {
network = "tcp";
security = "reality";
realitySettings = {
show = false;
dest = "vpn.serokell.net:443";
serverNames = [
"vpn.serokell.net"
];
privateKey = privateKeyPlaceholder;
shortIds = [ shortIdPlaceholder ];
};
};
}
];
outbounds = [
{ protocol = "freedom";
Expand Down Expand Up @@ -100,7 +131,7 @@ in
private_key="$(cat "${vs.xray}/private-key")"
client_id="$(cat "${vs.xray}/client-id")"
short_id="$(cat "${vs.xray}/short-id")"
${pkgs.gnused}/bin/sed -i -e "s/${privateKeyPlaceholder}/$private_key/" -e "s/${clientIdPlaceholder}/$client_id/" -e "s/${shortIdPlaceholder}/$short_id/" \
${pkgs.gnused}/bin/sed -i -e "s/${privateKeyPlaceholder}/$private_key/g" -e "s/${clientIdPlaceholder}/$client_id/g" -e "s/${shortIdPlaceholder}/$short_id/g" \
"${config.services.xray.settingsFile}"
'';
serviceConfig = {
Expand Down

0 comments on commit cb1a548

Please sign in to comment.