inet256ipv6

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2022 License: GPL-3.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// WorthItBits is the number of leading 0s the address must have
	// for the encoding scheme to be better than just taking the prefix
	WorthItBits = 9

	// PreImageResistance128Bits is the number of leading 0s the address must have
	// for the uncompressed prefix to have 128 bits of preimage resistance.
	PreImageResistance128Bits = 16
)

Variables

This section is empty.

Functions

func AllowAll

func AllowAll(inet256.Addr) bool

func INET256PrefixFromIPv6 added in v0.0.3

func INET256PrefixFromIPv6(x netip.Addr) ([]byte, int, error)

INET256PrefixFromIPv6 returns the a prefix and nbits for passing to FindAddr

func IPv6FromINET256 added in v0.0.3

func IPv6FromINET256(x inet256.Addr) netip.Addr

IPv6FromINET256 returns the IPv6 address corresponding to x. There is only 1 IPv6 per INET256

func MineAddr

func MineAddr(ctx context.Context, r io.Reader, goal int) (inet256.Addr, inet256.PrivateKey, error)

MineAddr repeatedly generates private-keys using entropy from r, derives INET256 addresses from them, and checks how well they compress into the IPv6 mapping. goal is the number of leading 0s to achieve in address before stopping.

func NetworkPrefix added in v0.0.3

func NetworkPrefix() netip.Prefix

NetworkPrefix returns the IPv6 prefix where all INET256 addresses are mapped.

func NewIP6AddrCmd added in v0.0.3

func NewIP6AddrCmd() *cobra.Command

func NewIP6PortalCmd added in v0.0.3

func NewIP6PortalCmd(newNode func(context.Context, inet256.PrivateKey) (inet256.Node, error)) *cobra.Command

func RunPortal

func RunPortal(ctx context.Context, params PortalParams) error

Types

type AllowFunc

type AllowFunc = func(inet256.Addr) bool

func ParseWhitelist added in v0.0.2

func ParseWhitelist(x []byte) (AllowFunc, error)

ParseWhitelist creates an AllowFunc which allows only the addresses listed in x. It expects newline separated base64 encoded INET256 addresses. One per line.

type IPv6Addr

type IPv6Addr = [16]byte

type NATTable

type NATTable struct {
	// contains filtered or unexported fields
}

func NewNATTable

func NewNATTable(srv inet256.Service) *NATTable

func (*NATTable) AddClient

func (nt *NATTable) AddClient(ctx context.Context, ipv6 IPv6Addr) inet256.Addr

func (*NATTable) DeleteClient

func (nt *NATTable) DeleteClient(ctx context.Context, ip6 IPv6Addr)

func (*NATTable) NodeByInner

func (nt *NATTable) NodeByInner(ipv6 IPv6Addr) inet256.Node

func (*NATTable) NodeByOuter

func (nt *NATTable) NodeByOuter(addr inet256.Addr) inet256.Node

type PortalParams

type PortalParams struct {
	Node      inet256.Node
	AllowFunc AllowFunc
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL