hostname

package
v0.0.0-...-3f873ad Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error() error

func Hostname

func Hostname() string

func Impersonate

func Impersonate(s string) func()

Impersonate eases testing

func IsValid

func IsValid(s string) bool

func OtherNodes

func OtherNodes(nodes []string) []string

OtherNodes returns list of nodes without local hostname

func SetHostnameForGoTest

func SetHostnameForGoTest(s string)

SetHostnameForGoTest can be used during go test to define alternate hostname

Example:

func Test_something(t *testing.T) {
  SetHostnameForGoTest("newhostname")
  defer SetHostnameForGoTest("")
  // test...
}

func StrictHostname

func StrictHostname() (string, error)

StrictHostname is like os.StrictHostname except it returns a lowercased hostname, and it caches the result to avoid repeating syscalls

Types

This section is empty.

Jump to

Keyboard shortcuts

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