net

package
v0.0.0-...-d31700d Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func IPsOfLocalhost

func IPsOfLocalhost() ([]string, error)

func IsLocalhost

func IsLocalhost(addr string) (bool, error)
Example
fmt.Println(IsLocalhost("127.0.0.1"))
fmt.Println(IsLocalhost("127.1.0.1"))
addrs, err := IPsOfLocalhost()
// fmt.Println(addrs)
fmt.Println(err)
last := addrs[len(addrs)-1]
fmt.Println(IsLocalhost(last))
fmt.Println(IsLocalhost("1.1.1.1"))
Output:

true <nil>
true <nil>
<nil>
true <nil>
false <nil>

Types

This section is empty.

Jump to

Keyboard shortcuts

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