ipcalc

module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2021 License: AGPL-3.0

README

ipcalc

IP Calculator Package Written in Go

Install

go get -u github.com/Packetify/ipcalc/ipv4calc

Example

package main

import (
	"fmt"
	"github.com/Packetify/ipcalc/ipv4calc"
)

func main() {

	myip := ipv4calc.New("192.168.1.102/24")

	brdIP := myip.GetBroadCastIP()
	netIP := myip.GetNetworkAddr()
	
	fmt.Println(myip,brdIP,netIP)
}

package main

import (
	"fmt"
	"net"
	"github.com/Packetify/ipcalc/ipv4calc"
)

func main() {

	ipInfo := net.IPNet{
		IP:   net.IP{192, 168, 1, 1},
		Mask: net.IPMask{255, 255, 255, 0},
	}
	
	myip := ipv4calc.New(ipInfo)

	brdIP := myip.GetBroadCastIP()
	netIP := myip.GetNetworkAddr()
	fmt.Println(myip,brdIP,netIP)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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