hostname function

LivrRule hostname(
  1. List<Object?> args,
  2. RuleContext context
)

hostname: the value must be a host name (RFC 1123): labels of 1-63 letters, digits and -, not starting or ending with -, separated by ., at most 253 characters, no trailing dot. A single label like localhost passes. The last label is not all digits, so an IPv4 address is not a host name. The output is the value as a string.

Implementation

LivrRule hostname(List<Object?> args, RuleContext context) {
  if (args.isNotEmpty) {
    throw const LivrSchemaException('Rule [hostname] takes no arguments');
  }
  return _hostname;
}