Skip to content

Calculation MAP-E(RFC7597) IPv6 address from IPv4 address + port, or IPv4 address + port range from IPv6 address

License

Notifications You must be signed in to change notification settings

skubota/mapcalc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)
}

About

Calculation MAP-E(RFC7597) IPv6 address from IPv4 address + port, or IPv4 address + port range from IPv6 address

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages