Help us shape the future of Go! Take the 2026 Go Developer Survey

fqdn

package module
v0.0.0-...-3fd8f7d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2019 License: GPL-3.0 Imports: 3 Imported by: 0

README

go-fqdn

Golang FQDN Factory/Parser Reference

Synopsis

The intent behind go-fqdn is to offer easy facilities to verify candidate FQDN byte sequences are compliant with one or more RFC-based standards. At this time go-comply/comply only offers RFC 1034 compliance checks, with at least one more RFC planned for release someday. Thus, this package shall stay under the terms supported by go-comply/comply.

Basic Example

package main

import (
    "fmt"
    "github.com/subcon42/go-fqdn"
)

func main() {

    // Begin crafting our potential FQDN ...
    raw := fqdn.NewFQDN(fqdn.NewLabel(`www`), fqdn.NewLabel(`example`), fqdn.NewLabel(`com`))

    // Evaluate compliance result
    if compliant, err := fqdn.RFC1034Compliant(raw); err != nil {
        fmt.Println(err)
    } else {
        fmt.Printf("Is your hostname RFC 1034 Compliant? %t\n", compliant)
    }

}

Credit

Created and maintained by Jesse Coretta (subcon42)

Documentation

Overview

Package fqdn is an experimental, early-stage hostname compliancy checker which leverages the go-comply/comply suite of RFC compliance tools.

Synopsis

The intent behind go-fqdn is to offer easy facilities to verify candidate FQDN byte sequences are compliant with one or more RFC-based standards. At this time go-comply/comply only offers RFC 1034 compliance checks, with at least one more RFC planned for release someday. Thus, this package shall stay under the terms supported by go-comply/comply.

Basic Example

 package main

 import (
    "fmt"
    "github.com/subcon42/go-fqdn"
 )

 func main() {

    // Begin crafting our potential FQDN ...
	raw := fqdn.NewFQDN(fqdn.NewLabel(`www`), fqdn.NewLabel(`example`), fqdn.NewLabel(`com`))

    // Evaluate compliance result
    if compliant, err := fqdn.RFC1034Compliant(raw); err != nil {
        fmt.Println(err)
    } else {
        fmt.Printf("Is your hostname RFC 1034 Compliant? %t\n", compliant)
    }

 }

Credit

Created and maintained by Jesse Coretta (subcon42)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompliancyReport

func CompliancyReport(f [][]uint8)

CompliancyReport shall query go-comply/comply's Compliance Machine instance and execute all available Imperative functions for all listed sections. It is up to the user as to whether the final results truly constitute "failure".

Note this is a print-only method, nothing is returned. If returns are needed for evaluative reasons, use the RFC<XXXX>Compliant() methods instead.

func NewFQDN

func NewFQDN(labels ...[]uint8) (FQDN [][]uint8)

NewLabel produces a new GENERIC label array (also known as a "FQDN" or "Absolute Name") in the form of an array of uint8 arrays ([][]uint8). No compliance checks are done, thus one should be highly suspect of this object as-is.

func NewLabel

func NewLabel(label string) (Label []uint8)

NewLabel produces a new GENERIC label(also known as a "domain component") in the form of a uint8 array ([]uint8). No compliance checks are done, thus one should be highly suspect of this object as-is.

func RFC1034Compliant

func RFC1034Compliant(f [][]uint8) (bool, error)

RFC1034Compliant shall query go-comply/comply's Compliance Machine instance and execute all available Imperative functions for all listed sections pertaining to RFC 1034 specifically.

A boolean is returned indicative of compliance. An non-nil error instance is returned when compliance checks fail, or if there was an internal error that prevents evaluation.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL