Documentation ¶
Index ¶
- Constants
- func Integer(number []byte) (value int)
- type Certificate
- type Date
- type Destination
- func (destination Destination) Base32Address() (str string)
- func (destination Destination) Base64() string
- func (destination Destination) Certificate() (Certificate, error)
- func (destination Destination) PublicKey() (crypto.PublicKey, error)
- func (destination Destination) SigningPublicKey() (crypto.SigningPublicKey, error)
- type Hash
- type KeyCertificate
- func (key_certificate KeyCertificate) ConstructPublicKey(data []byte) (public_key crypto.PublicKey, err error)
- func (key_certificate KeyCertificate) ConstructSigningPublicKey(data []byte) (signing_public_key crypto.SigningPublicKey, err error)
- func (key_certificate KeyCertificate) Data() ([]byte, error)
- func (key_certificate KeyCertificate) PublicKeyType() (pubkey_type int, err error)
- func (key_certificate KeyCertificate) SignatureSize() (size int)
- func (key_certificate KeyCertificate) SigningPublicKeyType() (signing_pubkey_type int, err error)
- type KeysAndCert
- type Lease
- type LeaseSet
- func (lease_set LeaseSet) Destination() (destination Destination, err error)
- func (lease_set LeaseSet) LeaseCount() (count int, err error)
- func (lease_set LeaseSet) Leases() (leases []Lease, err error)
- func (lease_set LeaseSet) NewestExpiration() (oldest Date, err error)
- func (lease_set LeaseSet) OldestExpiration() (earliest Date, err error)
- func (lease_set LeaseSet) PublicKey() (public_key crypto.ElgPublicKey, err error)
- func (lease_set LeaseSet) Signature() (signature Signature, err error)
- func (lease_set LeaseSet) SigningKey() (signing_public_key crypto.SigningPublicKey, err error)
- func (lease_set LeaseSet) Verify() error
- type Mapping
- type MappingValues
- type RouterAddress
- type RouterIdentity
- type RouterInfo
- func (router_info RouterInfo) IdentHash() (h Hash, err error)
- func (router_info RouterInfo) Options() (mapping Mapping)
- func (router_info RouterInfo) PeerSize() int
- func (router_info RouterInfo) Published() (date Date, err error)
- func (router_info RouterInfo) RouterAddressCount() (count int, err error)
- func (router_info RouterInfo) RouterAddresses() (router_addresses []RouterAddress, err error)
- func (router_info RouterInfo) RouterIdentity() (router_identity RouterIdentity, err error)
- func (router_info RouterInfo) Signature() (signature Signature)
- type SessionKey
- type SessionTag
- type Signature
- type String
Constants ¶
const ( CERT_NULL = iota CERT_HASHCASH CERT_HIDDEN CERT_SIGNED CERT_MULTIPLE CERT_KEY )
Certificate Types
const ( KEYCERT_SIGN_DSA_SHA1 = iota KEYCERT_SIGN_P256 KEYCERT_SIGN_P384 KEYCERT_SIGN_P521 KEYCERT_SIGN_RSA2048 KEYCERT_SIGN_RSA3072 KEYCERT_SIGN_RSA4096 KEYCERT_SIGN_ED25519 KEYCERT_SIGN_ED25519PH )
Key Certificate Signing Key Types
const ( KEYCERT_SIGN_DSA_SHA1_SIZE = 128 KEYCERT_SIGN_P256_SIZE = 64 KEYCERT_SIGN_P384_SIZE = 96 KEYCERT_SIGN_P521_SIZE = 132 KEYCERT_SIGN_RSA2048_SIZE = 256 KEYCERT_SIGN_RSA3072_SIZE = 384 KEYCERT_SIGN_RSA4096_SIZE = 512 KEYCERT_SIGN_ED25519_SIZE = 32 KEYCERT_SIGN_ED25519PH_SIZE = 32 )
SigningPublicKey sizes for Signing Key Types
const ( KEYCERT_PUBKEY_SIZE = 256 KEYCERT_SPK_SIZE = 128 )
Sizes of structures in KeyCertificates
const ( KEYS_AND_CERT_PUBKEY_SIZE = 256 KEYS_AND_CERT_SPK_SIZE = 128 KEYS_AND_CERT_MIN_SIZE = 387 KEYS_AND_CERT_DATA_SIZE = 384 )
Sizes of various KeysAndCert structures and requirements
const ( LEASE_SIZE = 44 LEASE_HASH_SIZE = 32 LEASE_TUNNEL_ID_SIZE = 4 )
Sizes or various components of a Lease
const ( LEASE_SET_PUBKEY_SIZE = 256 LEASE_SET_SPK_SIZE = 128 LEASE_SET_SIG_SIZE = 40 )
Sizes of various structures in an I2P LeaseSet
const (
CERT_MIN_SIZE = 3
)
Minimum size of a valid Certificate
const (
INTEGER_SIZE = 8
)
Total byte length of an I2P integer
const (
KEYCERT_CRYPTO_ELG = iota
)
Key Certificate Public Key Types
const (
KEYCERT_CRYPTO_ELG_SIZE = 256
)
PublicKey sizes for Public Key Types
const (
ROUTER_ADDRESS_MIN_SIZE = 9
)
Minimum number of bytes in a valid RouterAddress
const (
STRING_MAX_SIZE = 255
)
Maximum number of bytes that can be stored in an I2P string
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Certificate ¶
type Certificate []byte
func ReadCertificate ¶
func ReadCertificate(data []byte) (certificate Certificate, remainder []byte, err error)
Read a Certificate from a slice of bytes, returning any extra data on the end of the slice and any errors if a valid Certificate could not be read.
func (Certificate) Data ¶
func (certificate Certificate) Data() (data []byte, err error)
Return the Certificate data and any errors encountered parsing the Certificate.
func (Certificate) Length ¶
func (certificate Certificate) Length() (length int, err error)
Look up the length of the Certificate, reporting errors if the certificate is shorter than the minimum certificate size or if the reported length doesn't match the provided data.
func (Certificate) Type ¶
func (certificate Certificate) Type() (cert_type int, err error)
Return the Certificate Type specified in the first byte of the Certificate, and an error if the certificate is shorter than the minimum certificate size.
type Destination ¶
type Destination []byte
A Destination is a KeysAndCert with functionallity for generating base32 and base64 addresses.
func ReadDestination ¶
func ReadDestination(data []byte) (destination Destination, remainder []byte, err error)
func (Destination) Base32Address ¶
func (destination Destination) Base32Address() (str string)
Generate the I2P base32 address for this Destination.
func (Destination) Base64 ¶
func (destination Destination) Base64() string
Generate the I2P base64 address for this Destination.
func (Destination) Certificate ¶
func (destination Destination) Certificate() (Certificate, error)
func (Destination) SigningPublicKey ¶
func (destination Destination) SigningPublicKey() (crypto.SigningPublicKey, error)
type KeyCertificate ¶
type KeyCertificate []byte
func (KeyCertificate) ConstructPublicKey ¶
func (key_certificate KeyCertificate) ConstructPublicKey(data []byte) (public_key crypto.PublicKey, err error)
Given some bytes, build a PublicKey using any excess data that may be stored in the KeyCertificate and return it along with any errors encountered constructing the PublicKey.
func (KeyCertificate) ConstructSigningPublicKey ¶
func (key_certificate KeyCertificate) ConstructSigningPublicKey(data []byte) (signing_public_key crypto.SigningPublicKey, err error)
Given some bytes, build a SigningPublicKey using any excess data that may be stored in the KeyCertificate and return it along with any errors encountered constructing the SigningPublicKey.
func (KeyCertificate) Data ¶
func (key_certificate KeyCertificate) Data() ([]byte, error)
The data contained in the Key Certificate.
func (KeyCertificate) PublicKeyType ¶
func (key_certificate KeyCertificate) PublicKeyType() (pubkey_type int, err error)
The PublicKey type this Key Certificate describes and any errors encountered parsing this KeyCertificate.
func (KeyCertificate) SignatureSize ¶
func (key_certificate KeyCertificate) SignatureSize() (size int)
Return the size of a Signature corresponding to the Key Certificate's SigningPublicKey type.
func (KeyCertificate) SigningPublicKeyType ¶
func (key_certificate KeyCertificate) SigningPublicKeyType() (signing_pubkey_type int, err error)
The SigningPublicKey type this Key Certificate describes and any errors encountered parsing the KeyCertificate.
type KeysAndCert ¶
type KeysAndCert []byte
func ReadKeysAndCert ¶
func ReadKeysAndCert(data []byte) (keys_and_cert KeysAndCert, remainder []byte, err error)
Read a KeysAndCert from a slice of bytes, retuning it and the remaining data as well as any errors encoutered parsing the KeysAndCert.
func (KeysAndCert) Certificate ¶
func (keys_and_cert KeysAndCert) Certificate() (cert Certificate, err error)
Return the Certificate contained in the KeysAndCert and any errors encountered while parsing the KeysAndCert or Certificate.
func (KeysAndCert) PublicKey ¶
func (keys_and_cert KeysAndCert) PublicKey() (key crypto.PublicKey, err error)
Return the PublicKey for this KeysAndCert, reading from the Key Certificate if it is present to determine correct lengths.
func (KeysAndCert) SigningPublicKey ¶
func (keys_and_cert KeysAndCert) SigningPublicKey() (signing_public_key crypto.SigningPublicKey, err error)
Return the SigningPublicKey for this KeysAndCert, reading from the Key Certificate if it is present to determine correct lengths.
type Lease ¶
type Lease [LEASE_SIZE]byte
func (Lease) TunnelGateway ¶
Return the first 32 bytes of the Lease as a Hash.
type LeaseSet ¶
type LeaseSet []byte
func (LeaseSet) Destination ¶
func (lease_set LeaseSet) Destination() (destination Destination, err error)
Read a Destination from the LeaseSet.
func (LeaseSet) LeaseCount ¶
Return the number of Leases specified by the LeaseCount value in this LeaseSet.
func (LeaseSet) Leases ¶
Read the Leases in this LeaseSet, returning a partial set if there is insufficient data.
func (LeaseSet) NewestExpiration ¶
Return the oldest date from all the Leases in the LeaseSet.
func (LeaseSet) OldestExpiration ¶
Return the oldest date from all the Leases in the LeaseSet.
func (LeaseSet) PublicKey ¶
func (lease_set LeaseSet) PublicKey() (public_key crypto.ElgPublicKey, err error)
Return the PublicKey in this LeaseSet and any errors ancountered parsing the LeaseSet.
func (LeaseSet) Signature ¶
Return the Signature data for the LeaseSet, as specified in the Destination's Key Certificate if present or the 40 bytes following the Leases.
func (LeaseSet) SigningKey ¶
func (lease_set LeaseSet) SigningKey() (signing_public_key crypto.SigningPublicKey, err error)
Return the SigningPublicKey, as specified in the LeaseSet's Destination's Key Certificate if present, or a legacy DSA key.
type Mapping ¶
type Mapping []byte
func GoMapToMapping ¶
Convert a Go map of unformatted strings to a sorted Mapping.
func ValuesToMapping ¶
func ValuesToMapping(values MappingValues) (mapping Mapping)
Convert a MappingValue struct to a Mapping. The values are first sorted in the order defined in mappingOrder.
func (Mapping) HasDuplicateKeys ¶
Return true if two keys in a mapping are identical.
func (Mapping) Values ¶
func (mapping Mapping) Values() (map_values MappingValues, errs []error)
Returns the values contained in a Mapping in the form of a MappingValues.
type RouterAddress ¶
type RouterAddress []byte
func ReadRouterAddress ¶
func ReadRouterAddress(data []byte) (router_address RouterAddress, remainder []byte, err error)
Given a slice of bytes, read a RouterAddress, returning the remaining bytes and any errors encountered parsing the RouterAddress.
func (RouterAddress) Cost ¶
func (router_address RouterAddress) Cost() (cost int, err error)
Return the cost integer for this RouterAddress and any errors encountered parsing the RouterAddress.
func (RouterAddress) Expiration ¶
func (router_address RouterAddress) Expiration() (date Date, err error)
Return the Date this RouterAddress expires and any errors encountered parsing the RouterAddress.
func (RouterAddress) Options ¶
func (router_address RouterAddress) Options() (mapping Mapping, err error)
Return the Mapping containing the options for this RouterAddress and any errors encountered parsing the RouterAddress.
func (RouterAddress) TransportStyle ¶
func (router_address RouterAddress) TransportStyle() (str String, err error)
Return the Transport type for this RouterAddress and any errors encountered parsing the RouterAddress.
type RouterIdentity ¶
type RouterIdentity []byte
A RouterIdentity is identical to KeysAndCert.
func ReadRouterIdentity ¶
func ReadRouterIdentity(data []byte) (router_identity RouterIdentity, remainder []byte, err error)
func (RouterIdentity) Certificate ¶
func (router_identity RouterIdentity) Certificate() (Certificate, error)
func (RouterIdentity) PublicKey ¶
func (router_identity RouterIdentity) PublicKey() (crypto.PublicKey, error)
func (RouterIdentity) SigningPublicKey ¶
func (router_identity RouterIdentity) SigningPublicKey() (crypto.SigningPublicKey, error)
type RouterInfo ¶
type RouterInfo []byte
func (RouterInfo) IdentHash ¶
func (router_info RouterInfo) IdentHash() (h Hash, err error)
Calculate this RouterInfo's Identity Hash (the sha256 of the RouterIdentity) returns error if the RouterIdentity is malformed
func (RouterInfo) Options ¶
func (router_info RouterInfo) Options() (mapping Mapping)
Return the Options Mapping inside this RouterInfo.
func (RouterInfo) PeerSize ¶
func (router_info RouterInfo) PeerSize() int
Return the PeerSize value, currently unused and always zero.
func (RouterInfo) Published ¶
func (router_info RouterInfo) Published() (date Date, err error)
Return the Date the RouterInfo was published and any errors encountered parsing the RouterInfo.
func (RouterInfo) RouterAddressCount ¶
func (router_info RouterInfo) RouterAddressCount() (count int, err error)
Return the Integer representing the number of RouterAddresses that are contained in this RouterInfo.
func (RouterInfo) RouterAddresses ¶
func (router_info RouterInfo) RouterAddresses() (router_addresses []RouterAddress, err error)
Read the RouterAddresses inside this RouterInfo and return them in a slice, returning a partial list if data is missing.
func (RouterInfo) RouterIdentity ¶
func (router_info RouterInfo) RouterIdentity() (router_identity RouterIdentity, err error)
Read a RouterIdentity from the RouterInfo, returning the RouterIdentity and any errors encountered parsing the RouterIdentity.
func (RouterInfo) Signature ¶
func (router_info RouterInfo) Signature() (signature Signature)
Return the 40 bytes that follow the Mapping in the RouterInfo.
type SessionKey ¶
type SessionKey [32]byte
type SessionTag ¶
type SessionTag [32]byte
type String ¶
type String []byte
func ReadString ¶
Read a string from a slice of bytes, returning any extra data on the end of the slice and any errors encountered parsing the String.
func ToI2PString ¶
This function takes an unformatted Go string and returns a String and any errors encountered during the encoding.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
base32 encoding using I2P's alphabet
|
base32 encoding using I2P's alphabet |
base64 encoding using I2P's alphabet
|
base64 encoding using I2P's alphabet |
fuzz
|
|