addrportxor

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidKeyLength = errors.New("invalid key length")
	ErrInvalidKey       = errors.New("invalid key")
)

Functions

func Encode

func Encode(addrPort string, xorBytes uint16, xorKey []byte) (net.IP, error)

Encode encodes the given address, port and XOR encryption details in an IPv6 formatted slice of bytes.

Types

type DecodedAddrPortXOR

type DecodedAddrPortXOR struct {
	AddrPort netip.AddrPort
	XORBytes uint16
	XORKey   []byte
}

DecodedAddrPortXOR is used by the Decode function to encapsulate the returned values.

func Decode

func Decode(ip net.IP) (*DecodedAddrPortXOR, error)

Decode assumes an IPv4 address and port, along with a 16-bit integer and a 1-4 bytes long key, has been encoded within the IPv6 address. It returns a netip.AddrPort with the information and the XOR bytes and key.

Jump to

Keyboard shortcuts

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