mirror of
https://github.com/go-i2p/go-i2p.git
synced 2025-07-13 11:54:46 -04:00
generate godoc locally so I can go over it offline
This commit is contained in:
6
Makefile
6
Makefile
@ -36,3 +36,9 @@ info:
|
||||
|
||||
release:
|
||||
github-release release -u go-i2p -r go-i2p -n "${RELEASE_VERSION}" -t "${RELEASE_TAG}" -d "${RELEASE_DESCRIPTION}" -p
|
||||
|
||||
callvis:
|
||||
go-callvis -format svg -focus upgrade -group pkg,type -limit github.com/go-i2p/go-i2p github.com/go-i2p/go-i2p
|
||||
|
||||
godoc:
|
||||
find lib -type d -exec bash -c "ls {}/*.go && godocdown -o ./{}/doc.md ./{}" \;
|
23
lib/bootstrap/doc.md
Normal file
23
lib/bootstrap/doc.md
Normal file
@ -0,0 +1,23 @@
|
||||
# bootstrap
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/bootstrap"
|
||||
|
||||
provides generic interfaces for initial bootstrap into network and network
|
||||
### reseeding
|
||||
|
||||
## Usage
|
||||
|
||||
#### type Bootstrap
|
||||
|
||||
```go
|
||||
type Bootstrap interface {
|
||||
// get more peers for bootstrap
|
||||
// try obtaining at most n router infos
|
||||
// if n is 0 then try obtaining as many router infos as possible
|
||||
// returns nil and error if we cannot fetch ANY router infos
|
||||
// returns a channel that yields 1 slice of router infos containing n or fewer router infos, caller must close channel after use
|
||||
GetPeers(n int) (chan []router_info.RouterInfo, error)
|
||||
}
|
||||
```
|
||||
|
||||
interface defining a way to bootstrap into the i2p network
|
33
lib/common/base32/doc.md
Normal file
33
lib/common/base32/doc.md
Normal file
@ -0,0 +1,33 @@
|
||||
# base32
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/base32"
|
||||
|
||||
Package base32 implmenets utilities for encoding and decoding text using I2P's
|
||||
### alphabet
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
const I2PEncodeAlphabet = "abcdefghijklmnopqrstuvwxyz234567"
|
||||
```
|
||||
I2PEncodeAlphabet is the base32 encoding used throughout I2P. RFC 3548 using
|
||||
lowercase characters.
|
||||
|
||||
```go
|
||||
var I2PEncoding *b32.Encoding = b32.NewEncoding(I2PEncodeAlphabet)
|
||||
```
|
||||
I2PEncoding is the standard base32 encoding used through I2P.
|
||||
|
||||
#### func DecodeString
|
||||
|
||||
```go
|
||||
func DecodeString(data string) ([]byte, error)
|
||||
```
|
||||
DecodeString decodes base64 string to []byte I2PEncoding
|
||||
|
||||
#### func EncodeToString
|
||||
|
||||
```go
|
||||
func EncodeToString(data []byte) string
|
||||
```
|
||||
EncodeToString encodes []byte to a base32 string using I2PEncoding
|
33
lib/common/base64/doc.md
Normal file
33
lib/common/base64/doc.md
Normal file
@ -0,0 +1,33 @@
|
||||
# base64
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/base64"
|
||||
|
||||
Package base64 implmenets utilities for encoding and decoding text using I2P's
|
||||
### alphabet
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
const I2PEncodeAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-~"
|
||||
```
|
||||
I2PEncodeAlphabet is the base64 encoding used throughout I2P. RFC 4648 with "/""
|
||||
replaced with "~", and "+" replaced with "-".
|
||||
|
||||
```go
|
||||
var I2PEncoding *b64.Encoding = b64.NewEncoding(I2PEncodeAlphabet)
|
||||
```
|
||||
I2PEncoding is the standard base64 encoding used through I2P.
|
||||
|
||||
#### func DecodeString
|
||||
|
||||
```go
|
||||
func DecodeString(str string) ([]byte, error)
|
||||
```
|
||||
DecodeString decodes base64 string to []byte I2PEncoding
|
||||
|
||||
#### func EncodeToString
|
||||
|
||||
```go
|
||||
func EncodeToString(data []byte) string
|
||||
```
|
||||
I2PEncoding is the standard base64 encoding used through I2P.
|
98
lib/common/certificate/doc.md
Normal file
98
lib/common/certificate/doc.md
Normal file
@ -0,0 +1,98 @@
|
||||
# certificate
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/certificate"
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
const (
|
||||
CERT_NULL = iota
|
||||
CERT_HASHCASH
|
||||
CERT_HIDDEN
|
||||
CERT_SIGNED
|
||||
CERT_MULTIPLE
|
||||
CERT_KEY
|
||||
)
|
||||
```
|
||||
Certificate Types
|
||||
|
||||
```go
|
||||
const CERT_MIN_SIZE = 3
|
||||
```
|
||||
CERT_MIN_SIZE is the minimum size of a valid Certificate in []byte 1 byte for
|
||||
type 2 bytes for payload length
|
||||
|
||||
#### type Certificate
|
||||
|
||||
```go
|
||||
type Certificate struct {
|
||||
}
|
||||
```
|
||||
|
||||
Certificate is the representation of an I2P Certificate.
|
||||
|
||||
https://geti2p.net/spec/common-structures#certificate
|
||||
|
||||
#### func NewCertificate
|
||||
|
||||
```go
|
||||
func NewCertificate(data []byte) (certificate Certificate, err error)
|
||||
```
|
||||
NewCertificate creates a new Certficiate from []byte returns err if the
|
||||
certificate is too short or if the payload doesn't match specified length.
|
||||
|
||||
#### func ReadCertificate
|
||||
|
||||
```go
|
||||
func ReadCertificate(data []byte) (certificate Certificate, remainder []byte, err error)
|
||||
```
|
||||
ReadCertificate creates a Certificate from []byte and returns any ExcessBytes at
|
||||
the end of the input. returns err if the certificate could not be read.
|
||||
|
||||
#### func (*Certificate) Bytes
|
||||
|
||||
```go
|
||||
func (c *Certificate) Bytes() []byte
|
||||
```
|
||||
Bytes returns the entire certificate in []byte form, trims payload to specified
|
||||
length.
|
||||
|
||||
#### func (*Certificate) Data
|
||||
|
||||
```go
|
||||
func (c *Certificate) Data() (data []byte)
|
||||
```
|
||||
Data returns the payload of a Certificate, payload is trimmed to the specified
|
||||
length.
|
||||
|
||||
#### func (*Certificate) ExcessBytes
|
||||
|
||||
```go
|
||||
func (c *Certificate) ExcessBytes() []byte
|
||||
```
|
||||
ExcessBytes returns the excess bytes in a certificate found after the specified
|
||||
payload length.
|
||||
|
||||
#### func (*Certificate) Length
|
||||
|
||||
```go
|
||||
func (c *Certificate) Length() (length int)
|
||||
```
|
||||
Length returns the payload length of a Certificate.
|
||||
|
||||
#### func (*Certificate) RawBytes
|
||||
|
||||
```go
|
||||
func (c *Certificate) RawBytes() []byte
|
||||
```
|
||||
RawBytes returns the entire certificate in []byte form, includes excess payload
|
||||
data.
|
||||
|
||||
#### func (*Certificate) Type
|
||||
|
||||
```go
|
||||
func (c *Certificate) Type() (cert_type int)
|
||||
```
|
||||
Type returns the Certificate type specified in the first byte of the
|
||||
Certificate,
|
297
lib/common/data/doc.md
Normal file
297
lib/common/data/doc.md
Normal file
@ -0,0 +1,297 @@
|
||||
# data
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/data"
|
||||
|
||||
Package data implements common data structures used in higher level structures.
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
const DATE_SIZE = 8
|
||||
```
|
||||
DATE_SIZE is the length in bytes of an I2P Date.
|
||||
|
||||
```go
|
||||
const MAX_INTEGER_SIZE = 8
|
||||
```
|
||||
MAX_INTEGER_SIZE is the maximum length of an I2P integer in bytes.
|
||||
|
||||
```go
|
||||
const STRING_MAX_SIZE = 255
|
||||
```
|
||||
STRING_MAX_SIZE is the maximum number of bytes that can be stored in an I2P
|
||||
string
|
||||
|
||||
#### func PrintErrors
|
||||
|
||||
```go
|
||||
func PrintErrors(errs []error)
|
||||
```
|
||||
PrintErrors prints a formatted list of errors to the console.
|
||||
|
||||
#### func WrapErrors
|
||||
|
||||
```go
|
||||
func WrapErrors(errs []error) error
|
||||
```
|
||||
WrapErrors compiles a slice of errors and returns them wrapped together as a
|
||||
single error.
|
||||
|
||||
#### type Date
|
||||
|
||||
```go
|
||||
type Date [8]byte
|
||||
```
|
||||
|
||||
Date is the represenation of an I2P Date.
|
||||
|
||||
https://geti2p.net/spec/common-structures#date
|
||||
|
||||
#### func NewDate
|
||||
|
||||
```go
|
||||
func NewDate(data []byte) (date *Date, remainder []byte, err error)
|
||||
```
|
||||
NewDate creates a new Date from []byte using ReadDate. Returns a pointer to Date
|
||||
unlike ReadDate.
|
||||
|
||||
#### func ReadDate
|
||||
|
||||
```go
|
||||
func ReadDate(data []byte) (date Date, remainder []byte, err error)
|
||||
```
|
||||
ReadDate creates a Date from []byte using the first DATE_SIZE bytes. Any data
|
||||
after DATE_SIZE is returned as a remainder.
|
||||
|
||||
#### func (Date) Bytes
|
||||
|
||||
```go
|
||||
func (i Date) Bytes() []byte
|
||||
```
|
||||
Bytes returns the raw []byte content of a Date.
|
||||
|
||||
#### func (Date) Int
|
||||
|
||||
```go
|
||||
func (i Date) Int() int
|
||||
```
|
||||
Int returns the Date as a Go integer.
|
||||
|
||||
#### func (Date) Time
|
||||
|
||||
```go
|
||||
func (date Date) Time() (date_time time.Time)
|
||||
```
|
||||
Time takes the value stored in date as an 8 byte big-endian integer representing
|
||||
the number of milliseconds since the beginning of unix time and converts it to a
|
||||
Go time.Time struct.
|
||||
|
||||
#### type Hash
|
||||
|
||||
```go
|
||||
type Hash [32]byte
|
||||
```
|
||||
|
||||
Hash is the represenation of an I2P Hash.
|
||||
|
||||
https://geti2p.net/spec/common-structures#hash
|
||||
|
||||
#### func HashData
|
||||
|
||||
```go
|
||||
func HashData(data []byte) (h Hash)
|
||||
```
|
||||
HashData returns the SHA256 sum of a []byte input as Hash.
|
||||
|
||||
#### func HashReader
|
||||
|
||||
```go
|
||||
func HashReader(r io.Reader) (h Hash, err error)
|
||||
```
|
||||
HashReader returns the SHA256 sum from all data read from an io.Reader. return
|
||||
error if one occurs while reading from reader
|
||||
|
||||
#### func (Hash) Bytes
|
||||
|
||||
```go
|
||||
func (h Hash) Bytes() [32]byte
|
||||
```
|
||||
|
||||
#### type I2PString
|
||||
|
||||
```go
|
||||
type I2PString []byte
|
||||
```
|
||||
|
||||
I2PString is the represenation of an I2P String.
|
||||
|
||||
https://geti2p.net/spec/common-structures#string
|
||||
|
||||
#### func ReadI2PString
|
||||
|
||||
```go
|
||||
func ReadI2PString(data []byte) (str I2PString, remainder []byte, err error)
|
||||
```
|
||||
ReadI2PString returns I2PString from a []byte. The remaining bytes after the
|
||||
specified length are also returned. Returns a list of errors that occurred
|
||||
during parsing.
|
||||
|
||||
#### func ToI2PString
|
||||
|
||||
```go
|
||||
func ToI2PString(data string) (str I2PString, err error)
|
||||
```
|
||||
ToI2PString converts a Go string to an I2PString. Returns error if the string
|
||||
exceeds STRING_MAX_SIZE.
|
||||
|
||||
#### func (I2PString) Data
|
||||
|
||||
```go
|
||||
func (str I2PString) Data() (data string, err error)
|
||||
```
|
||||
Data returns the I2PString content as a string trimmed to the specified length
|
||||
and not including the length byte. Returns error encountered by Length.
|
||||
|
||||
#### func (I2PString) Length
|
||||
|
||||
```go
|
||||
func (str I2PString) Length() (length int, err error)
|
||||
```
|
||||
Length returns the length specified in the first byte. Returns error if the
|
||||
specified does not match the actual length or the string is otherwise invalid.
|
||||
|
||||
#### type Integer
|
||||
|
||||
```go
|
||||
type Integer []byte
|
||||
```
|
||||
|
||||
Integer is the represenation of an I2P Integer.
|
||||
|
||||
https://geti2p.net/spec/common-structures#integer
|
||||
|
||||
#### func NewInteger
|
||||
|
||||
```go
|
||||
func NewInteger(bytes []byte, size int) (integer *Integer, remainder []byte, err error)
|
||||
```
|
||||
NewInteger creates a new Integer from []byte using ReadInteger. Limits the
|
||||
length of the created Integer to MAX_INTEGER_SIZE. Returns a pointer to Integer
|
||||
unlike ReadInteger.
|
||||
|
||||
#### func NewIntegerFromInt
|
||||
|
||||
```go
|
||||
func NewIntegerFromInt(value int, size int) (integer *Integer, err error)
|
||||
```
|
||||
NewIntegerFromInt creates a new Integer from a Go integer of a specified []byte
|
||||
length.
|
||||
|
||||
#### func ReadInteger
|
||||
|
||||
```go
|
||||
func ReadInteger(bytes []byte, size int) (Integer, []byte)
|
||||
```
|
||||
ReadInteger returns an Integer from a []byte of specified length. The remaining
|
||||
bytes after the specified length are also returned.
|
||||
|
||||
#### func (Integer) Bytes
|
||||
|
||||
```go
|
||||
func (i Integer) Bytes() []byte
|
||||
```
|
||||
Bytes returns the raw []byte content of an Integer.
|
||||
|
||||
#### func (Integer) Int
|
||||
|
||||
```go
|
||||
func (i Integer) Int() int
|
||||
```
|
||||
Int returns the Date as a Go integer
|
||||
|
||||
#### type Mapping
|
||||
|
||||
```go
|
||||
type Mapping struct {
|
||||
}
|
||||
```
|
||||
|
||||
Mapping is the represenation of an I2P Mapping.
|
||||
|
||||
https://geti2p.net/spec/common-structures#mapping
|
||||
|
||||
#### func GoMapToMapping
|
||||
|
||||
```go
|
||||
func GoMapToMapping(gomap map[string]string) (mapping *Mapping, err error)
|
||||
```
|
||||
GoMapToMapping converts a Go map of unformatted strings to *Mapping.
|
||||
|
||||
#### func NewMapping
|
||||
|
||||
```go
|
||||
func NewMapping(bytes []byte) (values *Mapping, remainder []byte, err []error)
|
||||
```
|
||||
NewMapping creates a new *Mapping from []byte using ReadMapping. Returns a
|
||||
pointer to Mapping unlike ReadMapping.
|
||||
|
||||
#### func ReadMapping
|
||||
|
||||
```go
|
||||
func ReadMapping(bytes []byte) (mapping Mapping, remainder []byte, err []error)
|
||||
```
|
||||
ReadMapping returns Mapping from a []byte. The remaining bytes after the
|
||||
specified length are also returned. Returns a list of errors that occurred
|
||||
during parsing.
|
||||
|
||||
#### func ValuesToMapping
|
||||
|
||||
```go
|
||||
func ValuesToMapping(values MappingValues) *Mapping
|
||||
```
|
||||
ValuesToMapping creates a *Mapping using MappingValues. The values are sorted in
|
||||
the order defined in mappingOrder.
|
||||
|
||||
#### func (*Mapping) Data
|
||||
|
||||
```go
|
||||
func (mapping *Mapping) Data() []byte
|
||||
```
|
||||
Data returns a Mapping in its []byte form.
|
||||
|
||||
#### func (*Mapping) HasDuplicateKeys
|
||||
|
||||
```go
|
||||
func (mapping *Mapping) HasDuplicateKeys() bool
|
||||
```
|
||||
HasDuplicateKeys returns true if two keys in a mapping are identical.
|
||||
|
||||
#### func (Mapping) Values
|
||||
|
||||
```go
|
||||
func (mapping Mapping) Values() MappingValues
|
||||
```
|
||||
Values returns the values contained in a Mapping as MappingValues.
|
||||
|
||||
#### type MappingValues
|
||||
|
||||
```go
|
||||
type MappingValues [][2]I2PString
|
||||
```
|
||||
|
||||
MappingValues represents the parsed key value pairs inside of an I2P Mapping.
|
||||
|
||||
#### func ReadMappingValues
|
||||
|
||||
```go
|
||||
func ReadMappingValues(remainder []byte, map_length Integer) (values *MappingValues, remainder_bytes []byte, errs []error)
|
||||
```
|
||||
ReadMappingValues returns *MappingValues from a []byte. The remaining bytes
|
||||
after the specified length are also returned. Returns a list of errors that
|
||||
occurred during parsing.
|
||||
|
||||
#### func (MappingValues) Get
|
||||
|
||||
```go
|
||||
func (m MappingValues) Get(key I2PString) I2PString
|
||||
```
|
42
lib/common/destination/doc.md
Normal file
42
lib/common/destination/doc.md
Normal file
@ -0,0 +1,42 @@
|
||||
# destination
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/destination"
|
||||
|
||||
Package destination implements the I2P Destination common data structure
|
||||
|
||||
## Usage
|
||||
|
||||
#### type Destination
|
||||
|
||||
```go
|
||||
type Destination struct {
|
||||
KeysAndCert
|
||||
}
|
||||
```
|
||||
|
||||
Destination is the represenation of an I2P Destination.
|
||||
|
||||
https://geti2p.net/spec/common-structures#destination
|
||||
|
||||
#### func ReadDestination
|
||||
|
||||
```go
|
||||
func ReadDestination(data []byte) (destination Destination, remainder []byte, err error)
|
||||
```
|
||||
ReadDestination returns Destination from a []byte. The remaining bytes after the
|
||||
specified length are also returned. Returns a list of errors that occurred
|
||||
during parsing.
|
||||
|
||||
#### func (Destination) Base32Address
|
||||
|
||||
```go
|
||||
func (destination Destination) Base32Address() (str string)
|
||||
```
|
||||
Base32Address returns the I2P base32 address for this Destination.
|
||||
|
||||
#### func (Destination) Base64
|
||||
|
||||
```go
|
||||
func (destination Destination) Base64() string
|
||||
```
|
||||
Base64 returns the I2P base64 address for this Destination.
|
12
lib/common/fuzz/certificate/doc.md
Normal file
12
lib/common/fuzz/certificate/doc.md
Normal file
@ -0,0 +1,12 @@
|
||||
# exportable
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/fuzz/certificate"
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
#### func Fuzz
|
||||
|
||||
```go
|
||||
func Fuzz(data []byte) int
|
||||
```
|
12
lib/common/fuzz/destination/doc.md
Normal file
12
lib/common/fuzz/destination/doc.md
Normal file
@ -0,0 +1,12 @@
|
||||
# exportable
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/fuzz/destination"
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
#### func Fuzz
|
||||
|
||||
```go
|
||||
func Fuzz(data []byte) int
|
||||
```
|
12
lib/common/fuzz/keys_and_cert/doc.md
Normal file
12
lib/common/fuzz/keys_and_cert/doc.md
Normal file
@ -0,0 +1,12 @@
|
||||
# exportable
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/fuzz/keys_and_cert"
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
#### func Fuzz
|
||||
|
||||
```go
|
||||
func Fuzz(data []byte) int
|
||||
```
|
12
lib/common/fuzz/router_address/doc.md
Normal file
12
lib/common/fuzz/router_address/doc.md
Normal file
@ -0,0 +1,12 @@
|
||||
# exportable
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/fuzz/router_address"
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
#### func Fuzz
|
||||
|
||||
```go
|
||||
func Fuzz(data []byte) int
|
||||
```
|
12
lib/common/fuzz/router_identity/doc.md
Normal file
12
lib/common/fuzz/router_identity/doc.md
Normal file
@ -0,0 +1,12 @@
|
||||
# exportable
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/fuzz/router_identity"
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
#### func Fuzz
|
||||
|
||||
```go
|
||||
func Fuzz(data []byte) int
|
||||
```
|
12
lib/common/fuzz/string/doc.md
Normal file
12
lib/common/fuzz/string/doc.md
Normal file
@ -0,0 +1,12 @@
|
||||
# exportable
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/fuzz/string"
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
#### func Fuzz
|
||||
|
||||
```go
|
||||
func Fuzz(data []byte) int
|
||||
```
|
154
lib/common/key_certificate/doc.md
Normal file
154
lib/common/key_certificate/doc.md
Normal file
@ -0,0 +1,154 @@
|
||||
# key_certificate
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/key_certificate"
|
||||
|
||||
Package key_certificate implements the I2P Destination common data structure
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
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
|
||||
|
||||
```go
|
||||
const (
|
||||
KEYCERT_CRYPTO_ELG = iota
|
||||
KEYCERT_CRYPTO_P256
|
||||
KEYCERT_CRYPTO_P384
|
||||
KEYCERT_CRYPTO_P521
|
||||
KEYCERT_CRYPTO_X25519
|
||||
)
|
||||
```
|
||||
Key Certificate Public Key Types
|
||||
|
||||
```go
|
||||
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
|
||||
|
||||
```go
|
||||
const (
|
||||
KEYCERT_CRYPTO_ELG_SIZE = 256
|
||||
KEYCERT_CRYPTO_P256_SIZE = 64
|
||||
KEYCERT_CRYPTO_P384_SIZE = 96
|
||||
KEYCERT_CRYPTO_P521_SIZE = 132
|
||||
KEYCERT_CRYPTO_X25519_SIZE = 32
|
||||
)
|
||||
```
|
||||
PublicKey sizes for Public Key Types
|
||||
|
||||
```go
|
||||
const (
|
||||
KEYCERT_PUBKEY_SIZE = 256
|
||||
KEYCERT_SPK_SIZE = 128
|
||||
)
|
||||
```
|
||||
Sizes of structures in KeyCertificates
|
||||
|
||||
```go
|
||||
const (
|
||||
KEYCERT_MIN_SIZE = 7
|
||||
)
|
||||
```
|
||||
|
||||
#### type KeyCertificate
|
||||
|
||||
```go
|
||||
type KeyCertificate struct {
|
||||
Certificate
|
||||
}
|
||||
```
|
||||
|
||||
type KeyCertificate []byte
|
||||
|
||||
#### func KeyCertificateFromCertificate
|
||||
|
||||
```go
|
||||
func KeyCertificateFromCertificate(certificate Certificate) *KeyCertificate
|
||||
```
|
||||
KeyCertificateFromCertificate returns a *KeyCertificate from a *Certificate.
|
||||
|
||||
#### func NewKeyCertificate
|
||||
|
||||
```go
|
||||
func NewKeyCertificate(bytes []byte) (key_certificate *KeyCertificate, remainder []byte, err error)
|
||||
```
|
||||
NewKeyCertificate creates a new *KeyCertificate from []byte using
|
||||
ReadCertificate. The remaining bytes after the specified length are also
|
||||
returned. Returns a list of errors that occurred during parsing.
|
||||
|
||||
#### func (KeyCertificate) ConstructPublicKey
|
||||
|
||||
```go
|
||||
func (key_certificate KeyCertificate) ConstructPublicKey(data []byte) (public_key crypto.PublicKey, err error)
|
||||
```
|
||||
ConstructPublicKey returns a PublicKey constructed using any excess data that
|
||||
may be stored in the KeyCertififcate. Returns enr errors encountered while
|
||||
parsing.
|
||||
|
||||
#### func (KeyCertificate) ConstructSigningPublicKey
|
||||
|
||||
```go
|
||||
func (key_certificate KeyCertificate) ConstructSigningPublicKey(data []byte) (signing_public_key crypto.SigningPublicKey, err error)
|
||||
```
|
||||
ConstructSigningPublicKey returns a SingingPublicKey constructed using any
|
||||
excess data that may be stored in the KeyCertificate. Returns any errors
|
||||
encountered while parsing.
|
||||
|
||||
#### func (KeyCertificate) CryptoSize
|
||||
|
||||
```go
|
||||
func (key_certificate KeyCertificate) CryptoSize() (size int)
|
||||
```
|
||||
CryptoSize return the size of a Public Key corresponding to the Key
|
||||
Certificate's PublicKey type.
|
||||
|
||||
#### func (KeyCertificate) Data
|
||||
|
||||
```go
|
||||
func (key_certificate KeyCertificate) Data() ([]byte, error)
|
||||
```
|
||||
Data returns the raw []byte contained in the Certificate.
|
||||
|
||||
#### func (KeyCertificate) PublicKeyType
|
||||
|
||||
```go
|
||||
func (key_certificate KeyCertificate) PublicKeyType() (pubkey_type int)
|
||||
```
|
||||
PublicKeyType returns the PublicKey type as a Go integer.
|
||||
|
||||
#### func (KeyCertificate) SignatureSize
|
||||
|
||||
```go
|
||||
func (key_certificate KeyCertificate) SignatureSize() (size int)
|
||||
```
|
||||
SignatureSize return the size of a Signature corresponding to the Key
|
||||
Certificate's SigningPublicKey type.
|
||||
|
||||
#### func (KeyCertificate) SigningPublicKeyType
|
||||
|
||||
```go
|
||||
func (key_certificate KeyCertificate) SigningPublicKeyType() (signing_pubkey_type int)
|
||||
```
|
||||
SigningPublicKeyType returns the SigningPublicKey type as a Go integer.
|
66
lib/common/keys_and_cert/doc.md
Normal file
66
lib/common/keys_and_cert/doc.md
Normal file
@ -0,0 +1,66 @@
|
||||
# keys_and_cert
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/keys_and_cert"
|
||||
|
||||
Package keys_and_cert implements the I2P KeysAndCert common data structure
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
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
|
||||
|
||||
#### type KeysAndCert
|
||||
|
||||
```go
|
||||
type KeysAndCert struct {
|
||||
KeyCertificate *KeyCertificate
|
||||
}
|
||||
```
|
||||
|
||||
KeysAndCert is the represenation of an I2P KeysAndCert.
|
||||
|
||||
https://geti2p.net/spec/common-structures#keysandcert
|
||||
|
||||
#### func ReadKeysAndCert
|
||||
|
||||
```go
|
||||
func ReadKeysAndCert(data []byte) (keys_and_cert KeysAndCert, remainder []byte, err error)
|
||||
```
|
||||
ReadKeysAndCert creates a new *KeysAndCert from []byte using ReadKeysAndCert.
|
||||
Returns a pointer to KeysAndCert unlike ReadKeysAndCert.
|
||||
|
||||
#### func (KeysAndCert) Bytes
|
||||
|
||||
```go
|
||||
func (keys_and_cert KeysAndCert) Bytes() []byte
|
||||
```
|
||||
Bytes returns the entire KeyCertificate in []byte form, trims payload to
|
||||
specified length.
|
||||
|
||||
#### func (*KeysAndCert) Certificate
|
||||
|
||||
```go
|
||||
func (keys_and_cert *KeysAndCert) Certificate() (cert Certificate)
|
||||
```
|
||||
Certfificate returns the certificate.
|
||||
|
||||
#### func (*KeysAndCert) PublicKey
|
||||
|
||||
```go
|
||||
func (keys_and_cert *KeysAndCert) PublicKey() (key crypto.PublicKey)
|
||||
```
|
||||
PublicKey returns the public key as a crypto.PublicKey.
|
||||
|
||||
#### func (*KeysAndCert) SigningPublicKey
|
||||
|
||||
```go
|
||||
func (keys_and_cert *KeysAndCert) SigningPublicKey() (signing_public_key crypto.SigningPublicKey)
|
||||
```
|
||||
SigningPublicKey returns the signing public key.
|
63
lib/common/lease/doc.md
Normal file
63
lib/common/lease/doc.md
Normal file
@ -0,0 +1,63 @@
|
||||
# lease
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/lease"
|
||||
|
||||
Package lease implements the I2P lease common data structure
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
const (
|
||||
LEASE_SIZE = 44
|
||||
LEASE_HASH_SIZE = 32
|
||||
LEASE_TUNNEL_ID_SIZE = 4
|
||||
)
|
||||
```
|
||||
Sizes in bytes of various components of a Lease
|
||||
|
||||
#### type Lease
|
||||
|
||||
```go
|
||||
type Lease [LEASE_SIZE]byte
|
||||
```
|
||||
|
||||
Lease is the represenation of an I2P Lease.
|
||||
|
||||
https://geti2p.net/spec/common-structures#lease
|
||||
|
||||
#### func NewLease
|
||||
|
||||
```go
|
||||
func NewLease(data []byte) (lease *Lease, remainder []byte, err error)
|
||||
```
|
||||
NewLease creates a new *NewLease from []byte using ReadLease. Returns a pointer
|
||||
to KeysAndCert unlike ReadLease.
|
||||
|
||||
#### func ReadLease
|
||||
|
||||
```go
|
||||
func ReadLease(data []byte) (lease Lease, remainder []byte, err error)
|
||||
```
|
||||
ReadLease returns Lease from a []byte. The remaining bytes after the specified
|
||||
length are also returned. Returns a list of errors that occurred during parsing.
|
||||
|
||||
#### func (Lease) Date
|
||||
|
||||
```go
|
||||
func (lease Lease) Date() (date Date)
|
||||
```
|
||||
Date returns the date as an I2P Date.
|
||||
|
||||
#### func (Lease) TunnelGateway
|
||||
|
||||
```go
|
||||
func (lease Lease) TunnelGateway() (hash Hash)
|
||||
```
|
||||
TunnelGateway returns the tunnel gateway as a Hash.
|
||||
|
||||
#### func (Lease) TunnelID
|
||||
|
||||
```go
|
||||
func (lease Lease) TunnelID() uint32
|
||||
```
|
||||
TunnelID returns the tunnel id as a uint23.
|
95
lib/common/lease_set/doc.md
Normal file
95
lib/common/lease_set/doc.md
Normal file
@ -0,0 +1,95 @@
|
||||
# lease_set
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/lease_set"
|
||||
|
||||
Package lease_set implements the I2P LeastSet common data structure
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
const (
|
||||
LEASE_SET_PUBKEY_SIZE = 256
|
||||
LEASE_SET_SPK_SIZE = 128
|
||||
LEASE_SET_SIG_SIZE = 40
|
||||
)
|
||||
```
|
||||
Sizes of various structures in an I2P LeaseSet
|
||||
|
||||
#### type LeaseSet
|
||||
|
||||
```go
|
||||
type LeaseSet []byte
|
||||
```
|
||||
|
||||
LeaseSet is the represenation of an I2P LeaseSet.
|
||||
|
||||
https://geti2p.net/spec/common-structures#leaseset
|
||||
|
||||
#### func (LeaseSet) Destination
|
||||
|
||||
```go
|
||||
func (lease_set LeaseSet) Destination() (destination Destination, err error)
|
||||
```
|
||||
Destination returns the Destination as []byte.
|
||||
|
||||
#### func (LeaseSet) LeaseCount
|
||||
|
||||
```go
|
||||
func (lease_set LeaseSet) LeaseCount() (count int, err error)
|
||||
```
|
||||
LeaseCount returns the numbert of leases specified by the LeaseCount value as
|
||||
int. returns errors encountered during parsing.
|
||||
|
||||
#### func (LeaseSet) Leases
|
||||
|
||||
```go
|
||||
func (lease_set LeaseSet) Leases() (leases []Lease, err error)
|
||||
```
|
||||
Leases returns the leases as []Lease. returns errors encountered during parsing.
|
||||
|
||||
#### func (LeaseSet) NewestExpiration
|
||||
|
||||
```go
|
||||
func (lease_set LeaseSet) NewestExpiration() (newest Date, err error)
|
||||
```
|
||||
NewestExpiration returns the newest lease expiration as an I2P Date. Returns
|
||||
errors encountered during parsing.
|
||||
|
||||
#### func (LeaseSet) OldestExpiration
|
||||
|
||||
```go
|
||||
func (lease_set LeaseSet) OldestExpiration() (earliest Date, err error)
|
||||
```
|
||||
OldestExpiration returns the oldest lease expiration as an I2P Date. Returns
|
||||
errors encountered during parsing.
|
||||
|
||||
#### func (LeaseSet) PublicKey
|
||||
|
||||
```go
|
||||
func (lease_set LeaseSet) PublicKey() (public_key crypto.ElgPublicKey, err error)
|
||||
```
|
||||
PublicKey returns the public key as crypto.ElgPublicKey. Returns errors
|
||||
encountered during parsing.
|
||||
|
||||
#### func (LeaseSet) Signature
|
||||
|
||||
```go
|
||||
func (lease_set LeaseSet) Signature() (signature Signature, err error)
|
||||
```
|
||||
Signature returns the signature as Signature. returns errors encountered during
|
||||
parsing.
|
||||
|
||||
#### func (LeaseSet) SigningKey
|
||||
|
||||
```go
|
||||
func (lease_set LeaseSet) SigningKey() (signing_public_key crypto.SigningPublicKey, err error)
|
||||
```
|
||||
SigningKey returns the signing public key as crypto.SigningPublicKey. returns
|
||||
errors encountered during parsing.
|
||||
|
||||
#### func (LeaseSet) Verify
|
||||
|
||||
```go
|
||||
func (lease_set LeaseSet) Verify() error
|
||||
```
|
||||
Verify returns nil
|
179
lib/common/router_address/doc.md
Normal file
179
lib/common/router_address/doc.md
Normal file
@ -0,0 +1,179 @@
|
||||
# router_address
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/router_address"
|
||||
|
||||
Package router_address implements the I2P RouterAddress common data structure
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
const (
|
||||
ROUTER_ADDRESS_MIN_SIZE = 9
|
||||
)
|
||||
```
|
||||
Minimum number of bytes in a valid RouterAddress
|
||||
|
||||
#### type RouterAddress
|
||||
|
||||
```go
|
||||
type RouterAddress struct {
|
||||
TransportCost *Integer
|
||||
ExpirationDate *Date
|
||||
TransportType I2PString
|
||||
TransportOptions *Mapping
|
||||
}
|
||||
```
|
||||
|
||||
RouterAddress is the represenation of an I2P RouterAddress.
|
||||
|
||||
https://geti2p.net/spec/common-structures#routeraddress
|
||||
|
||||
#### func ReadRouterAddress
|
||||
|
||||
```go
|
||||
func ReadRouterAddress(data []byte) (router_address RouterAddress, remainder []byte, err error)
|
||||
```
|
||||
ReadRouterAddress returns RouterAddress from a []byte. The remaining bytes after
|
||||
the specified length are also returned. Returns a list of errors that occurred
|
||||
during parsing.
|
||||
|
||||
#### func (RouterAddress) Bytes
|
||||
|
||||
```go
|
||||
func (router_address RouterAddress) Bytes() []byte
|
||||
```
|
||||
Bytes returns the router address as a []byte.
|
||||
|
||||
#### func (RouterAddress) Cost
|
||||
|
||||
```go
|
||||
func (router_address RouterAddress) Cost() int
|
||||
```
|
||||
Cost returns the cost for this RouterAddress as a Go integer.
|
||||
|
||||
#### func (RouterAddress) Expiration
|
||||
|
||||
```go
|
||||
func (router_address RouterAddress) Expiration() Date
|
||||
```
|
||||
Expiration returns the expiration for this RouterAddress as an I2P Date.
|
||||
|
||||
#### func (RouterAddress) GetOption
|
||||
|
||||
```go
|
||||
func (router_address RouterAddress) GetOption(key I2PString) I2PString
|
||||
```
|
||||
GetOption returns the value of the option specified by the key
|
||||
|
||||
#### func (RouterAddress) Host
|
||||
|
||||
```go
|
||||
func (router_address RouterAddress) Host() (net.Addr, error)
|
||||
```
|
||||
|
||||
#### func (RouterAddress) HostString
|
||||
|
||||
```go
|
||||
func (router_address RouterAddress) HostString() I2PString
|
||||
```
|
||||
|
||||
#### func (RouterAddress) InitializationVector
|
||||
|
||||
```go
|
||||
func (router_address RouterAddress) InitializationVector() ([32]byte, error)
|
||||
```
|
||||
|
||||
#### func (RouterAddress) InitializationVectorString
|
||||
|
||||
```go
|
||||
func (router_address RouterAddress) InitializationVectorString() I2PString
|
||||
```
|
||||
|
||||
#### func (RouterAddress) IntroducerExpirationString
|
||||
|
||||
```go
|
||||
func (router_address RouterAddress) IntroducerExpirationString(num int) I2PString
|
||||
```
|
||||
|
||||
#### func (RouterAddress) IntroducerHashString
|
||||
|
||||
```go
|
||||
func (router_address RouterAddress) IntroducerHashString(num int) I2PString
|
||||
```
|
||||
|
||||
#### func (RouterAddress) IntroducerTagString
|
||||
|
||||
```go
|
||||
func (router_address RouterAddress) IntroducerTagString(num int) I2PString
|
||||
```
|
||||
|
||||
#### func (*RouterAddress) Network
|
||||
|
||||
```go
|
||||
func (router_address *RouterAddress) Network() string
|
||||
```
|
||||
Network implements net.Addr. It returns the transport type
|
||||
|
||||
#### func (RouterAddress) Options
|
||||
|
||||
```go
|
||||
func (router_address RouterAddress) Options() Mapping
|
||||
```
|
||||
Options returns the options for this RouterAddress as an I2P Mapping.
|
||||
|
||||
#### func (RouterAddress) Port
|
||||
|
||||
```go
|
||||
func (router_address RouterAddress) Port() (string, error)
|
||||
```
|
||||
|
||||
#### func (RouterAddress) PortString
|
||||
|
||||
```go
|
||||
func (router_address RouterAddress) PortString() I2PString
|
||||
```
|
||||
|
||||
#### func (RouterAddress) ProtocolVersion
|
||||
|
||||
```go
|
||||
func (router_address RouterAddress) ProtocolVersion() (string, error)
|
||||
```
|
||||
|
||||
#### func (RouterAddress) ProtocolVersionString
|
||||
|
||||
```go
|
||||
func (router_address RouterAddress) ProtocolVersionString() I2PString
|
||||
```
|
||||
|
||||
#### func (RouterAddress) StaticKey
|
||||
|
||||
```go
|
||||
func (router_address RouterAddress) StaticKey() ([32]byte, error)
|
||||
```
|
||||
|
||||
#### func (RouterAddress) StaticKeyString
|
||||
|
||||
```go
|
||||
func (router_address RouterAddress) StaticKeyString() I2PString
|
||||
```
|
||||
|
||||
#### func (*RouterAddress) String
|
||||
|
||||
```go
|
||||
func (router_address *RouterAddress) String() string
|
||||
```
|
||||
String implements net.Addr. It returns the IP address, followed by the options
|
||||
|
||||
#### func (RouterAddress) TransportStyle
|
||||
|
||||
```go
|
||||
func (router_address RouterAddress) TransportStyle() I2PString
|
||||
```
|
||||
TransportStyle returns the transport style for this RouterAddress as an
|
||||
I2PString.
|
||||
|
||||
#### func (*RouterAddress) UDP
|
||||
|
||||
```go
|
||||
func (router_address *RouterAddress) UDP() bool
|
||||
```
|
28
lib/common/router_identity/doc.md
Normal file
28
lib/common/router_identity/doc.md
Normal file
@ -0,0 +1,28 @@
|
||||
# router_identity
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/router_identity"
|
||||
|
||||
Package router_identity implements the I2P RouterIdentity common data structure
|
||||
|
||||
## Usage
|
||||
|
||||
#### type RouterIdentity
|
||||
|
||||
```go
|
||||
type RouterIdentity struct {
|
||||
KeysAndCert
|
||||
}
|
||||
```
|
||||
|
||||
RouterIdentity is the represenation of an I2P RouterIdentity.
|
||||
|
||||
https://geti2p.net/spec/common-structures#routeridentity
|
||||
|
||||
#### func ReadRouterIdentity
|
||||
|
||||
```go
|
||||
func ReadRouterIdentity(data []byte) (router_identity RouterIdentity, remainder []byte, err error)
|
||||
```
|
||||
ReadRouterIdentity returns RouterIdentity from a []byte. The remaining bytes
|
||||
after the specified length are also returned. Returns a list of errors that
|
||||
occurred during parsing.
|
139
lib/common/router_info/doc.md
Normal file
139
lib/common/router_info/doc.md
Normal file
@ -0,0 +1,139 @@
|
||||
# router_info
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/router_info"
|
||||
|
||||
Package router_info implements the I2P RouterInfo common data structure
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
const (
|
||||
MIN_GOOD_VERSION = 58
|
||||
MAX_GOOD_VERSION = 99
|
||||
)
|
||||
```
|
||||
|
||||
```go
|
||||
const ROUTER_INFO_MIN_SIZE = 439
|
||||
```
|
||||
|
||||
#### type RouterInfo
|
||||
|
||||
```go
|
||||
type RouterInfo struct {
|
||||
}
|
||||
```
|
||||
|
||||
RouterInfo is the represenation of an I2P RouterInfo.
|
||||
|
||||
https://geti2p.net/spec/common-structures#routerinfo
|
||||
|
||||
#### func ReadRouterInfo
|
||||
|
||||
```go
|
||||
func ReadRouterInfo(bytes []byte) (info RouterInfo, remainder []byte, err error)
|
||||
```
|
||||
ReadRouterInfo returns RouterInfo from a []byte. The remaining bytes after the
|
||||
specified length are also returned. Returns a list of errors that occurred
|
||||
during parsing.
|
||||
|
||||
#### func (RouterInfo) Bytes
|
||||
|
||||
```go
|
||||
func (router_info RouterInfo) Bytes() (bytes []byte, err error)
|
||||
```
|
||||
Bytes returns the RouterInfo as a []byte suitable for writing to a stream.
|
||||
|
||||
#### func (*RouterInfo) GoodVersion
|
||||
|
||||
```go
|
||||
func (router_info *RouterInfo) GoodVersion() bool
|
||||
```
|
||||
|
||||
#### func (*RouterInfo) IdentHash
|
||||
|
||||
```go
|
||||
func (router_info *RouterInfo) IdentHash() Hash
|
||||
```
|
||||
IndentHash returns the identity hash (sha256 sum) for this RouterInfo.
|
||||
|
||||
#### func (RouterInfo) Options
|
||||
|
||||
```go
|
||||
func (router_info RouterInfo) Options() (mapping Mapping)
|
||||
```
|
||||
Options returns the options for this RouterInfo as an I2P Mapping.
|
||||
|
||||
#### func (*RouterInfo) PeerSize
|
||||
|
||||
```go
|
||||
func (router_info *RouterInfo) PeerSize() int
|
||||
```
|
||||
PeerSize returns the peer size as a Go integer.
|
||||
|
||||
#### func (*RouterInfo) Published
|
||||
|
||||
```go
|
||||
func (router_info *RouterInfo) Published() *Date
|
||||
```
|
||||
Published returns the date this RouterInfo was published as an I2P Date.
|
||||
|
||||
#### func (*RouterInfo) Reachable
|
||||
|
||||
```go
|
||||
func (router_info *RouterInfo) Reachable() bool
|
||||
```
|
||||
|
||||
#### func (*RouterInfo) RouterAddressCount
|
||||
|
||||
```go
|
||||
func (router_info *RouterInfo) RouterAddressCount() int
|
||||
```
|
||||
RouterAddressCount returns the count of RouterAddress in this RouterInfo as a Go
|
||||
integer.
|
||||
|
||||
#### func (*RouterInfo) RouterAddresses
|
||||
|
||||
```go
|
||||
func (router_info *RouterInfo) RouterAddresses() []*RouterAddress
|
||||
```
|
||||
RouterAddresses returns all RouterAddresses for this RouterInfo as
|
||||
[]*RouterAddress.
|
||||
|
||||
#### func (*RouterInfo) RouterCapabilities
|
||||
|
||||
```go
|
||||
func (router_info *RouterInfo) RouterCapabilities() string
|
||||
```
|
||||
|
||||
#### func (*RouterInfo) RouterIdentity
|
||||
|
||||
```go
|
||||
func (router_info *RouterInfo) RouterIdentity() *RouterIdentity
|
||||
```
|
||||
RouterIdentity returns the router identity as *RouterIdentity.
|
||||
|
||||
#### func (*RouterInfo) RouterVersion
|
||||
|
||||
```go
|
||||
func (router_info *RouterInfo) RouterVersion() string
|
||||
```
|
||||
|
||||
#### func (RouterInfo) Signature
|
||||
|
||||
```go
|
||||
func (router_info RouterInfo) Signature() (signature Signature)
|
||||
```
|
||||
Signature returns the signature for this RouterInfo as an I2P Signature.
|
||||
|
||||
#### func (RouterInfo) String
|
||||
|
||||
```go
|
||||
func (router_info RouterInfo) String() string
|
||||
```
|
||||
|
||||
#### func (*RouterInfo) UnCongested
|
||||
|
||||
```go
|
||||
func (router_info *RouterInfo) UnCongested() bool
|
||||
```
|
34
lib/common/session_key/doc.md
Normal file
34
lib/common/session_key/doc.md
Normal file
@ -0,0 +1,34 @@
|
||||
# session_key
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/session_key"
|
||||
|
||||
Package session_key implements the I2P SessionKey common data structure
|
||||
|
||||
## Usage
|
||||
|
||||
#### type SessionKey
|
||||
|
||||
```go
|
||||
type SessionKey [32]byte
|
||||
```
|
||||
|
||||
SessionKey is the represenation of an I2P SessionKey.
|
||||
|
||||
https://geti2p.net/spec/common-structures#sessionkey
|
||||
|
||||
#### func NewSessionKey
|
||||
|
||||
```go
|
||||
func NewSessionKey(data []byte) (session_key *SessionKey, remainder []byte, err error)
|
||||
```
|
||||
NewSessionKey creates a new *SessionKey from []byte using ReadSessionKey.
|
||||
Returns a pointer to SessionKey unlike ReadSessionKey.
|
||||
|
||||
#### func ReadSessionKey
|
||||
|
||||
```go
|
||||
func ReadSessionKey(bytes []byte) (info SessionKey, remainder []byte, err error)
|
||||
```
|
||||
ReadSessionKey returns SessionKey from a []byte. The remaining bytes after the
|
||||
specified length are also returned. Returns a list of errors that occurred
|
||||
during parsing.
|
34
lib/common/session_tag/doc.md
Normal file
34
lib/common/session_tag/doc.md
Normal file
@ -0,0 +1,34 @@
|
||||
# session_tag
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/session_tag"
|
||||
|
||||
Package session_tag implements the I2P SessionTag common data structure
|
||||
|
||||
## Usage
|
||||
|
||||
#### type SessionTag
|
||||
|
||||
```go
|
||||
type SessionTag [32]byte
|
||||
```
|
||||
|
||||
SessionTag is the represenation of an I2P SessionTag.
|
||||
|
||||
https://geti2p.net/spec/common-structures#session-tag
|
||||
|
||||
#### func NewSessionTag
|
||||
|
||||
```go
|
||||
func NewSessionTag(data []byte) (session_tag *SessionTag, remainder []byte, err error)
|
||||
```
|
||||
NewSessionTag creates a new *SessionTag from []byte using ReadSessionTag.
|
||||
Returns a pointer to SessionTag unlike ReadSessionTag.
|
||||
|
||||
#### func ReadSessionTag
|
||||
|
||||
```go
|
||||
func ReadSessionTag(bytes []byte) (info SessionTag, remainder []byte, err error)
|
||||
```
|
||||
ReadSessionTag returns SessionTag from a []byte. The remaining bytes after the
|
||||
specified length are also returned. Returns a list of errors that occurred
|
||||
during parsing.
|
50
lib/common/signature/doc.md
Normal file
50
lib/common/signature/doc.md
Normal file
@ -0,0 +1,50 @@
|
||||
# signature
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/common/signature"
|
||||
|
||||
Package signature implements the I2P Signature common data structure
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
const (
|
||||
DSA_SHA1_SIZE = 40
|
||||
ECDSA_SHA256_P256_SIZE = 64
|
||||
ECDSA_SHA384_P384_SIZE = 96
|
||||
ECDSA_SHA512_P512_SIZE = 132
|
||||
RSA_SHA256_2048_SIZE = 256
|
||||
RSA_SHA384_3072_SIZE = 384
|
||||
RSA_SHA512_4096_SIZE = 512
|
||||
EdDSA_SHA512_Ed25519_SIZE = 64
|
||||
EdDSA_SHA512_Ed25519ph_SIZE = 64
|
||||
RedDSA_SHA512_Ed25519_SIZE = 64
|
||||
)
|
||||
```
|
||||
Lengths of signature keys
|
||||
|
||||
#### type Signature
|
||||
|
||||
```go
|
||||
type Signature []byte
|
||||
```
|
||||
|
||||
Signature is the represenation of an I2P Signature.
|
||||
|
||||
https://geti2p.net/spec/common-structures#signature
|
||||
|
||||
#### func NewSignature
|
||||
|
||||
```go
|
||||
func NewSignature(data []byte) (session_tag *Signature, remainder []byte, err error)
|
||||
```
|
||||
NewSignature creates a new *Signature from []byte using ReadSignature. Returns a
|
||||
pointer to Signature unlike ReadSignature.
|
||||
|
||||
#### func ReadSignature
|
||||
|
||||
```go
|
||||
func ReadSignature(bytes []byte) (info Signature, remainder []byte, err error)
|
||||
```
|
||||
ReadSignature returns Signature from a []byte. The remaining bytes after the
|
||||
specified length are also returned. Returns a list of errors that occurred
|
||||
during parsing.
|
85
lib/config/doc.md
Normal file
85
lib/config/doc.md
Normal file
@ -0,0 +1,85 @@
|
||||
# config
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/config"
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
var DefaultBootstrapConfig = BootstrapConfig{
|
||||
LowPeerThreshold: 10,
|
||||
|
||||
ReseedServers: []*ReseedConfig{},
|
||||
}
|
||||
```
|
||||
default configuration for network bootstrap
|
||||
|
||||
```go
|
||||
var DefaultNetDbConfig = NetDbConfig{
|
||||
Path: filepath.Join(defaultConfig(), "netDb"),
|
||||
}
|
||||
```
|
||||
default settings for netdb
|
||||
|
||||
```go
|
||||
var RouterConfigProperties = DefaultRouterConfig()
|
||||
```
|
||||
|
||||
#### type BootstrapConfig
|
||||
|
||||
```go
|
||||
type BootstrapConfig struct {
|
||||
// if we have less than this many peers we should reseed
|
||||
LowPeerThreshold int
|
||||
// reseed servers
|
||||
ReseedServers []*ReseedConfig
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### type NetDbConfig
|
||||
|
||||
```go
|
||||
type NetDbConfig struct {
|
||||
// path to network database directory
|
||||
Path string
|
||||
}
|
||||
```
|
||||
|
||||
local network database configuration
|
||||
|
||||
#### type ReseedConfig
|
||||
|
||||
```go
|
||||
type ReseedConfig struct {
|
||||
// url of reseed server
|
||||
Url string
|
||||
// fingerprint of reseed su3 signing key
|
||||
SU3Fingerprint string
|
||||
}
|
||||
```
|
||||
|
||||
configuration for 1 reseed server
|
||||
|
||||
#### type RouterConfig
|
||||
|
||||
```go
|
||||
type RouterConfig struct {
|
||||
// the path to the base config directory where per-system defaults are stored
|
||||
BaseDir string
|
||||
// the path to the working config directory where files are changed
|
||||
WorkingDir string
|
||||
// netdb configuration
|
||||
NetDb *NetDbConfig
|
||||
// configuration for bootstrapping into the network
|
||||
Bootstrap *BootstrapConfig
|
||||
}
|
||||
```
|
||||
|
||||
router.config options
|
||||
|
||||
#### func DefaultRouterConfig
|
||||
|
||||
```go
|
||||
func DefaultRouterConfig() *RouterConfig
|
||||
```
|
623
lib/crypto/doc.md
Normal file
623
lib/crypto/doc.md
Normal file
@ -0,0 +1,623 @@
|
||||
# crypto
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/crypto"
|
||||
|
||||
package for i2p specific crpytography
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
const (
|
||||
IPAD = byte(0x36)
|
||||
OPAD = byte(0x5C)
|
||||
)
|
||||
```
|
||||
|
||||
```go
|
||||
var (
|
||||
ElgDecryptFail = errors.New("failed to decrypt elgamal encrypted data")
|
||||
ElgEncryptTooBig = errors.New("failed to encrypt data, too big for elgamal")
|
||||
)
|
||||
```
|
||||
|
||||
```go
|
||||
var (
|
||||
ErrBadSignatureSize = errors.New("bad signature size")
|
||||
ErrInvalidKeyFormat = errors.New("invalid key format")
|
||||
ErrInvalidSignature = errors.New("invalid signature")
|
||||
)
|
||||
```
|
||||
|
||||
```go
|
||||
var Ed25519EncryptTooBig = errors.New("failed to encrypt data, too big for Ed25519")
|
||||
```
|
||||
|
||||
```go
|
||||
var SHA256 = sha256.Sum256
|
||||
```
|
||||
|
||||
#### func ElgamalGenerate
|
||||
|
||||
```go
|
||||
func ElgamalGenerate(priv *elgamal.PrivateKey, rand io.Reader) (err error)
|
||||
```
|
||||
generate an elgamal key pair
|
||||
|
||||
#### type DSAPrivateKey
|
||||
|
||||
```go
|
||||
type DSAPrivateKey [20]byte
|
||||
```
|
||||
|
||||
|
||||
#### func (DSAPrivateKey) Generate
|
||||
|
||||
```go
|
||||
func (k DSAPrivateKey) Generate() (s DSAPrivateKey, err error)
|
||||
```
|
||||
|
||||
#### func (DSAPrivateKey) Len
|
||||
|
||||
```go
|
||||
func (k DSAPrivateKey) Len() int
|
||||
```
|
||||
|
||||
#### func (DSAPrivateKey) NewSigner
|
||||
|
||||
```go
|
||||
func (k DSAPrivateKey) NewSigner() (s Signer, err error)
|
||||
```
|
||||
create a new dsa signer
|
||||
|
||||
#### func (DSAPrivateKey) Public
|
||||
|
||||
```go
|
||||
func (k DSAPrivateKey) Public() (pk DSAPublicKey, err error)
|
||||
```
|
||||
|
||||
#### type DSAPublicKey
|
||||
|
||||
```go
|
||||
type DSAPublicKey [128]byte
|
||||
```
|
||||
|
||||
|
||||
#### func (DSAPublicKey) Len
|
||||
|
||||
```go
|
||||
func (k DSAPublicKey) Len() int
|
||||
```
|
||||
|
||||
#### func (DSAPublicKey) NewVerifier
|
||||
|
||||
```go
|
||||
func (k DSAPublicKey) NewVerifier() (v Verifier, err error)
|
||||
```
|
||||
create a new dsa verifier
|
||||
|
||||
#### type DSASigner
|
||||
|
||||
```go
|
||||
type DSASigner struct {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func (*DSASigner) Sign
|
||||
|
||||
```go
|
||||
func (ds *DSASigner) Sign(data []byte) (sig []byte, err error)
|
||||
```
|
||||
|
||||
#### func (*DSASigner) SignHash
|
||||
|
||||
```go
|
||||
func (ds *DSASigner) SignHash(h []byte) (sig []byte, err error)
|
||||
```
|
||||
|
||||
#### type DSAVerifier
|
||||
|
||||
```go
|
||||
type DSAVerifier struct {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func (*DSAVerifier) Verify
|
||||
|
||||
```go
|
||||
func (v *DSAVerifier) Verify(data, sig []byte) (err error)
|
||||
```
|
||||
verify data with a dsa public key
|
||||
|
||||
#### func (*DSAVerifier) VerifyHash
|
||||
|
||||
```go
|
||||
func (v *DSAVerifier) VerifyHash(h, sig []byte) (err error)
|
||||
```
|
||||
verify hash of data with a dsa public key
|
||||
|
||||
#### type Decrypter
|
||||
|
||||
```go
|
||||
type Decrypter interface {
|
||||
// decrypt a block of data
|
||||
// return decrypted block or nil and error if error happens
|
||||
Decrypt(data []byte) ([]byte, error)
|
||||
}
|
||||
```
|
||||
|
||||
decrypts data
|
||||
|
||||
#### type ECDSAVerifier
|
||||
|
||||
```go
|
||||
type ECDSAVerifier struct {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func (*ECDSAVerifier) Verify
|
||||
|
||||
```go
|
||||
func (v *ECDSAVerifier) Verify(data, sig []byte) (err error)
|
||||
```
|
||||
verify a block of data by hashing it and comparing the hash against the
|
||||
signature
|
||||
|
||||
#### func (*ECDSAVerifier) VerifyHash
|
||||
|
||||
```go
|
||||
func (v *ECDSAVerifier) VerifyHash(h, sig []byte) (err error)
|
||||
```
|
||||
verify a signature given the hash
|
||||
|
||||
#### type ECP256PrivateKey
|
||||
|
||||
```go
|
||||
type ECP256PrivateKey [32]byte
|
||||
```
|
||||
|
||||
|
||||
#### type ECP256PublicKey
|
||||
|
||||
```go
|
||||
type ECP256PublicKey [64]byte
|
||||
```
|
||||
|
||||
|
||||
#### func (ECP256PublicKey) Len
|
||||
|
||||
```go
|
||||
func (k ECP256PublicKey) Len() int
|
||||
```
|
||||
|
||||
#### func (ECP256PublicKey) NewVerifier
|
||||
|
||||
```go
|
||||
func (k ECP256PublicKey) NewVerifier() (Verifier, error)
|
||||
```
|
||||
|
||||
#### type ECP384PrivateKey
|
||||
|
||||
```go
|
||||
type ECP384PrivateKey [48]byte
|
||||
```
|
||||
|
||||
|
||||
#### type ECP384PublicKey
|
||||
|
||||
```go
|
||||
type ECP384PublicKey [96]byte
|
||||
```
|
||||
|
||||
|
||||
#### func (ECP384PublicKey) Len
|
||||
|
||||
```go
|
||||
func (k ECP384PublicKey) Len() int
|
||||
```
|
||||
|
||||
#### func (ECP384PublicKey) NewVerifier
|
||||
|
||||
```go
|
||||
func (k ECP384PublicKey) NewVerifier() (Verifier, error)
|
||||
```
|
||||
|
||||
#### type ECP521PrivateKey
|
||||
|
||||
```go
|
||||
type ECP521PrivateKey [66]byte
|
||||
```
|
||||
|
||||
|
||||
#### type ECP521PublicKey
|
||||
|
||||
```go
|
||||
type ECP521PublicKey [132]byte
|
||||
```
|
||||
|
||||
|
||||
#### func (ECP521PublicKey) Len
|
||||
|
||||
```go
|
||||
func (k ECP521PublicKey) Len() int
|
||||
```
|
||||
|
||||
#### func (ECP521PublicKey) NewVerifier
|
||||
|
||||
```go
|
||||
func (k ECP521PublicKey) NewVerifier() (Verifier, error)
|
||||
```
|
||||
|
||||
#### type Ed25519Encryption
|
||||
|
||||
```go
|
||||
type Ed25519Encryption struct {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func (*Ed25519Encryption) Encrypt
|
||||
|
||||
```go
|
||||
func (ed25519 *Ed25519Encryption) Encrypt(data []byte) (enc []byte, err error)
|
||||
```
|
||||
|
||||
#### func (*Ed25519Encryption) EncryptPadding
|
||||
|
||||
```go
|
||||
func (ed25519 *Ed25519Encryption) EncryptPadding(data []byte, zeroPadding bool) (encrypted []byte, err error)
|
||||
```
|
||||
|
||||
#### type Ed25519PrivateKey
|
||||
|
||||
```go
|
||||
type Ed25519PrivateKey ed25519.PrivateKey
|
||||
```
|
||||
|
||||
|
||||
#### type Ed25519PublicKey
|
||||
|
||||
```go
|
||||
type Ed25519PublicKey []byte
|
||||
```
|
||||
|
||||
|
||||
#### func (Ed25519PublicKey) Len
|
||||
|
||||
```go
|
||||
func (k Ed25519PublicKey) Len() int
|
||||
```
|
||||
|
||||
#### func (Ed25519PublicKey) NewEncrypter
|
||||
|
||||
```go
|
||||
func (elg Ed25519PublicKey) NewEncrypter() (enc Encrypter, err error)
|
||||
```
|
||||
|
||||
#### func (Ed25519PublicKey) NewVerifier
|
||||
|
||||
```go
|
||||
func (k Ed25519PublicKey) NewVerifier() (v Verifier, err error)
|
||||
```
|
||||
|
||||
#### type Ed25519Signer
|
||||
|
||||
```go
|
||||
type Ed25519Signer struct {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func (*Ed25519Signer) Sign
|
||||
|
||||
```go
|
||||
func (s *Ed25519Signer) Sign(data []byte) (sig []byte, err error)
|
||||
```
|
||||
|
||||
#### func (*Ed25519Signer) SignHash
|
||||
|
||||
```go
|
||||
func (s *Ed25519Signer) SignHash(h []byte) (sig []byte, err error)
|
||||
```
|
||||
|
||||
#### type Ed25519Verifier
|
||||
|
||||
```go
|
||||
type Ed25519Verifier struct {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func (*Ed25519Verifier) Verify
|
||||
|
||||
```go
|
||||
func (v *Ed25519Verifier) Verify(data, sig []byte) (err error)
|
||||
```
|
||||
|
||||
#### func (*Ed25519Verifier) VerifyHash
|
||||
|
||||
```go
|
||||
func (v *Ed25519Verifier) VerifyHash(h, sig []byte) (err error)
|
||||
```
|
||||
|
||||
#### type ElgPrivateKey
|
||||
|
||||
```go
|
||||
type ElgPrivateKey [256]byte
|
||||
```
|
||||
|
||||
|
||||
#### func (ElgPrivateKey) Len
|
||||
|
||||
```go
|
||||
func (elg ElgPrivateKey) Len() int
|
||||
```
|
||||
|
||||
#### func (ElgPrivateKey) NewDecrypter
|
||||
|
||||
```go
|
||||
func (elg ElgPrivateKey) NewDecrypter() (dec Decrypter, err error)
|
||||
```
|
||||
|
||||
#### type ElgPublicKey
|
||||
|
||||
```go
|
||||
type ElgPublicKey [256]byte
|
||||
```
|
||||
|
||||
|
||||
#### func (ElgPublicKey) Len
|
||||
|
||||
```go
|
||||
func (elg ElgPublicKey) Len() int
|
||||
```
|
||||
|
||||
#### func (ElgPublicKey) NewEncrypter
|
||||
|
||||
```go
|
||||
func (elg ElgPublicKey) NewEncrypter() (enc Encrypter, err error)
|
||||
```
|
||||
|
||||
#### type ElgamalEncryption
|
||||
|
||||
```go
|
||||
type ElgamalEncryption struct {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func (*ElgamalEncryption) Encrypt
|
||||
|
||||
```go
|
||||
func (elg *ElgamalEncryption) Encrypt(data []byte) (enc []byte, err error)
|
||||
```
|
||||
|
||||
#### func (*ElgamalEncryption) EncryptPadding
|
||||
|
||||
```go
|
||||
func (elg *ElgamalEncryption) EncryptPadding(data []byte, zeroPadding bool) (encrypted []byte, err error)
|
||||
```
|
||||
|
||||
#### type Encrypter
|
||||
|
||||
```go
|
||||
type Encrypter interface {
|
||||
// encrypt a block of data
|
||||
// return encrypted block or nil and error if an error happened
|
||||
Encrypt(data []byte) (enc []byte, err error)
|
||||
}
|
||||
```
|
||||
|
||||
encrypts data
|
||||
|
||||
#### type HMACDigest
|
||||
|
||||
```go
|
||||
type HMACDigest [16]byte
|
||||
```
|
||||
|
||||
|
||||
#### func I2PHMAC
|
||||
|
||||
```go
|
||||
func I2PHMAC(data []byte, k HMACKey) (d HMACDigest)
|
||||
```
|
||||
do i2p hmac
|
||||
|
||||
#### type HMACKey
|
||||
|
||||
```go
|
||||
type HMACKey [32]byte
|
||||
```
|
||||
|
||||
|
||||
#### type PrivateEncryptionKey
|
||||
|
||||
```go
|
||||
type PrivateEncryptionKey interface {
|
||||
// create a new decryption object for this private key to decrypt data encrypted to our public key
|
||||
// returns decrypter or nil and error if the private key is in a bad format
|
||||
NewDecrypter() (Decrypter, error)
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### type PublicEncryptionKey
|
||||
|
||||
```go
|
||||
type PublicEncryptionKey interface {
|
||||
// create a new encrypter to encrypt data to this public key
|
||||
NewEncrypter() (Encrypter, error)
|
||||
|
||||
// length of this public key in bytes
|
||||
Len() int
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### type PublicKey
|
||||
|
||||
```go
|
||||
type PublicKey interface {
|
||||
Len() int
|
||||
NewEncrypter() (Encrypter, error)
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### type RSA2048PrivateKey
|
||||
|
||||
```go
|
||||
type RSA2048PrivateKey [512]byte
|
||||
```
|
||||
|
||||
|
||||
#### type RSA2048PublicKey
|
||||
|
||||
```go
|
||||
type RSA2048PublicKey [256]byte
|
||||
```
|
||||
|
||||
|
||||
#### type RSA3072PrivateKey
|
||||
|
||||
```go
|
||||
type RSA3072PrivateKey [786]byte
|
||||
```
|
||||
|
||||
|
||||
#### type RSA3072PublicKey
|
||||
|
||||
```go
|
||||
type RSA3072PublicKey [384]byte
|
||||
```
|
||||
|
||||
|
||||
#### type RSA4096PrivateKey
|
||||
|
||||
```go
|
||||
type RSA4096PrivateKey [1024]byte
|
||||
```
|
||||
|
||||
|
||||
#### type RSA4096PublicKey
|
||||
|
||||
```go
|
||||
type RSA4096PublicKey [512]byte
|
||||
```
|
||||
|
||||
|
||||
#### type Signer
|
||||
|
||||
```go
|
||||
type Signer interface {
|
||||
// sign data with our private key by calling SignHash after hashing the data we are given
|
||||
// return signature or nil signature and error if an error happened
|
||||
Sign(data []byte) (sig []byte, err error)
|
||||
|
||||
// sign hash of data with our private key
|
||||
// return signature or nil signature and error if an error happened
|
||||
SignHash(h []byte) (sig []byte, err error)
|
||||
}
|
||||
```
|
||||
|
||||
type for signing data
|
||||
|
||||
#### type SigningPrivateKey
|
||||
|
||||
```go
|
||||
type SigningPrivateKey interface {
|
||||
// create a new signer to sign data
|
||||
// return signer or nil and error if key format is invalid
|
||||
NewSigner() (Signer, error)
|
||||
// length of this private key
|
||||
Len() int
|
||||
// get public key or return nil and error if invalid key data in private key
|
||||
Public() (SigningPublicKey, error)
|
||||
// generate a new private key, put it into itself
|
||||
// returns itself or nil and error if an error occurs
|
||||
Generate() (SigningPrivateKey, error)
|
||||
}
|
||||
```
|
||||
|
||||
key for signing data
|
||||
|
||||
#### type SigningPublicKey
|
||||
|
||||
```go
|
||||
type SigningPublicKey interface {
|
||||
// create new Verifier to verify the validity of signatures
|
||||
// return verifier or nil and error if key format is invalid
|
||||
NewVerifier() (Verifier, error)
|
||||
// get the size of this public key
|
||||
Len() int
|
||||
}
|
||||
```
|
||||
|
||||
key for verifying data
|
||||
|
||||
#### type Tunnel
|
||||
|
||||
```go
|
||||
type Tunnel struct {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func NewTunnelCrypto
|
||||
|
||||
```go
|
||||
func NewTunnelCrypto(layerKey, ivKey TunnelKey) (t *Tunnel, err error)
|
||||
```
|
||||
|
||||
#### func (*Tunnel) Decrypt
|
||||
|
||||
```go
|
||||
func (t *Tunnel) Decrypt(td *TunnelData)
|
||||
```
|
||||
|
||||
#### func (*Tunnel) Encrypt
|
||||
|
||||
```go
|
||||
func (t *Tunnel) Encrypt(td *TunnelData)
|
||||
```
|
||||
encrypt tunnel data in place
|
||||
|
||||
#### type TunnelData
|
||||
|
||||
```go
|
||||
type TunnelData [1028]byte
|
||||
```
|
||||
|
||||
|
||||
#### type TunnelIV
|
||||
|
||||
```go
|
||||
type TunnelIV []byte
|
||||
```
|
||||
|
||||
The initialization vector for a tunnel message
|
||||
|
||||
#### type TunnelKey
|
||||
|
||||
```go
|
||||
type TunnelKey [32]byte
|
||||
```
|
||||
|
||||
A symetric key for encrypting tunnel messages
|
||||
|
||||
#### type Verifier
|
||||
|
||||
```go
|
||||
type Verifier interface {
|
||||
// verify hashed data with this signing key
|
||||
// return nil on valid signature otherwise error
|
||||
VerifyHash(h, sig []byte) error
|
||||
// verify an unhashed piece of data by hashing it and calling VerifyHash
|
||||
Verify(data, sig []byte) error
|
||||
}
|
||||
```
|
||||
|
||||
type for verifying signatures
|
343
lib/i2np/doc.md
Normal file
343
lib/i2np/doc.md
Normal file
@ -0,0 +1,343 @@
|
||||
# i2np
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/i2np"
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
const (
|
||||
I2NP_MESSAGE_TYPE_DATABASE_STORE = 1
|
||||
I2NP_MESSAGE_TYPE_DATABASE_LOOKUP = 2
|
||||
I2NP_MESSAGE_TYPE_DATABASE_SEARCH_REPLY = 3
|
||||
I2NP_MESSAGE_TYPE_DELIVERY_STATUS = 10
|
||||
I2NP_MESSAGE_TYPE_GARLIC = 11
|
||||
I2NP_MESSAGE_TYPE_TUNNEL_DATA = 18
|
||||
I2NP_MESSAGE_TYPE_TUNNEL_GATEWAY = 19
|
||||
I2NP_MESSAGE_TYPE_DATA = 20
|
||||
I2NP_MESSAGE_TYPE_TUNNEL_BUILD = 21
|
||||
I2NP_MESSAGE_TYPE_TUNNEL_BUILD_REPLY = 22
|
||||
I2NP_MESSAGE_TYPE_VARIABLE_TUNNEL_BUILD = 23
|
||||
I2NP_MESSAGE_TYPE_VARIABLE_TUNNEL_BUILD_REPLY = 24
|
||||
)
|
||||
```
|
||||
|
||||
```go
|
||||
var ERR_BUILD_REQUEST_RECORD_NOT_ENOUGH_DATA = errors.New("not enough i2np build request record data")
|
||||
```
|
||||
|
||||
```go
|
||||
var ERR_I2NP_NOT_ENOUGH_DATA = errors.New("not enough i2np header data")
|
||||
```
|
||||
|
||||
#### func ReadI2NPNTCPData
|
||||
|
||||
```go
|
||||
func ReadI2NPNTCPData(data []byte, size int) ([]byte, error)
|
||||
```
|
||||
|
||||
#### func ReadI2NPNTCPMessageChecksum
|
||||
|
||||
```go
|
||||
func ReadI2NPNTCPMessageChecksum(data []byte) (int, error)
|
||||
```
|
||||
|
||||
#### func ReadI2NPNTCPMessageExpiration
|
||||
|
||||
```go
|
||||
func ReadI2NPNTCPMessageExpiration(data []byte) (datalib.Date, error)
|
||||
```
|
||||
|
||||
#### func ReadI2NPNTCPMessageID
|
||||
|
||||
```go
|
||||
func ReadI2NPNTCPMessageID(data []byte) (int, error)
|
||||
```
|
||||
|
||||
#### func ReadI2NPNTCPMessageSize
|
||||
|
||||
```go
|
||||
func ReadI2NPNTCPMessageSize(data []byte) (int, error)
|
||||
```
|
||||
|
||||
#### func ReadI2NPSSUMessageExpiration
|
||||
|
||||
```go
|
||||
func ReadI2NPSSUMessageExpiration(data []byte) (datalib.Date, error)
|
||||
```
|
||||
|
||||
#### func ReadI2NPType
|
||||
|
||||
```go
|
||||
func ReadI2NPType(data []byte) (int, error)
|
||||
```
|
||||
|
||||
#### type BuildRequestRecord
|
||||
|
||||
```go
|
||||
type BuildRequestRecord struct {
|
||||
ReceiveTunnel tunnel.TunnelID
|
||||
OurIdent common.Hash
|
||||
NextTunnel tunnel.TunnelID
|
||||
NextIdent common.Hash
|
||||
LayerKey session_key.SessionKey
|
||||
IVKey session_key.SessionKey
|
||||
ReplyKey session_key.SessionKey
|
||||
ReplyIV [16]byte
|
||||
Flag int
|
||||
RequestTime time.Time
|
||||
SendMessageID int
|
||||
Padding [29]byte
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func ReadBuildRequestRecord
|
||||
|
||||
```go
|
||||
func ReadBuildRequestRecord(data []byte) (BuildRequestRecord, error)
|
||||
```
|
||||
|
||||
#### type BuildRequestRecordElGamal
|
||||
|
||||
```go
|
||||
type BuildRequestRecordElGamal [528]byte
|
||||
```
|
||||
|
||||
|
||||
#### type BuildRequestRecordElGamalAES
|
||||
|
||||
```go
|
||||
type BuildRequestRecordElGamalAES [528]byte
|
||||
```
|
||||
|
||||
|
||||
#### type BuildResponseRecord
|
||||
|
||||
```go
|
||||
type BuildResponseRecord struct {
|
||||
Hash common.Hash
|
||||
Padding [495]byte
|
||||
Reply byte
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### type BuildResponseRecordELGamal
|
||||
|
||||
```go
|
||||
type BuildResponseRecordELGamal [528]byte
|
||||
```
|
||||
|
||||
|
||||
#### type BuildResponseRecordELGamalAES
|
||||
|
||||
```go
|
||||
type BuildResponseRecordELGamalAES [528]byte
|
||||
```
|
||||
|
||||
|
||||
#### type Data
|
||||
|
||||
```go
|
||||
type Data struct {
|
||||
Length int
|
||||
Data []byte
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### type DatabaseLookup
|
||||
|
||||
```go
|
||||
type DatabaseLookup struct {
|
||||
Key common.Hash
|
||||
From common.Hash
|
||||
Flags byte
|
||||
ReplyTunnelID [4]byte
|
||||
Size int
|
||||
ExcludedPeers []common.Hash
|
||||
ReplyKey session_key.SessionKey
|
||||
|
||||
ReplyTags []session_tag.SessionTag
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### type DatabaseSearchReply
|
||||
|
||||
```go
|
||||
type DatabaseSearchReply struct {
|
||||
Key common.Hash
|
||||
Count int
|
||||
PeerHashes []common.Hash
|
||||
From common.Hash
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### type DatabaseStore
|
||||
|
||||
```go
|
||||
type DatabaseStore struct {
|
||||
Key common.Hash
|
||||
Type byte
|
||||
ReplyToken [4]byte
|
||||
ReplyTunnelID [4]byte
|
||||
ReplyGateway common.Hash
|
||||
Data []byte
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### type DeliveryStatus
|
||||
|
||||
```go
|
||||
type DeliveryStatus struct {
|
||||
MessageID int
|
||||
Timestamp time.Time
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### type Garlic
|
||||
|
||||
```go
|
||||
type Garlic struct {
|
||||
Count int
|
||||
Cloves []GarlicClove
|
||||
Certificate certificate.Certificate
|
||||
MessageID int
|
||||
Expiration time.Time
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### type GarlicClove
|
||||
|
||||
```go
|
||||
type GarlicClove struct {
|
||||
DeliveryInstructions GarlicCloveDeliveryInstructions
|
||||
I2NPMessage I2NPMessage
|
||||
CloveID int
|
||||
Expiration time.Time
|
||||
Certificate certificate.Certificate
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### type GarlicCloveDeliveryInstructions
|
||||
|
||||
```go
|
||||
type GarlicCloveDeliveryInstructions struct {
|
||||
Flag byte
|
||||
SessionKey session_key.SessionKey
|
||||
Hash common.Hash
|
||||
TunnelID tunnel.TunnelID
|
||||
Delay int
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### type GarlicElGamal
|
||||
|
||||
```go
|
||||
type GarlicElGamal []byte
|
||||
```
|
||||
|
||||
|
||||
#### type I2NPMessage
|
||||
|
||||
```go
|
||||
type I2NPMessage []byte
|
||||
```
|
||||
|
||||
|
||||
#### type I2NPNTCPHeader
|
||||
|
||||
```go
|
||||
type I2NPNTCPHeader struct {
|
||||
Type int
|
||||
MessageID int
|
||||
Expiration time.Time
|
||||
Size int
|
||||
Checksum int
|
||||
Data []byte
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func ReadI2NPNTCPHeader
|
||||
|
||||
```go
|
||||
func ReadI2NPNTCPHeader(data []byte) (I2NPNTCPHeader, error)
|
||||
```
|
||||
Read an entire I2NP message and return the parsed header with embedded encrypted
|
||||
data
|
||||
|
||||
#### type I2NPSSUHeader
|
||||
|
||||
```go
|
||||
type I2NPSSUHeader struct {
|
||||
Type int
|
||||
Expiration time.Time
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func ReadI2NPSSUHeader
|
||||
|
||||
```go
|
||||
func ReadI2NPSSUHeader(data []byte) (I2NPSSUHeader, error)
|
||||
```
|
||||
|
||||
#### type TunnelBuild
|
||||
|
||||
```go
|
||||
type TunnelBuild [8]BuildRequestRecord
|
||||
```
|
||||
|
||||
|
||||
#### type TunnelBuildReply
|
||||
|
||||
```go
|
||||
type TunnelBuildReply [8]BuildResponseRecord
|
||||
```
|
||||
|
||||
|
||||
#### type TunnelData
|
||||
|
||||
```go
|
||||
type TunnelData [1028]byte
|
||||
```
|
||||
|
||||
|
||||
#### type TunnelGatway
|
||||
|
||||
```go
|
||||
type TunnelGatway struct {
|
||||
TunnelID tunnel.TunnelID
|
||||
Length int
|
||||
Data []byte
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### type VariableTunnelBuild
|
||||
|
||||
```go
|
||||
type VariableTunnelBuild struct {
|
||||
Count int
|
||||
BuildRequestRecords []BuildRequestRecord
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### type VariableTunnelBuildReply
|
||||
|
||||
```go
|
||||
type VariableTunnelBuildReply struct {
|
||||
Count int
|
||||
BuildResponseRecords []BuildResponseRecord
|
||||
}
|
||||
```
|
12
lib/i2np/fuzz/header/doc.md
Normal file
12
lib/i2np/fuzz/header/doc.md
Normal file
@ -0,0 +1,12 @@
|
||||
# exportable
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/i2np/fuzz/header"
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
#### func Fuzz
|
||||
|
||||
```go
|
||||
func Fuzz(data []byte) int
|
||||
```
|
182
lib/netdb/doc.md
Normal file
182
lib/netdb/doc.md
Normal file
@ -0,0 +1,182 @@
|
||||
# netdb
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/netdb"
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
const CacheFileName = "sizecache.txt"
|
||||
```
|
||||
name of file to hold precomputed size of netdb
|
||||
|
||||
#### type Entry
|
||||
|
||||
```go
|
||||
type Entry struct {
|
||||
*router_info.RouterInfo
|
||||
*lease_set.LeaseSet
|
||||
}
|
||||
```
|
||||
|
||||
netdb entry wraps a router info and provides serialization
|
||||
|
||||
#### func (*Entry) ReadFrom
|
||||
|
||||
```go
|
||||
func (e *Entry) ReadFrom(r io.Reader) (err error)
|
||||
```
|
||||
|
||||
#### func (*Entry) WriteTo
|
||||
|
||||
```go
|
||||
func (e *Entry) WriteTo(w io.Writer) (err error)
|
||||
```
|
||||
|
||||
#### type NetworkDatabase
|
||||
|
||||
```go
|
||||
type NetworkDatabase interface {
|
||||
// obtain a RouterInfo by its hash locally
|
||||
// return a RouterInfo if we found it locally
|
||||
// return nil if the RouterInfo cannot be found locally
|
||||
GetRouterInfo(hash common.Hash) router_info.RouterInfo
|
||||
|
||||
// store a router info locally
|
||||
StoreRouterInfo(ri router_info.RouterInfo)
|
||||
|
||||
// try obtaining more peers with a bootstrap instance until we get minRouters number of router infos
|
||||
// returns error if bootstrap.GetPeers returns an error otherwise returns nil
|
||||
Reseed(b bootstrap.Bootstrap, minRouters int) error
|
||||
|
||||
// return how many router infos we have
|
||||
Size() int
|
||||
|
||||
// Recaculate size of netdb from backend
|
||||
RecalculateSize() error
|
||||
|
||||
// ensure underlying resources exist , i.e. directories, files, configs
|
||||
Ensure() error
|
||||
}
|
||||
```
|
||||
|
||||
i2p network database, storage of i2p RouterInfos
|
||||
|
||||
#### type Resolver
|
||||
|
||||
```go
|
||||
type Resolver interface {
|
||||
// resolve a router info by hash
|
||||
// return a chan that yields the found RouterInfo or nil if it could not be found after timeout
|
||||
Lookup(hash common.Hash, timeout time.Duration) chan router_info.RouterInfo
|
||||
}
|
||||
```
|
||||
|
||||
resolves unknown RouterInfos given the hash of their RouterIdentity
|
||||
|
||||
#### func KademliaResolver
|
||||
|
||||
```go
|
||||
func KademliaResolver(netDb NetworkDatabase, pool *tunnel.Pool) (r Resolver)
|
||||
```
|
||||
create a new resolver that stores result into a NetworkDatabase and uses a
|
||||
tunnel pool for the lookup
|
||||
|
||||
#### type StdNetDB
|
||||
|
||||
```go
|
||||
type StdNetDB struct {
|
||||
DB string
|
||||
RouterInfos map[common.Hash]Entry
|
||||
LeaseSets map[common.Hash]Entry
|
||||
}
|
||||
```
|
||||
|
||||
standard network database implementation using local filesystem skiplist
|
||||
|
||||
#### func NewStdNetDB
|
||||
|
||||
```go
|
||||
func NewStdNetDB(db string) StdNetDB
|
||||
```
|
||||
|
||||
#### func (*StdNetDB) CheckFilePathValid
|
||||
|
||||
```go
|
||||
func (db *StdNetDB) CheckFilePathValid(fpath string) bool
|
||||
```
|
||||
|
||||
#### func (*StdNetDB) Create
|
||||
|
||||
```go
|
||||
func (db *StdNetDB) Create() (err error)
|
||||
```
|
||||
create base network database directory
|
||||
|
||||
#### func (*StdNetDB) Ensure
|
||||
|
||||
```go
|
||||
func (db *StdNetDB) Ensure() (err error)
|
||||
```
|
||||
ensure that the network database exists
|
||||
|
||||
#### func (*StdNetDB) Exists
|
||||
|
||||
```go
|
||||
func (db *StdNetDB) Exists() bool
|
||||
```
|
||||
return true if the network db directory exists and is writable
|
||||
|
||||
#### func (*StdNetDB) GetRouterInfo
|
||||
|
||||
```go
|
||||
func (db *StdNetDB) GetRouterInfo(hash common.Hash) (chnl chan router_info.RouterInfo)
|
||||
```
|
||||
|
||||
#### func (*StdNetDB) Path
|
||||
|
||||
```go
|
||||
func (db *StdNetDB) Path() string
|
||||
```
|
||||
get netdb path
|
||||
|
||||
#### func (*StdNetDB) RecalculateSize
|
||||
|
||||
```go
|
||||
func (db *StdNetDB) RecalculateSize() (err error)
|
||||
```
|
||||
recalculateSize recalculates cached size of netdb
|
||||
|
||||
#### func (*StdNetDB) Reseed
|
||||
|
||||
```go
|
||||
func (db *StdNetDB) Reseed(b bootstrap.Bootstrap, minRouters int) (err error)
|
||||
```
|
||||
reseed if we have less than minRouters known routers returns error if reseed
|
||||
failed
|
||||
|
||||
#### func (*StdNetDB) Save
|
||||
|
||||
```go
|
||||
func (db *StdNetDB) Save() (err error)
|
||||
```
|
||||
|
||||
#### func (*StdNetDB) SaveEntry
|
||||
|
||||
```go
|
||||
func (db *StdNetDB) SaveEntry(e *Entry) (err error)
|
||||
```
|
||||
|
||||
#### func (*StdNetDB) Size
|
||||
|
||||
```go
|
||||
func (db *StdNetDB) Size() (routers int)
|
||||
```
|
||||
return how many routers we know about in our network database
|
||||
|
||||
#### func (*StdNetDB) SkiplistFile
|
||||
|
||||
```go
|
||||
func (db *StdNetDB) SkiplistFile(hash common.Hash) (fpath string)
|
||||
```
|
||||
get the skiplist file that a RouterInfo with this hash would go in
|
27
lib/netdb/reseed/doc.md
Normal file
27
lib/netdb/reseed/doc.md
Normal file
@ -0,0 +1,27 @@
|
||||
# reseed
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/netdb/reseed"
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
const (
|
||||
I2pUserAgent = "Wget/1.11.4"
|
||||
)
|
||||
```
|
||||
|
||||
#### type Reseed
|
||||
|
||||
```go
|
||||
type Reseed struct {
|
||||
net.Dialer
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func (Reseed) SingleReseed
|
||||
|
||||
```go
|
||||
func (r Reseed) SingleReseed(uri string) ([]router_info.RouterInfo, error)
|
||||
```
|
58
lib/router/doc.md
Normal file
58
lib/router/doc.md
Normal file
@ -0,0 +1,58 @@
|
||||
# router
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/router"
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
#### type Router
|
||||
|
||||
```go
|
||||
type Router struct {
|
||||
}
|
||||
```
|
||||
|
||||
i2p router type
|
||||
|
||||
#### func CreateRouter
|
||||
|
||||
```go
|
||||
func CreateRouter() (r *Router, err error)
|
||||
```
|
||||
create router with default configuration
|
||||
|
||||
#### func FromConfig
|
||||
|
||||
```go
|
||||
func FromConfig(c *config.RouterConfig) (r *Router, err error)
|
||||
```
|
||||
create router from configuration
|
||||
|
||||
#### func (*Router) Close
|
||||
|
||||
```go
|
||||
func (r *Router) Close() error
|
||||
```
|
||||
Close closes any internal state and finallizes router resources so that nothing
|
||||
can start up again
|
||||
|
||||
#### func (*Router) Start
|
||||
|
||||
```go
|
||||
func (r *Router) Start()
|
||||
```
|
||||
Start starts router mainloop
|
||||
|
||||
#### func (*Router) Stop
|
||||
|
||||
```go
|
||||
func (r *Router) Stop()
|
||||
```
|
||||
Stop starts stopping internal state of router
|
||||
|
||||
#### func (*Router) Wait
|
||||
|
||||
```go
|
||||
func (r *Router) Wait()
|
||||
```
|
||||
Wait blocks until router is fully stopped
|
189
lib/su3/doc.md
Normal file
189
lib/su3/doc.md
Normal file
@ -0,0 +1,189 @@
|
||||
# su3
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/su3"
|
||||
|
||||
Package su3 implements reading the SU3 file format.
|
||||
|
||||
SU3 files provide content that is signed by a known identity. They are used to
|
||||
distribute many types of data, including reseed files, plugins, blocklists, and
|
||||
more.
|
||||
|
||||
See: https://geti2p.net/spec/updates#su3-file-specification
|
||||
|
||||
The Read() function takes an io.Reader, and it returns a *SU3. The *SU3 contains
|
||||
the SU3 file metadata, such as the type of the content and the signer ID. In
|
||||
order to get the file contents, one must pass in the public key associated with
|
||||
the file's signer, so that the signature can be validated. The content can still
|
||||
be read without passing in the key, but after returning the full content the
|
||||
error ErrInvalidSignature will be returned.
|
||||
|
||||
Example usage:
|
||||
|
||||
// Let's say we are reading an SU3 file from an HTTP body, which is an io.Reader.
|
||||
su3File, err := su3.Read(body)
|
||||
if err != nil {
|
||||
// Handle error.
|
||||
}
|
||||
// Look up this signer's key.
|
||||
key := somehow_lookup_the_key(su3File.SignerID)
|
||||
// Read the content.
|
||||
contentReader := su3File.Content(key)
|
||||
bytes, err := ioutil.ReadAll(contentReader)
|
||||
if errors.Is(err, su3.ErrInvalidSignature) {
|
||||
// The signature is invalid, OR a nil key was provided.
|
||||
} else if err != nil {
|
||||
// Handle error.
|
||||
}
|
||||
|
||||
If you want to parse from a []byte, you can wrap it like this:
|
||||
|
||||
mySU3FileBytes := []byte{0x00, 0x01, 0x02, 0x03}
|
||||
su3File, err := su3.Read(bytes.NewReader(mySU3FileBytes))
|
||||
|
||||
One of the advantages of this library's design is that you can avoid buffering
|
||||
the file contents in memory. Here's how you would stream from an HTTP body
|
||||
directly to disk:
|
||||
|
||||
su3File, err := su3.Read(body)
|
||||
if err != nil {
|
||||
// Handle error.
|
||||
}
|
||||
// Look up this signer's key.
|
||||
key := somehow_lookup_the_key(su3File.SignerID)
|
||||
// Stream directly to disk.
|
||||
f, err := os.Create("my_file.txt")
|
||||
if err != nil {
|
||||
// Handle error.
|
||||
}
|
||||
_, err := io.Copy(f, su3File.Content(key))
|
||||
if errors.Is(err, su3.ErrInvalidSignature) {
|
||||
// The signature is invalid, OR a nil key was provided.
|
||||
// Don't trust the file, delete it!
|
||||
} else if err != nil {
|
||||
// Handle error.
|
||||
}
|
||||
|
||||
Note: if you want to read the content, the Content() io.Reader must be read
|
||||
*before* the Signature() io.Reader. If you read the signature first, the content
|
||||
bytes will be thrown away. If you then attempt to read the content, you will get
|
||||
an error. For clarification, see TestReadSignatureFirst.
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
var (
|
||||
ErrMissingMagicBytes = errors.New("missing magic bytes")
|
||||
ErrMissingUnusedByte6 = errors.New("missing unused byte 6")
|
||||
ErrMissingFileFormatVersion = errors.New("missing or incorrect file format version")
|
||||
ErrMissingSignatureType = errors.New("missing or invalid signature type")
|
||||
ErrUnsupportedSignatureType = errors.New("unsupported signature type")
|
||||
ErrMissingSignatureLength = errors.New("missing signature length")
|
||||
ErrMissingUnusedByte12 = errors.New("missing unused byte 12")
|
||||
ErrMissingVersionLength = errors.New("missing version length")
|
||||
ErrVersionTooShort = errors.New("version length too short")
|
||||
ErrMissingUnusedByte14 = errors.New("missing unused byte 14")
|
||||
ErrMissingSignerIDLength = errors.New("missing signer ID length")
|
||||
ErrMissingContentLength = errors.New("missing content length")
|
||||
ErrMissingUnusedByte24 = errors.New("missing unused byte 24")
|
||||
ErrMissingFileType = errors.New("missing or invalid file type")
|
||||
ErrMissingUnusedByte26 = errors.New("missing unused byte 26")
|
||||
ErrMissingContentType = errors.New("missing or invalid content type")
|
||||
ErrMissingUnusedBytes28To39 = errors.New("missing unused bytes 28-39")
|
||||
ErrMissingVersion = errors.New("missing version")
|
||||
ErrMissingSignerID = errors.New("missing signer ID")
|
||||
ErrMissingContent = errors.New("missing content")
|
||||
ErrMissingSignature = errors.New("missing signature")
|
||||
ErrInvalidPublicKey = errors.New("invalid public key")
|
||||
ErrInvalidSignature = errors.New("invalid signature")
|
||||
)
|
||||
```
|
||||
|
||||
#### type ContentType
|
||||
|
||||
```go
|
||||
type ContentType string
|
||||
```
|
||||
|
||||
|
||||
```go
|
||||
const (
|
||||
UNKNOWN ContentType = "unknown"
|
||||
ROUTER_UPDATE ContentType = "router_update"
|
||||
PLUGIN ContentType = "plugin"
|
||||
RESEED ContentType = "reseed"
|
||||
NEWS ContentType = "news"
|
||||
BLOCKLIST ContentType = "blocklist"
|
||||
)
|
||||
```
|
||||
|
||||
#### type FileType
|
||||
|
||||
```go
|
||||
type FileType string
|
||||
```
|
||||
|
||||
|
||||
```go
|
||||
const (
|
||||
ZIP FileType = "zip"
|
||||
XML FileType = "xml"
|
||||
HTML FileType = "html"
|
||||
XML_GZIP FileType = "xml.gz"
|
||||
TXT_GZIP FileType = "txt.gz"
|
||||
DMG FileType = "dmg"
|
||||
EXE FileType = "exe"
|
||||
)
|
||||
```
|
||||
|
||||
#### type SU3
|
||||
|
||||
```go
|
||||
type SU3 struct {
|
||||
SignatureType SignatureType
|
||||
SignatureLength uint16
|
||||
ContentLength uint64
|
||||
FileType FileType
|
||||
ContentType ContentType
|
||||
Version string
|
||||
SignerID string
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func Read
|
||||
|
||||
```go
|
||||
func Read(reader io.Reader) (su3 *SU3, err error)
|
||||
```
|
||||
|
||||
#### func (*SU3) Content
|
||||
|
||||
```go
|
||||
func (su3 *SU3) Content(publicKey interface{}) io.Reader
|
||||
```
|
||||
|
||||
#### func (*SU3) Signature
|
||||
|
||||
```go
|
||||
func (su3 *SU3) Signature() io.Reader
|
||||
```
|
||||
|
||||
#### type SignatureType
|
||||
|
||||
```go
|
||||
type SignatureType string
|
||||
```
|
||||
|
||||
|
||||
```go
|
||||
const (
|
||||
DSA_SHA1 SignatureType = "DSA-SHA1"
|
||||
ECDSA_SHA256_P256 SignatureType = "ECDSA-SHA256-P256"
|
||||
ECDSA_SHA384_P384 SignatureType = "ECDSA-SHA384-P384"
|
||||
ECDSA_SHA512_P521 SignatureType = "ECDSA-SHA512-P521"
|
||||
RSA_SHA256_2048 SignatureType = "RSA-SHA256-2048"
|
||||
RSA_SHA384_3072 SignatureType = "RSA-SHA384-3072"
|
||||
RSA_SHA512_4096 SignatureType = "RSA-SHA512-4096"
|
||||
EdDSA_SHA512_Ed25519ph SignatureType = "EdDSA-SHA512-Ed25519ph"
|
||||
)
|
||||
```
|
122
lib/transport/doc.md
Normal file
122
lib/transport/doc.md
Normal file
@ -0,0 +1,122 @@
|
||||
# transport
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/transport"
|
||||
|
||||
*
|
||||
|
||||
i2np messages transports
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
var ErrNoTransportAvailable = errors.New("no transports available")
|
||||
```
|
||||
error for when we have no transports available to use
|
||||
|
||||
#### type Transport
|
||||
|
||||
```go
|
||||
type Transport interface {
|
||||
// Accept accepts an incoming session.
|
||||
Accept() (net.Conn, error)
|
||||
|
||||
// Addr returns an
|
||||
Addr() net.Addr
|
||||
|
||||
// Set the router identity for this transport.
|
||||
// will bind if the underlying socket is not already
|
||||
// if the underlying socket is already bound update the RouterIdentity
|
||||
// returns any errors that happen if they do
|
||||
SetIdentity(ident router_identity.RouterIdentity) error
|
||||
|
||||
// Obtain a transport session with a router given its RouterInfo.
|
||||
// If a session with this router is NOT already made attempt to create one and block until made or until an error happens
|
||||
// returns an established TransportSession and nil on success
|
||||
// returns nil and an error on error
|
||||
GetSession(routerInfo router_info.RouterInfo) (TransportSession, error)
|
||||
|
||||
// return true if a routerInfo is compatable with this transport
|
||||
Compatable(routerInfo router_info.RouterInfo) bool
|
||||
|
||||
// close the transport cleanly
|
||||
// blocks until done
|
||||
// returns an error if one happens
|
||||
Close() error
|
||||
|
||||
// get the name of this tranport as a string
|
||||
Name() string
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### type TransportMuxer
|
||||
|
||||
```go
|
||||
type TransportMuxer struct {
|
||||
}
|
||||
```
|
||||
|
||||
muxes multiple transports into 1 Transport implements transport.Transport
|
||||
|
||||
#### func Mux
|
||||
|
||||
```go
|
||||
func Mux(t ...Transport) (tmux *TransportMuxer)
|
||||
```
|
||||
mux a bunch of transports together
|
||||
|
||||
#### func (*TransportMuxer) Close
|
||||
|
||||
```go
|
||||
func (tmux *TransportMuxer) Close() (err error)
|
||||
```
|
||||
close every transport that this transport muxer has
|
||||
|
||||
#### func (*TransportMuxer) Compatable
|
||||
|
||||
```go
|
||||
func (tmux *TransportMuxer) Compatable(routerInfo router_info.RouterInfo) (compat bool)
|
||||
```
|
||||
is there a transport that we mux that is compatable with this router info?
|
||||
|
||||
#### func (*TransportMuxer) GetSession
|
||||
|
||||
```go
|
||||
func (tmux *TransportMuxer) GetSession(routerInfo router_info.RouterInfo) (s TransportSession, err error)
|
||||
```
|
||||
get a transport session given a router info return session and nil if successful
|
||||
return nil and ErrNoTransportAvailable if we failed to get a session
|
||||
|
||||
#### func (*TransportMuxer) Name
|
||||
|
||||
```go
|
||||
func (tmux *TransportMuxer) Name() string
|
||||
```
|
||||
the name of this transport with the names of all the ones that we mux
|
||||
|
||||
#### func (*TransportMuxer) SetIdentity
|
||||
|
||||
```go
|
||||
func (tmux *TransportMuxer) SetIdentity(ident router_identity.RouterIdentity) (err error)
|
||||
```
|
||||
set the identity for every transport
|
||||
|
||||
#### type TransportSession
|
||||
|
||||
```go
|
||||
type TransportSession interface {
|
||||
// queue an i2np message to be sent over the session
|
||||
// will block as long as the send queue is full
|
||||
// does not block if the queue is not full
|
||||
QueueSendI2NP(msg i2np.I2NPMessage)
|
||||
// return how many i2np messages are not completely sent yet
|
||||
SendQueueSize() int
|
||||
// blocking read the next fully recv'd i2np message from this session
|
||||
ReadNextI2NP() (i2np.I2NPMessage, error)
|
||||
// close the session cleanly
|
||||
// returns any errors that happen while closing the session
|
||||
Close() error
|
||||
}
|
||||
```
|
||||
|
||||
a session between 2 routers for tranmitting i2np messages securly
|
68
lib/transport/messages/doc.md
Normal file
68
lib/transport/messages/doc.md
Normal file
@ -0,0 +1,68 @@
|
||||
# ntcp
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/transport/messages"
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
const (
|
||||
MessageTypeSessionRequest = 0x00
|
||||
MessageTypeSessionCreated = 0x01
|
||||
MessageTypeSessionConfirmed = 0x02
|
||||
MessageTypeData = 0x03
|
||||
)
|
||||
```
|
||||
|
||||
#### type Message
|
||||
|
||||
```go
|
||||
type Message interface {
|
||||
// Type returns the message type
|
||||
Type() MessageType
|
||||
// Payload returns the message payload
|
||||
Payload() []byte
|
||||
// PayloadSize returns the message payload size
|
||||
PayloadSize() int
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### type MessageType
|
||||
|
||||
```go
|
||||
type MessageType uint8
|
||||
```
|
||||
|
||||
|
||||
#### type SessionRequest
|
||||
|
||||
```go
|
||||
type SessionRequest struct {
|
||||
XContent []byte // 32-byte X value
|
||||
|
||||
Padding []byte // padding of message 1
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func (*SessionRequest) Payload
|
||||
|
||||
```go
|
||||
func (sr *SessionRequest) Payload() []byte
|
||||
```
|
||||
Payload returns the message payload
|
||||
|
||||
#### func (*SessionRequest) PayloadSize
|
||||
|
||||
```go
|
||||
func (sr *SessionRequest) PayloadSize() int
|
||||
```
|
||||
PayloadSize returns the message payload size
|
||||
|
||||
#### func (*SessionRequest) Type
|
||||
|
||||
```go
|
||||
func (sr *SessionRequest) Type() MessageType
|
||||
```
|
||||
Type returns the message type
|
270
lib/transport/noise/doc.md
Normal file
270
lib/transport/noise/doc.md
Normal file
@ -0,0 +1,270 @@
|
||||
# noise
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/transport/noise"
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
const FlushLimit = 640 * 1024
|
||||
```
|
||||
|
||||
#### type Noise
|
||||
|
||||
```go
|
||||
type Noise struct {
|
||||
noise.Config
|
||||
router_address.RouterAddress // always the local addr
|
||||
*noise.HandshakeState
|
||||
sync.Mutex
|
||||
|
||||
HandshakeStateResponsibility bool
|
||||
}
|
||||
```
|
||||
|
||||
wrapper around flynn/noise with just enough options exposed to enable
|
||||
configuring NTCP2 possible and/or relatively intuitive
|
||||
|
||||
#### func NewNoise
|
||||
|
||||
```go
|
||||
func NewNoise(ra router_address.RouterAddress) (ns *Noise, err error)
|
||||
```
|
||||
|
||||
#### func (*Noise) Addr
|
||||
|
||||
```go
|
||||
func (ns *Noise) Addr() net.Addr
|
||||
```
|
||||
|
||||
#### func (*Noise) DialNoise
|
||||
|
||||
```go
|
||||
func (ns *Noise) DialNoise(addr router_address.RouterAddress) (conn net.Conn, err error)
|
||||
```
|
||||
|
||||
#### func (*Noise) ListenNoise
|
||||
|
||||
```go
|
||||
func (ns *Noise) ListenNoise() (list NoiseListener, err error)
|
||||
```
|
||||
|
||||
#### func (*Noise) LocalAddr
|
||||
|
||||
```go
|
||||
func (ns *Noise) LocalAddr() net.Addr
|
||||
```
|
||||
|
||||
#### type NoiseConn
|
||||
|
||||
```go
|
||||
type NoiseConn struct {
|
||||
*Noise
|
||||
net.Conn
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func (*NoiseConn) Close
|
||||
|
||||
```go
|
||||
func (nc *NoiseConn) Close() error
|
||||
```
|
||||
Close implements net.Conn.
|
||||
|
||||
#### func (*NoiseConn) Frame
|
||||
|
||||
```go
|
||||
func (nc *NoiseConn) Frame(header, body []byte) (err error)
|
||||
```
|
||||
|
||||
#### func (*NoiseConn) HandshakeStateCreate
|
||||
|
||||
```go
|
||||
func (nc *NoiseConn) HandshakeStateCreate(out, payload []byte) (by []byte, err error)
|
||||
```
|
||||
|
||||
#### func (*NoiseConn) HandshakeStateRead
|
||||
|
||||
```go
|
||||
func (nc *NoiseConn) HandshakeStateRead() (err error)
|
||||
```
|
||||
HandshakeStateRead reads a handshake's state off the socket for storage in the
|
||||
NoiseConn.HandshakeState
|
||||
|
||||
#### func (*NoiseConn) LocalAddr
|
||||
|
||||
```go
|
||||
func (nc *NoiseConn) LocalAddr() net.Addr
|
||||
```
|
||||
LocalAddr implements net.Conn.
|
||||
|
||||
#### func (*NoiseConn) Read
|
||||
|
||||
```go
|
||||
func (nc *NoiseConn) Read(b []byte) (n int, err error)
|
||||
```
|
||||
Read implements net.Conn.
|
||||
|
||||
#### func (*NoiseConn) ReadMsg
|
||||
|
||||
```go
|
||||
func (nc *NoiseConn) ReadMsg(b []byte) (by []byte, err error)
|
||||
```
|
||||
|
||||
#### func (*NoiseConn) RemoteAddr
|
||||
|
||||
```go
|
||||
func (nc *NoiseConn) RemoteAddr() net.Addr
|
||||
```
|
||||
RemoteAddr implements net.Conn.
|
||||
|
||||
#### func (*NoiseConn) SetCipherStates
|
||||
|
||||
```go
|
||||
func (nc *NoiseConn) SetCipherStates(cs1, cs2 *noise.CipherState)
|
||||
```
|
||||
|
||||
#### func (*NoiseConn) SetDeadline
|
||||
|
||||
```go
|
||||
func (nc *NoiseConn) SetDeadline(t time.Time) error
|
||||
```
|
||||
SetDeadline implements net.Conn.
|
||||
|
||||
#### func (*NoiseConn) SetReadDeadline
|
||||
|
||||
```go
|
||||
func (nc *NoiseConn) SetReadDeadline(t time.Time) error
|
||||
```
|
||||
SetReadDeadline implements net.Conn.
|
||||
|
||||
#### func (*NoiseConn) SetWriteDeadline
|
||||
|
||||
```go
|
||||
func (nc *NoiseConn) SetWriteDeadline(t time.Time) error
|
||||
```
|
||||
SetWriteDeadline implements net.Conn.
|
||||
|
||||
#### func (*NoiseConn) Write
|
||||
|
||||
```go
|
||||
func (nc *NoiseConn) Write(b []byte) (n int, err error)
|
||||
```
|
||||
Write implements net.Conn.
|
||||
|
||||
#### type NoiseListener
|
||||
|
||||
```go
|
||||
type NoiseListener struct {
|
||||
*Noise
|
||||
net.Listener
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func (*NoiseListener) Accept
|
||||
|
||||
```go
|
||||
func (ns *NoiseListener) Accept() (net.Conn, error)
|
||||
```
|
||||
Accept implements net.Listener.
|
||||
|
||||
#### func (*NoiseListener) Addr
|
||||
|
||||
```go
|
||||
func (ns *NoiseListener) Addr() net.Addr
|
||||
```
|
||||
Addr implements net.Listener.
|
||||
|
||||
#### func (*NoiseListener) Close
|
||||
|
||||
```go
|
||||
func (ns *NoiseListener) Close() error
|
||||
```
|
||||
Close implements net.Listener.
|
||||
|
||||
#### type NoisePacketConn
|
||||
|
||||
```go
|
||||
type NoisePacketConn struct {
|
||||
*Noise
|
||||
// this is always a actually a PacketConn
|
||||
net.Conn
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func (*NoisePacketConn) Close
|
||||
|
||||
```go
|
||||
func (n *NoisePacketConn) Close() error
|
||||
```
|
||||
Close implements net.PacketConn. Subtle: this method shadows the method
|
||||
(Conn).Close of NoisePacketConn.Conn.
|
||||
|
||||
#### func (*NoisePacketConn) LocalAddr
|
||||
|
||||
```go
|
||||
func (n *NoisePacketConn) LocalAddr() net.Addr
|
||||
```
|
||||
LocalAddr implements net.PacketConn.
|
||||
|
||||
#### func (*NoisePacketConn) Read
|
||||
|
||||
```go
|
||||
func (*NoisePacketConn) Read(b []byte) (n int, err error)
|
||||
```
|
||||
Read implements net.Conn.
|
||||
|
||||
#### func (*NoisePacketConn) ReadFrom
|
||||
|
||||
```go
|
||||
func (*NoisePacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)
|
||||
```
|
||||
ReadFrom implements net.PacketConn.
|
||||
|
||||
#### func (*NoisePacketConn) RemoteAddr
|
||||
|
||||
```go
|
||||
func (n *NoisePacketConn) RemoteAddr() net.Addr
|
||||
```
|
||||
RemoteAddr implements net.Conn.
|
||||
|
||||
#### func (*NoisePacketConn) SetDeadline
|
||||
|
||||
```go
|
||||
func (n *NoisePacketConn) SetDeadline(t time.Time) error
|
||||
```
|
||||
SetDeadline implements net.PacketConn. Subtle: this method shadows the method
|
||||
(PacketConn).SetDeadline of NoisePacketConn.PacketConn.
|
||||
|
||||
#### func (*NoisePacketConn) SetReadDeadline
|
||||
|
||||
```go
|
||||
func (n *NoisePacketConn) SetReadDeadline(t time.Time) error
|
||||
```
|
||||
SetReadDeadline implements net.PacketConn. Subtle: this method shadows the
|
||||
method (PacketConn).SetReadDeadline of NoisePacketConn.PacketConn.
|
||||
|
||||
#### func (*NoisePacketConn) SetWriteDeadline
|
||||
|
||||
```go
|
||||
func (n *NoisePacketConn) SetWriteDeadline(t time.Time) error
|
||||
```
|
||||
SetWriteDeadline implements net.PacketConn. Subtle: this method shadows the
|
||||
method (PacketConn).SetWriteDeadline of NoisePacketConn.PacketConn.
|
||||
|
||||
#### func (*NoisePacketConn) Write
|
||||
|
||||
```go
|
||||
func (*NoisePacketConn) Write(b []byte) (n int, err error)
|
||||
```
|
||||
Write implements net.Conn.
|
||||
|
||||
#### func (*NoisePacketConn) WriteTo
|
||||
|
||||
```go
|
||||
func (*NoisePacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error)
|
||||
```
|
||||
WriteTo implements net.PacketConn.
|
30
lib/transport/ntcp/doc.md
Normal file
30
lib/transport/ntcp/doc.md
Normal file
@ -0,0 +1,30 @@
|
||||
# ntcp
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/transport/ntcp"
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
const (
|
||||
NTCP_PROTOCOL_VERSION = 2
|
||||
NTCP_PROTOCOL_NAME = "NTCP2"
|
||||
NTCP_MESSAGE_MAX_SIZE = 65537
|
||||
)
|
||||
```
|
||||
|
||||
#### type Session
|
||||
|
||||
```go
|
||||
type Session struct{}
|
||||
```
|
||||
|
||||
Session implements TransportSession An established transport session
|
||||
|
||||
#### type Transport
|
||||
|
||||
```go
|
||||
type Transport struct{}
|
||||
```
|
||||
|
||||
Transport is an ntcp transport implementing transport.Transport interface
|
7
lib/transport/ssu/doc.md
Normal file
7
lib/transport/ssu/doc.md
Normal file
@ -0,0 +1,7 @@
|
||||
# ssu
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/transport/ssu"
|
||||
|
||||
i2p ssu transport implementation
|
||||
|
||||
## Usage
|
259
lib/tunnel/doc.md
Normal file
259
lib/tunnel/doc.md
Normal file
@ -0,0 +1,259 @@
|
||||
# tunnel
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/tunnel"
|
||||
|
||||
i2p garlic tunnel implementation
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
const (
|
||||
DT_LOCAL = iota
|
||||
DT_TUNNEL
|
||||
DT_ROUTER
|
||||
DT_UNUSED
|
||||
)
|
||||
```
|
||||
|
||||
```go
|
||||
const (
|
||||
FIRST_FRAGMENT = iota
|
||||
FOLLOW_ON_FRAGMENT
|
||||
)
|
||||
```
|
||||
|
||||
```go
|
||||
const (
|
||||
FLAG_SIZE = 1
|
||||
TUNNEL_ID_SIZE = 4
|
||||
HASH_SIZE = 32
|
||||
DELAY_SIZE = 1
|
||||
MESSAGE_ID_SIZE = 4
|
||||
EXTENDED_OPTIONS_MIN_SIZE = 2
|
||||
SIZE_FIELD_SIZE = 2
|
||||
)
|
||||
```
|
||||
|
||||
#### type DecryptedTunnelMessage
|
||||
|
||||
```go
|
||||
type DecryptedTunnelMessage [1028]byte
|
||||
```
|
||||
|
||||
|
||||
#### func (DecryptedTunnelMessage) Checksum
|
||||
|
||||
```go
|
||||
func (decrypted_tunnel_message DecryptedTunnelMessage) Checksum() crypto.TunnelIV
|
||||
```
|
||||
|
||||
#### func (DecryptedTunnelMessage) DeliveryInstructionsWithFragments
|
||||
|
||||
```go
|
||||
func (decrypted_tunnel_message DecryptedTunnelMessage) DeliveryInstructionsWithFragments() []DeliveryInstructionsWithFragment
|
||||
```
|
||||
Returns a slice of DeliveryInstructionWithFragment structures, which all of the
|
||||
Delivery Instructions in the tunnel message and their corresponding
|
||||
MessageFragment structures.
|
||||
|
||||
#### func (DecryptedTunnelMessage) ID
|
||||
|
||||
```go
|
||||
func (decrypted_tunnel_message DecryptedTunnelMessage) ID() TunnelID
|
||||
```
|
||||
|
||||
#### func (DecryptedTunnelMessage) IV
|
||||
|
||||
```go
|
||||
func (decrypted_tunnel_message DecryptedTunnelMessage) IV() crypto.TunnelIV
|
||||
```
|
||||
|
||||
#### type DelayFactor
|
||||
|
||||
```go
|
||||
type DelayFactor byte
|
||||
```
|
||||
|
||||
|
||||
#### type DeliveryInstructions
|
||||
|
||||
```go
|
||||
type DeliveryInstructions []byte
|
||||
```
|
||||
|
||||
|
||||
#### func (DeliveryInstructions) Delay
|
||||
|
||||
```go
|
||||
func (delivery_instructions DeliveryInstructions) Delay() (delay_factor DelayFactor, err error)
|
||||
```
|
||||
Return the DelayFactor if present and any errors encountered parsing the
|
||||
DeliveryInstructions.
|
||||
|
||||
#### func (DeliveryInstructions) DeliveryType
|
||||
|
||||
```go
|
||||
func (delivery_instructions DeliveryInstructions) DeliveryType() (byte, error)
|
||||
```
|
||||
Return the delivery type for these DeliveryInstructions, can be of type
|
||||
DT_LOCAL, DT_TUNNEL, DT_ROUTER, or DT_UNUSED.
|
||||
|
||||
#### func (DeliveryInstructions) ExtendedOptions
|
||||
|
||||
```go
|
||||
func (delivery_instructions DeliveryInstructions) ExtendedOptions() (data []byte, err error)
|
||||
```
|
||||
Return the Extended Options data if present, or an error if not present.
|
||||
Extended Options in unimplemented in the Java router and the presence of
|
||||
extended options will generate a warning.
|
||||
|
||||
#### func (DeliveryInstructions) FragmentNumber
|
||||
|
||||
```go
|
||||
func (delivery_instructions DeliveryInstructions) FragmentNumber() (int, error)
|
||||
```
|
||||
Read the integer stored in the 6-1 bits of a FOLLOW_ON_FRAGMENT's flag,
|
||||
indicating the fragment number.
|
||||
|
||||
#### func (DeliveryInstructions) FragmentSize
|
||||
|
||||
```go
|
||||
func (delivery_instructions DeliveryInstructions) FragmentSize() (frag_size uint16, err error)
|
||||
```
|
||||
Return the size of the associated I2NP fragment and an error if the data is
|
||||
unavailable.
|
||||
|
||||
#### func (DeliveryInstructions) Fragmented
|
||||
|
||||
```go
|
||||
func (delivery_instructions DeliveryInstructions) Fragmented() (bool, error)
|
||||
```
|
||||
Returns true if the Delivery Instructions are fragmented or false if the
|
||||
following data contains the entire message
|
||||
|
||||
#### func (DeliveryInstructions) HasDelay
|
||||
|
||||
```go
|
||||
func (delivery_instructions DeliveryInstructions) HasDelay() (bool, error)
|
||||
```
|
||||
Check if the delay bit is set. This feature in unimplemented in the Java router.
|
||||
|
||||
#### func (DeliveryInstructions) HasExtendedOptions
|
||||
|
||||
```go
|
||||
func (delivery_instructions DeliveryInstructions) HasExtendedOptions() (bool, error)
|
||||
```
|
||||
Check if the extended options bit is set. This feature in unimplemented in the
|
||||
Java router.
|
||||
|
||||
#### func (DeliveryInstructions) HasHash
|
||||
|
||||
```go
|
||||
func (delivery_instructions DeliveryInstructions) HasHash() (bool, error)
|
||||
```
|
||||
|
||||
#### func (DeliveryInstructions) HasTunnelID
|
||||
|
||||
```go
|
||||
func (delivery_instructions DeliveryInstructions) HasTunnelID() (bool, error)
|
||||
```
|
||||
Check if the DeliveryInstructions is of type DT_TUNNEL.
|
||||
|
||||
#### func (DeliveryInstructions) Hash
|
||||
|
||||
```go
|
||||
func (delivery_instructions DeliveryInstructions) Hash() (hash common.Hash, err error)
|
||||
```
|
||||
Return the hash for these DeliveryInstructions, which varies by hash type.
|
||||
|
||||
If the type is DT_TUNNEL, hash is the SHA256 of the gateway router, if
|
||||
the type is DT_ROUTER it is the SHA256 of the router.
|
||||
|
||||
#### func (DeliveryInstructions) LastFollowOnFragment
|
||||
|
||||
```go
|
||||
func (delivery_instructions DeliveryInstructions) LastFollowOnFragment() (bool, error)
|
||||
```
|
||||
Read the value of the 0 bit of a FOLLOW_ON_FRAGMENT, which is set to 1 to
|
||||
indicate the last fragment.
|
||||
|
||||
#### func (DeliveryInstructions) MessageID
|
||||
|
||||
```go
|
||||
func (delivery_instructions DeliveryInstructions) MessageID() (msgid uint32, err error)
|
||||
```
|
||||
Return the I2NP Message ID or 0 and an error if the data is not available for
|
||||
this DeliveryInstructions.
|
||||
|
||||
#### func (DeliveryInstructions) TunnelID
|
||||
|
||||
```go
|
||||
func (delivery_instructions DeliveryInstructions) TunnelID() (tunnel_id uint32, err error)
|
||||
```
|
||||
Return the tunnel ID in this DeliveryInstructions or 0 and an error if the
|
||||
DeliveryInstructions are not of type DT_TUNNEL.
|
||||
|
||||
#### func (DeliveryInstructions) Type
|
||||
|
||||
```go
|
||||
func (delivery_instructions DeliveryInstructions) Type() (int, error)
|
||||
```
|
||||
Return if the DeliveryInstructions are of type FIRST_FRAGMENT or
|
||||
FOLLOW_ON_FRAGMENT.
|
||||
|
||||
#### type DeliveryInstructionsWithFragment
|
||||
|
||||
```go
|
||||
type DeliveryInstructionsWithFragment struct {
|
||||
DeliveryInstructions DeliveryInstructions
|
||||
MessageFragment []byte
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### type EncryptedTunnelMessage
|
||||
|
||||
```go
|
||||
type EncryptedTunnelMessage crypto.TunnelData
|
||||
```
|
||||
|
||||
|
||||
#### func (EncryptedTunnelMessage) Data
|
||||
|
||||
```go
|
||||
func (tm EncryptedTunnelMessage) Data() crypto.TunnelIV
|
||||
```
|
||||
|
||||
#### func (EncryptedTunnelMessage) ID
|
||||
|
||||
```go
|
||||
func (tm EncryptedTunnelMessage) ID() (tid TunnelID)
|
||||
```
|
||||
|
||||
#### func (EncryptedTunnelMessage) IV
|
||||
|
||||
```go
|
||||
func (tm EncryptedTunnelMessage) IV() crypto.TunnelIV
|
||||
```
|
||||
|
||||
#### type Participant
|
||||
|
||||
```go
|
||||
type Participant struct {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### type Pool
|
||||
|
||||
```go
|
||||
type Pool struct{}
|
||||
```
|
||||
|
||||
a pool of tunnels which we have created
|
||||
|
||||
#### type TunnelID
|
||||
|
||||
```go
|
||||
type TunnelID uint32
|
||||
```
|
39
lib/util/doc.md
Normal file
39
lib/util/doc.md
Normal file
@ -0,0 +1,39 @@
|
||||
# util
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/util"
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
#### func CheckFileAge
|
||||
|
||||
```go
|
||||
func CheckFileAge(fpath string, maxAge int) bool
|
||||
```
|
||||
Check if a file is more than maxAge minutes old returns false if
|
||||
|
||||
#### func CheckFileExists
|
||||
|
||||
```go
|
||||
func CheckFileExists(fpath string) bool
|
||||
```
|
||||
Check if a file exists and is readable etc returns false if not
|
||||
|
||||
#### func CloseAll
|
||||
|
||||
```go
|
||||
func CloseAll()
|
||||
```
|
||||
|
||||
#### func Panicf
|
||||
|
||||
```go
|
||||
func Panicf(format string, args ...interface{})
|
||||
```
|
||||
Panicf allows passing formated string to panic()
|
||||
|
||||
#### func RegisterCloser
|
||||
|
||||
```go
|
||||
func RegisterCloser(c io.Closer)
|
||||
```
|
30
lib/util/signals/doc.md
Normal file
30
lib/util/signals/doc.md
Normal file
@ -0,0 +1,30 @@
|
||||
# signals
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/util/signals"
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
#### func Handle
|
||||
|
||||
```go
|
||||
func Handle()
|
||||
```
|
||||
|
||||
#### func RegisterInterruptHandler
|
||||
|
||||
```go
|
||||
func RegisterInterruptHandler(f Handler)
|
||||
```
|
||||
|
||||
#### func RegisterReloadHandler
|
||||
|
||||
```go
|
||||
func RegisterReloadHandler(f Handler)
|
||||
```
|
||||
|
||||
#### type Handler
|
||||
|
||||
```go
|
||||
type Handler func()
|
||||
```
|
Reference in New Issue
Block a user