Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

README.md

Go IPGen Library

Official implementation of the IPGen Spec in Go

IPGen is a library for generating unique and reproducible IP addresses in Go. The IP addresses generated by this library are highly unique (depending on your subnet prefix), yet if you pass it the same input it will produce the same IP address. You can also generate the IP addresses using our command line tool.

Usage

Using this library couldn't be simpler. It only exposes two functions, IP for generating IP addresses and Subnet for generating IPv6 subnet IDs.

Use it in your program as follows:-

package main

import (
  "fmt"
  "github.com/ipgen/go"
)

fn main() {
  // Compute subnet ID
  subnet := ipgen.Subnet("App 1") 
  fmt.Println("%s", subnet) // output: ba3d
  
  // Or compute an IPv6 address
  // Note you can also pass in an IPv4 network to generate an IPv4
  ip, err := ipgen.IP("App 1", "fd52:f6b0:3162::/48")
  if err != nil {
    // Handle your error here
    // An error here means your network address is not valid
  }
  fmt.Println("%s", ip) // output: fd52:f6b0:3162:46a1:2a4f:89e8:8aed:1327
}

About

Official implementation of the IPGen Spec in Go

Resources

License

Releases

No releases published

Packages

No packages published

Languages