Skip to content

bonan/dhcp6rd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dhcp6rd

Library for parsing 6rd options from DHCP and calculating which prefix to assign

See godoc for full documentation

Example usage:

package main

import (
	"github.com/bonan/dhcp6rd"
	"log"
	"net"
)

func main() {
	// Parse option 212 received from dhclient
	opt, err := dhcp6rd.UnmarshalDhclient("0 32 2001:db8:: 192.0.2.1")

	if err != nil {
		log.Fatal(err)
	}

	// Get prefix delegation
	net, err := opt.IPNet(net.ParseIP("192.0.2.200"))

	if err != nil {
		log.Fatal(err)
	}

	// Log the prefix delegation
	log.Printf("Usable 6rd prefix: %v\n", net.String())
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages