iptool

package module
v0.0.0-...-c00e863 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Overview

Package iptool provides tools for working with IP addresses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tool

type Tool interface {
	// IsPrivate checks whether the given IP address is private, meaning it's
	// using one of the addresses designated by IANA as not routable on the Internet,
	// or the address of one of the interfaces on the current host.
	//
	// Specifically, it considers an IP private if it matches any of these conditions:
	// - Is an IPv4 special use address as defined in https://tools.ietf.org/html/rfc5735#section-3
	// - Is an IPv6 special use address as defined in https://tools.ietf.org/html/rfc5156
	// - Is an address assigned to any of the current machine's network interfaces
	IsPrivate(addr *net.IPAddr) bool
}

func New

func New() (iptool Tool, includesLocalInterfaces bool)

Create a new Tool instance. Returns a boolean to indicate whether the returned Tool considers local interfaces when checking IsPrivate. On some platforms, it may not be able to find local interfaces, in which case IsPrivate will only check for globally defined private-use networks.

Directories

Path Synopsis
landetect is a program that detects if one or more supplied addresses are private (e.g.
landetect is a program that detects if one or more supplied addresses are private (e.g.

Jump to

Keyboard shortcuts

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