ip

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPublicIp

func GetPublicIp() (string, error)

Returns the public IP of the machine running the program.

Makes an external call.

Example:

() -> ("123.456.789.012", nil)

func MaskIp

func MaskIp(
	ip string,
	mask int,
) string

Formats the IP address with the given mask.

Example:

("192.168.1.1", 24) -> "192.168.1.1/24"

func ReadIpFromFile

func ReadIpFromFile(
	path string,
) (string, error)

Reads the first IP address from a file.

Example:

("path/to/file_with_an_ip_address.txt") -> "192.168.1.1"

Assuming the file contains a valid IP address.

Types

This section is empty.

Jump to

Keyboard shortcuts

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