Skip to content

Packetify/ipcalc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)
}

About

IP Calculator Package Written in Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages