Package written in Golang to process and format ip Addresses to and from ipv4/ipv6. Can also take ranges in cidr notation. The entire projects source code is posted on github.
You can include a package written for Golang projects to quickly get started with a simple function.
go get github.com/silocitylabs/ipFormat
package main
import (
"fmt"
"github.com/silocitylabs/ipFormat"
)
func main() {
ip1, _ := ipFormat.New("192.168.0.2/24")
ip2, _ := ipFormat.New("192.168.0.6")
ip1, _ = ip1.ToV6()
ip2, _ = ip2.ToV6()
fmt.Println(ip1.Address)
fmt.Println(ip1.CIDR)
fmt.Println(ip2.Address)
}