diff options
| author | Alejandro Soto <alejandro@34project.org> | 2024-08-04 17:21:29 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2024-08-04 17:22:49 -0600 |
| commit | 3d516a3ca45ea1745467d61fe8c4ba155bf75756 (patch) | |
| tree | d9d56a8a581e4c81ba14f46986f677c2ddf9551a /sys/ns/rr.nix | |
| parent | fef4cafe585eae8778dfa227130e780abdf839cb (diff) | |
sys/ns: implement SRV records
Diffstat (limited to 'sys/ns/rr.nix')
| -rw-r--r-- | sys/ns/rr.nix | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/sys/ns/rr.nix b/sys/ns/rr.nix index f1c6aca..3ccbd55 100644 --- a/sys/ns/rr.nix +++ b/sys/ns/rr.nix @@ -37,12 +37,13 @@ in }); }; - rrConfig = { rrs, type, format }: (map + rrConfig = { rrs, type, format, applyName ? (rr: rr.name) }: (map (rr: { inherit type; - inherit (rr) name ttl; + inherit (rr) ttl; data = format rr; + name = applyName rr; }) rrs); in @@ -168,6 +169,30 @@ in host = nameOption; }; + srv = rrType { + host = nameOption; + + port = mkOption { + type = port; + }; + + priority = mkOption { + type = int; + }; + + proto = mkOption { + type = enum [ "tcp" "udp" ]; + }; + + service = mkOption { + type = str; + }; + + weight = mkOption { + type = int; + }; + }; + txt = rrType { text = mkOption { type = strMatching "[^\"\n\\]*\n?"; @@ -235,6 +260,14 @@ in }) (rrConfig { + rrs = config.srv; + type = "SRV"; + + format = rr: [ rr.priority rr.weight rr.port rr.host ]; + applyName = rr: "_${rr.service}._${rr.proto}.${rr.name}"; + }) + + (rrConfig { rrs = config.txt; type = "TXT"; |
