packages: drop unused function

This commit is contained in:
2025-12-05 01:31:36 +08:00
parent 18e18ebc24
commit e296f09a77

View File

@@ -148,33 +148,4 @@ inputs: rec
fromYaml = content: builtins.fromJSON (builtins.readFile
(inputs.pkgs.runCommand "toJSON" {}
"${inputs.pkgs.yj}/bin/yj < ${builtins.toFile "content.yaml" content} > $out"));
aes128CfbHex = { data, key, iv }:
let
keyFile = builtins.toFile "aes128cfb-key" key;
ivFile = builtins.toFile "aes128cfb-iv" iv;
dataFile = builtins.toFile "aes128cfb-data" data;
openssl = "${inputs.pkgs.openssl}/bin/openssl";
xxd = "${inputs.pkgs.xxd}/bin/xxd";
tr = "${inputs.pkgs.coreutils}/bin/tr";
encryptedFile = inputs.pkgs.runCommand "aes128cfb-encrypted" {}
''
${inputs.pkgs.openssl}/bin/openssl enc -aes-128-cfb -nosalt -in ${dataFile} -out $out \
-K $(${xxd} -p ${keyFile} | ${tr} -d '\n') -iv $(${xxd} -p ${ivFile} | ${tr} -d '\n')
'';
hexEncryptedFile = inputs.pkgs.runCommand "aes128cfb-hex-encrypted" {}
"${xxd} -p ${encryptedFile} | ${tr} -d '\n' > $out";
in builtins.readFile hexEncryptedFile;
webvpnPath = hostname:
let
paddedLength = ((builtins.div ((builtins.stringLength hostname) - 1) 16) + 1) * 16;
paddedString = builtins.concatStringsSep ""
(builtins.genList
(n: if n < builtins.stringLength hostname then builtins.substring n 1 hostname else "0")
paddedLength);
paddedHex = aes128CfbHex
{ data = hostname; key = "wrdvpnisthebest!"; iv = "wrdvpnisthebest!"; };
prefix = builtins.concatStringsSep "" (builtins.map
(c: inputs.pkgs.lib.toHexString (inputs.pkgs.lib.strings.charToInt c))
(inputs.pkgs.lib.stringToCharacters "wrdvpnisthebest!"));
in "/https/${prefix}${paddedHex}";
}