mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-11 17:09:22 +08:00
packages: drop unused function
This commit is contained in:
@@ -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}";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user