chmike / domain

Go function to check domain name validity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GoDoc Build codecov Go Report Status release

domain.Check()

This package contains a single function that checks the validity of a host name domain name.

A domain name must respect rules defined in

The domain.Check function ensures that the given host name respect those rules. If not, it returns an error explaining the detected problem.

Prerequisites

The package has no prerequisites and external dependencies.

Installation

To install or update this package use the instruction:

go get github.com/chmike/domain@latest

Usage examples

The Check function can be used to check the validity of host or domain names.

name := "host.example.com"
if err := domain.Check(name); if err != nil {
    log.Fatalf("invalid host name '%s': %v", name, err)
}

About

Go function to check domain name validity

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Go 100.0%