i2pkeys

package
v0.32.32 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2020 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base32

func Base32(anything string) string

Makes any string into a *.b32.i2p human-readable I2P address. This makes no sense, unless "anything" is an I2P destination of some sort.

func StoreKeys added in v0.32.32

func StoreKeys(k I2PKeys, r string) error

func StoreKeysIncompat

func StoreKeysIncompat(k I2PKeys, w io.Writer) (err error)

store keys in non standard format

Types

type I2PAddr

type I2PAddr string

I2PAddr represents an I2P destination, almost equivalent to an IP address. This is the humongously huge base64 representation of such an address, which really is just a pair of public keys and also maybe a certificate. (I2P hides the details of exactly what it is. Read the I2P specifications for more info.)

func FiveHundredAs

func FiveHundredAs() I2PAddr

func NewI2PAddrFromBytes

func NewI2PAddrFromBytes(addr []byte) (I2PAddr, error)

Creates a new I2P address from a byte array. The inverse of ToBytes().

func NewI2PAddrFromString

func NewI2PAddrFromString(addr string) (I2PAddr, error)

Creates a new I2P address from a base64-encoded string. Checks if the address addr is in correct format. (If you know for sure it is, use I2PAddr(addr).)

func (I2PAddr) Base32

func (addr I2PAddr) Base32() (str string)

Returns the *.b32.i2p address of the I2P address. It is supposed to be a somewhat human-manageable 64 character long pseudo-domain name equivalent of the 516+ characters long default base64-address (the I2PAddr format). It is not possible to turn the base32-address back into a usable I2PAddr without performing a Lookup(). Lookup only works if you are using the I2PAddr from which the b32 address was generated.

func (I2PAddr) Base64

func (a I2PAddr) Base64() string

Returns the base64 representation of the I2PAddr

func (I2PAddr) Bytes

func (addr I2PAddr) Bytes() []byte

func (I2PAddr) DestHash

func (addr I2PAddr) DestHash() (h I2PDestHash)

func (I2PAddr) Network

func (a I2PAddr) Network() string

Returns "I2P"

func (I2PAddr) String

func (a I2PAddr) String() string

Returns the I2P destination (base64-encoded)

func (I2PAddr) ToBytes

func (addr I2PAddr) ToBytes() ([]byte, error)

Turns an I2P address to a byte array. The inverse of NewI2PAddrFromBytes().

type I2PDestHash

type I2PDestHash [32]byte

an i2p destination hash, the .b32.i2p address if you will

func DestHashFromString

func DestHashFromString(str string) (dhash I2PDestHash, err error)

create a desthash from a string b32.i2p address

func (I2PDestHash) Hash

func (h I2PDestHash) Hash() string

get base64 representation of i2p dest sha256 hash(the 44-character one)

func (*I2PDestHash) Network

func (h *I2PDestHash) Network() string

Returns "I2P"

func (I2PDestHash) String

func (h I2PDestHash) String() string

get string representation of i2p dest hash(base32 version)

type I2PKeys

type I2PKeys struct {
	Address I2PAddr // only the public key
	Both    string  // both public and private keys
}

The public and private keys associated with an I2P destination. I2P hides the details of exactly what this is, so treat them as blobs, but generally: One pair of DSA keys, one pair of ElGamal keys, and sometimes (almost never) also a certificate. String() returns you the full content of I2PKeys and Addr() returns the public keys.

func LoadKeys added in v0.32.32

func LoadKeys(r string) (I2PKeys, error)

load keys from non-standard format by specifying a text file. If the file does not exist, generate keys, otherwise, fail closed.

func LoadKeysIncompat

func LoadKeysIncompat(r io.Reader) (k I2PKeys, err error)

load keys from non standard format

func NewKeys

func NewKeys(addr I2PAddr, both string) I2PKeys

Creates I2PKeys from an I2PAddr and a public/private keypair string (as generated by String().)

func (I2PKeys) Addr

func (k I2PKeys) Addr() I2PAddr

Returns the public keys of the I2PKeys.

func (I2PKeys) String

func (k I2PKeys) String() string

Returns the keys (both public and private), in I2Ps base64 format. Use this when you create sessions.

Jump to

Keyboard shortcuts

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