diff options
Diffstat (limited to 'src/util.lisp')
-rw-r--r-- | src/util.lisp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util.lisp b/src/util.lisp index 63ca21a..d1658d3 100644 --- a/src/util.lisp +++ b/src/util.lisp @@ -399,6 +399,17 @@ expansion as a starting point for your own DEFPACKAGE form for your consfig." (with-standard-io-syntax (write object :stream fifo) (terpri fifo) (finish-output fifo))) +(defun valid-hostname-p (string) + "Test whether STRING looks like a valid hostname, as defined by RFCs 952 and +1123." + (and + (<= (length string) 253) + (let ((parts (split-string string :separator "."))) + (every (lambda (part) + (and (<= (length part) 63) + (re:scan "^[a-zA-Z0-9][a-zA-Z0-9-]*$" part))) + parts)))) + ;;;; Progress & debug printing |