dns

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DnsParse

func DnsParse(domain string) ([]string, string, error)

Resolve the DNS domain name

func ParsePort

func ParsePort(target, defaultPort string) (host, port string, err error)

parseTarget takes the user input target string and default port, returns formatted host and port info. If target doesn't specify a port, set the port to be the defaultPort. If target is in IPv6 format and host-name is enclosed in square brackets, brackets are stripped when setting the host. examples: target: "www.google.com" defaultPort: "443" returns host: "www.google.com", port: "443" target: "ipv4-host:80" defaultPort: "443" returns host: "ipv4-host", port: "80" target: "[ipv6-host]" defaultPort: "443" returns host: "ipv6-host", port: "443" target: ":80" defaultPort: "443" returns host: "localhost", port: "80"

Types

type Target

type Target struct {
	Scheme    string
	Authority string
	Endpoint  string
}

func ParseScheme

func ParseScheme(target string) (ret Target)

ParseTarget splits target into a resolver.Target struct containing scheme, authority and endpoint.

If target is not a valid scheme://authority/endpoint, it returns {Endpoint: target}.

Jump to

Keyboard shortcuts

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