Categorygithub.com/ilijamt/netprivate
modulepackage
1.0.0
Repository: https://github.com/ilijamt/netprivate.git
Documentation: pkg.go.dev

# README

netprivate

Build Status Go Report Card PkgGoDev

A simple library that helps you check if an IP address is in the private defined range of the network.

The library works with:

  • IPv4
  • IPv6

Example usage

if netprivate.Is(net.ParseIP("127.0.0.1")) {
    fmt.Println("this is a private network IP address")
}

# Packages

No description provided by the author

# Functions

Is checks if the net.IP supplied is part of the private IPv4 or IPv6 networks, it does this by testing the net.IP if it's IPv4 first and if it is, calls IsV4 otherwise it calls IsV6.
IsV4 checks if the net.IP supplied is part of the private IPv4 networks.
IsV6 checks if the net.IP supplied is part of the private IPv6 networks.