domain

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 3 Imported by: 9

README

domain

GoDoc Version Build Status Go Report Card Codecov

Simple tools for manipulating Domain Names

Documentation

Overview

Package domain contains some nifty tools for manipulating domains and domain names.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddProtocol

func AddProtocol(url string) string

AddProtocol adds a protocol to a URL if it does not already exist. Local domains use http:// and all other domains use https://

func HasProtocol added in v0.0.2

func HasProtocol(url string) bool

HasProtocol returns TRUE if the provided URL includes a protocol string

func IsLocalhost

func IsLocalhost(hostname string) bool

IsLocalhost returns TRUE if the hostname is a local domain

func IsValidHostname added in v0.2.0

func IsValidHostname(hostname string) bool

func NameOnly

func NameOnly(host string) string

NameOnly removes the protocol and port from a hostname

func NotLocalhost added in v0.1.0

func NotLocalhost(hostname string) bool

NotLocalhost returns TRUE if the hostname is NOT a local domain

func NotValidHostname added in v0.2.0

func NotValidHostname(hostname string) bool

func Protocol

func Protocol(hostname string) string

Protocol returns the protocol to use for a given hostname. Local domains return `http://`, while all other domains return `https://`

Types

This section is empty.

Jump to

Keyboard shortcuts

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