mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/phonebox/default.nix
This commit is contained in:
@@ -1,29 +0,0 @@
|
|||||||
nwid:
|
|
||||||
{ pkgs, ... }:
|
|
||||||
let
|
|
||||||
ztInterfaceScript = pkgs.writeShellScript "zt-interface" ''
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
network="$1"
|
|
||||||
index=${"2:-0"}
|
|
||||||
|
|
||||||
network="0x$network"
|
|
||||||
|
|
||||||
# zerotier hash function
|
|
||||||
network=$(( (($network ^ ($network >> (3*8))) + $index ) % (1<<(5*8)) ))
|
|
||||||
|
|
||||||
# encode the result in base32
|
|
||||||
while [ $network -gt 0 ]; do
|
|
||||||
index=$(( $network % (1<<5) + 24 ))
|
|
||||||
[ $index -lt 50 ] && index=$(( $index + 73 ))
|
|
||||||
result="$(printf "\\%03o" $index)$result"
|
|
||||||
network=$(( $network >> 5 ))
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "zt$(printf %b "$result")"
|
|
||||||
'';
|
|
||||||
result = pkgs.runCommand "zt-interface-output" { } ''
|
|
||||||
${ztInterfaceScript} > $out
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
builtins.readFile result
|
|
||||||
@@ -25,7 +25,6 @@
|
|||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
config,
|
config,
|
||||||
pkgs,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
|||||||
Reference in New Issue
Block a user