krebs.types.{hostname,label}: check RFC952

This commit is contained in:
tv 2016-02-07 05:08:32 +01:00
parent 02c1f8d270
commit 52fd80748d

View File

@ -175,8 +175,6 @@ types // rec {
addr = str;
addr4 = str;
addr6 = str;
hostname = str;
label = str;
krebs.file-location = types.submodule {
options = {
@ -195,6 +193,22 @@ types // rec {
};
};
# RFC952, B. Lexical grammar, <hname>
hostname = mkOptionType {
name = "hostname";
check = x: all label.check (splitString "." x);
merge = mergeOneOption;
};
# RFC952, B. Lexical grammar, <name>
# RFC1123, 2.1 Host Names and Numbers
label = mkOptionType {
name = "label";
# TODO case-insensitive labels
check = x: match "[0-9A-Za-z]([0-9A-Za-z-]*[0-9A-Za-z])?" x != null;
merge = mergeOneOption;
};
# POSIX.12013, 3.278 Portable Filename Character Set
filename = mkOptionType {
name = "POSIX filename";