Skip to content
Golang ipFormatting functions
Go
Branch: master
Clone or download
Pull request Compare This branch is even with buffalo-news:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
ip.go
ipv4.go
ipv6.go
readme.md

readme.md

GoDoc

Golang ip Formatting functions

All methods are fairly self explanatory, and reading the godoc page should explain everything. If something isn't clear, open an issue or submit a pull request.

Example

First, ensure the library is installed and up to date by running go get -u github.com/buffalo-news/ipFormat.

package main

import (
	"fmt"

	"github.com/buffalo-news/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)
}
You can’t perform that action at this time.