Skip to content

SVCB+HTTPS: Add more parameters, optional name fixup #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dns/types/records/HTTPS.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
args: import ./SVCB.nix args // {
args@{lib, ...}: import ./SVCB.nix args // {
rtype = "HTTPS";
nameFixup = name: self: if self.port == null || self.port == 443 then name else "_${self.port}._https.${name}";
}
28 changes: 28 additions & 0 deletions dns/types/records/SVCB.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ let
isInt
isList
mapAttrsToList
mkEnableOption
mkOption
types
;
Expand Down Expand Up @@ -75,6 +76,29 @@ in
type = types.nullOr types.str;
default = null;
};
dohpath = mkOption {
example = "/dns-query{?dns}";
type = types.nullOr types.str;
default = null;
};
tls-supported-groups = mkOption {
example = [ 23 29 ];
default = null;
type = types.nullOr (types.nonEmptyListOf types.int.u16);
};
ohttp = mkOption {
example = true;
default = false;
type = types.bool;
};

# For when the AttrLeaf convention is required
nodeServiceName = mkOption {
example = "_8443._https"
description = "If the protocol requires the underscored node name prefix specified in RFC 8552, the node name to use";
type = types.nullOr types.strMatching "^_(.+)";
default = null;
};
};
dataToString = { svcPriority, targetName, mandatory ? null, alpn ? null, no-default-alpn ? null, port ? null, ipv4hint ? null, ipv6hint ? null, ech ? null, ... }:
"${toString svcPriority} ${targetName} ${
Expand All @@ -87,7 +111,11 @@ in
mandatory
no-default-alpn
port
dohpath
tls-supported-groups
ohttp
;
}
}";
nameFixup = name: self: if (self.nodeServiceName != null) then "${self.nodeServiceName}.${name}" else name;
}