discover

package
Version: v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseIPv4FromBody

func ParseIPv4FromBody(in io.Reader) (net.IP, error)

ParseIPv4FromBody reads from a reader (such as an http.Body) and tries to parse the IPv4 IP address contained therein.

func PrivateIPv4DiscovererOption

func PrivateIPv4DiscovererOption(f func() (net.IP, error)) func(*DiscovererOptions)

PrivateIPv4DiscovererOption retuns a DiscovererOption which sets the Private IPv4 address discovery function.

func PublicHostnameDiscovererOption

func PublicHostnameDiscovererOption(f func() (string, error)) func(*DiscovererOptions)

PublicHostnameDiscovererOption returns a DiscovererOption which sets the Public Hostname discovery function.

func PublicIPv4DiscovererOption

func PublicIPv4DiscovererOption(f func() (net.IP, error)) func(*DiscovererOptions)

PublicIPv4DiscovererOption returns a DiscovererOption which sets the Public IPv4 address discovery function.

func PublicIPv6DiscovererOption

func PublicIPv6DiscovererOption(f func() (net.IP, error)) func(*DiscovererOptions)

PublicIPv6DiscovererOption returns a DiscovererOption which sets the Public IPv6 address discovery function.

func StandardHostnameFromHTTP

func StandardHostnameFromHTTP(url string, headers map[string]string) (string, error)

StandardHostnameFromHTTP queries an HTTP URL and returns the hostname contained within its response. Headers are optional.

func StandardIPFromHTTP

func StandardIPFromHTTP(url string, headers map[string]string) (net.IP, error)

StandardIPFromHTTP queries an HTTP URL and returns the IP address contained within its response. Headers are optional.

Types

type Discoverer

type Discoverer interface {

	// Hostname returns the public hostname.
	Hostname() (string, error)

	// PrivateIPv4 returns the private IPv4 address.
	PrivateIPv4() (net.IP, error)

	// PublicIPv4 returns the public IPv4 address.
	PublicIPv4() (net.IP, error)

	// PublicIPv6 returns the public IPv6 address.
	PublicIPv6() (net.IP, error)
}

Discoverer describes an interface by which network details may be discovered

func NewAWSDiscoverer

func NewAWSDiscoverer() Discoverer

NewAWSDiscoverer returns a new Amazon Web Services network discoverer

func NewAzureDiscoverer

func NewAzureDiscoverer() Discoverer

NewAzureDiscoverer returns a new Google Cloud Platform network discoverer

func NewDigitalOceanDiscoverer

func NewDigitalOceanDiscoverer() Discoverer

NewDigitalOceanDiscoverer returns a new Digital Ocean network discoverer

func NewDiscoverer

func NewDiscoverer(opts ...DiscovererOption) Discoverer

NewDiscoverer creates a new network discoverer

func NewGCPDiscoverer

func NewGCPDiscoverer() Discoverer

NewGCPDiscoverer returns a new Google Cloud Platform network discoverer

type DiscovererOption

type DiscovererOption func(o *DiscovererOptions)

DiscovererOption is a function which configures a GenericDiscoverer.

type DiscovererOptions

type DiscovererOptions struct {
	// contains filtered or unexported fields
}

DiscovererOptions describes the options used to construct a generic discoverer.

Jump to

Keyboard shortcuts

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