Skip to content

Latest commit

 

History

History
executable file
·
57 lines (43 loc) · 1.32 KB

Readme.md

File metadata and controls

executable file
·
57 lines (43 loc) · 1.32 KB

Package mapcalc is map-e/t calculator

DESCRIPTION

MAP is RFC7597 mechanism Mapping of Address and Port with Encapsulation (MAP-E) https://tools.ietf.org/html/rfc7597

GoDev Go

usage

$ go get github.com/skubota/mapcalc

godoc

https://godoc.org/github.com/skubota/mapcalc

sample

package main

import (
        "fmt"
        "github.com/skubota/mapcalc"
)

func main() {
        r := mapcalc.Rules{
                mapcalc.Maprule{
                        Ipv6:   "2001:db8::/32",
                        Ipv4:   "10.0.0.0/16",
                        Ea_length: 24,
                },
                mapcalc.Maprule{
                        Ipv6:   "2001:db9::/32",
                        Ipv4:   "10.1.0.0/16",
                        Ea_length: 24,
                },
                mapcalc.Maprule{
                        Ipv6:   "2001:db10::/32",
                        Ipv4:   "10.2.0.0/16",
                        Ea_length: 24,
                },
        }
        addr, port := mapcalc.Map6to4("2001:db8:0101:0a00::1", r)
        fmt.Printf("Result: %s,%s\n", addr, port)
}