mirror of
https://github.com/go-i2p/go-i2p.git
synced 2025-07-13 11:54:46 -04:00
Regenerate godoc
This commit is contained in:
@ -12,7 +12,7 @@ for dir in $dirs; do
|
||||
packageLine=$(grep -E "^package" $file)
|
||||
package=$(echo $packageLine | awk '{print $2}')
|
||||
echo "Generating callgraph for $package"
|
||||
go-callvis -nostd -focus "$package" -group type -format svg -file $dir/$package "github.com/go-i2p/go-i2p/$dir"
|
||||
#go-callvis -nostd -focus "$package" -group type -format svg -file $dir/$package "github.com/go-i2p/go-i2p/$dir"
|
||||
godocdown -template template.md -o "$dir/README.md" "./$dir"
|
||||
git add -v "$dir/$package.svg" "$dir/README.md"
|
||||
#git add -v "$dir/$package.svg" "$dir/README.md"
|
||||
done
|
@ -29,3 +29,5 @@ interface defining a way to bootstrap into the i2p network
|
||||
bootstrap
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/bootstrap
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -39,3 +39,5 @@ EncodeToString encodes []byte to a base32 string using I2PEncoding
|
||||
base32
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/base32
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -39,3 +39,5 @@ I2PEncoding is the standard base64 encoding used through I2P.
|
||||
base64
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/base64
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -123,3 +123,5 @@ Certificate,
|
||||
certificate
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/certificate
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -320,3 +320,5 @@ func (m MappingValues) Get(key I2PString) I2PString
|
||||
data
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/data
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -48,3 +48,5 @@ Base64 returns the I2P base64 address for this Destination.
|
||||
destination
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/destination
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -19,3 +19,5 @@ func Fuzz(data []byte) int
|
||||
exportable
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/fuzz/certificate
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -19,3 +19,5 @@ func Fuzz(data []byte) int
|
||||
exportable
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/fuzz/destination
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -19,3 +19,5 @@ func Fuzz(data []byte) int
|
||||
exportable
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/fuzz/keys_and_cert
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -19,3 +19,5 @@ func Fuzz(data []byte) int
|
||||
exportable
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/fuzz/router_address
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -19,3 +19,5 @@ func Fuzz(data []byte) int
|
||||
exportable
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/fuzz/router_identity
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -19,3 +19,5 @@ func Fuzz(data []byte) int
|
||||
exportable
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/fuzz/string
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -196,3 +196,5 @@ SigningPublicKeyType returns the signingPublicKey type as a Go integer.
|
||||
key_certificate
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/key_certificate
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -114,3 +114,5 @@ func NewPrivateKeysAndCert() (*PrivateKeysAndCert, error)
|
||||
keys_and_cert
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/keys_and_cert
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -73,3 +73,5 @@ TunnelID returns the tunnel id as a uint23.
|
||||
lease
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/lease
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -45,6 +45,18 @@ func NewLeaseSet(
|
||||
) (LeaseSet, error)
|
||||
```
|
||||
|
||||
#### func ReadLeaseSet
|
||||
|
||||
```go
|
||||
func ReadLeaseSet(data []byte) (LeaseSet, error)
|
||||
```
|
||||
|
||||
#### func (LeaseSet) Bytes
|
||||
|
||||
```go
|
||||
func (lease_set LeaseSet) Bytes() ([]byte, error)
|
||||
```
|
||||
|
||||
#### func (LeaseSet) Destination
|
||||
|
||||
```go
|
||||
@ -125,3 +137,5 @@ Verify returns nil
|
||||
lease_set
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/lease_set
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -218,3 +218,5 @@ func (router_address *RouterAddress) UDP() bool
|
||||
router_address
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/router_address
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -46,3 +46,5 @@ func (router_identity *RouterIdentity) AsDestination() destination.Destination
|
||||
router_identity
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/router_identity
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -177,3 +177,5 @@ func (router_info *RouterInfo) UnCongested() bool
|
||||
router_info
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/router_info
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -40,3 +40,5 @@ during parsing.
|
||||
session_key
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/session_key
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -40,3 +40,5 @@ during parsing.
|
||||
session_tag
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/session_tag
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -78,3 +78,5 @@ be modified accordingly to handle the correct signature length.
|
||||
signature
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/common/signature
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -120,3 +120,5 @@ func DefaultRouterConfig() *RouterConfig
|
||||
config
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/config
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -63,3 +63,5 @@ A symetric key for encrypting tunnel messages
|
||||
crypto
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/crypto
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -101,3 +101,5 @@ NewEncrypter creates a new AESSymmetricEncrypter
|
||||
aes
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/crypto/aes
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -143,3 +143,5 @@ additional authenticated data
|
||||
chacha20
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/crypto/chacha20
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -85,6 +85,13 @@ type Curve25519PrivateKey []byte
|
||||
|
||||
Curve25519PrivateKey represents a Curve25519 private key
|
||||
|
||||
#### func (Curve25519PrivateKey) Bytes
|
||||
|
||||
```go
|
||||
func (k Curve25519PrivateKey) Bytes() []byte
|
||||
```
|
||||
Bytes implements types.PrivateKey.
|
||||
|
||||
#### func (Curve25519PrivateKey) NewDecrypter
|
||||
|
||||
```go
|
||||
@ -99,6 +106,20 @@ func (k Curve25519PrivateKey) NewSigner() (types.Signer, error)
|
||||
```
|
||||
NewSigner creates a new Curve25519 signer
|
||||
|
||||
#### func (Curve25519PrivateKey) Public
|
||||
|
||||
```go
|
||||
func (k Curve25519PrivateKey) Public() (types.SigningPublicKey, error)
|
||||
```
|
||||
Public implements types.PrivateKey.
|
||||
|
||||
#### func (Curve25519PrivateKey) Zero
|
||||
|
||||
```go
|
||||
func (k Curve25519PrivateKey) Zero()
|
||||
```
|
||||
Zero implements types.PrivateKey.
|
||||
|
||||
#### type Curve25519PublicKey
|
||||
|
||||
```go
|
||||
@ -107,6 +128,12 @@ type Curve25519PublicKey []byte
|
||||
|
||||
Curve25519PublicKey represents a Curve25519 public key
|
||||
|
||||
#### func (Curve25519PublicKey) Bytes
|
||||
|
||||
```go
|
||||
func (k Curve25519PublicKey) Bytes() []byte
|
||||
```
|
||||
|
||||
#### func (Curve25519PublicKey) Len
|
||||
|
||||
```go
|
||||
@ -179,3 +206,5 @@ VerifyHash verifies a signature against a pre-computed hash
|
||||
curve25519
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/crypto/curve25519
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -113,3 +113,5 @@ verify hash of data with a dsa public key
|
||||
dsa
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/crypto/dsa
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -58,6 +58,27 @@ func (e *ECP256PrivateKey) Decrypt(data []byte) ([]byte, error)
|
||||
```
|
||||
Decrypt implements types.Decrypter.
|
||||
|
||||
#### func (*ECP256PrivateKey) Generate
|
||||
|
||||
```go
|
||||
func (e *ECP256PrivateKey) Generate() (types.SigningPrivateKey, error)
|
||||
```
|
||||
Generate implements SigningPrivateKey.Generate
|
||||
|
||||
#### func (*ECP256PrivateKey) Len
|
||||
|
||||
```go
|
||||
func (e *ECP256PrivateKey) Len() int
|
||||
```
|
||||
Len implements types.SigningPrivateKey.
|
||||
|
||||
#### func (*ECP256PrivateKey) NewSigner
|
||||
|
||||
```go
|
||||
func (e *ECP256PrivateKey) NewSigner() (types.Signer, error)
|
||||
```
|
||||
NewSigner implements SigningPrivateKey.NewSigner
|
||||
|
||||
#### func (*ECP256PrivateKey) Public
|
||||
|
||||
```go
|
||||
@ -313,3 +334,5 @@ VerifyHash implements types.Verifier.
|
||||
ecdsa
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/crypto/ecdsa
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -104,6 +104,13 @@ func (k Ed25519PrivateKey) NewDecrypter() (types.Decrypter, error)
|
||||
func (k Ed25519PrivateKey) NewSigner() (types.Signer, error)
|
||||
```
|
||||
|
||||
#### func (*Ed25519PrivateKey) NewVerifier
|
||||
|
||||
```go
|
||||
func (k *Ed25519PrivateKey) NewVerifier() (types.Verifier, error)
|
||||
```
|
||||
NewVerifier implements types.SigningPublicKey.
|
||||
|
||||
#### func (Ed25519PrivateKey) Public
|
||||
|
||||
```go
|
||||
@ -198,3 +205,5 @@ func (v *Ed25519Verifier) VerifyHash(h, sig []byte) (err error)
|
||||
ed25519
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/crypto/ed25519
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -99,3 +99,5 @@ type PrivateKey struct {
|
||||
elgamal
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/crypto/elg
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -33,3 +33,5 @@ type HMACKey [32]byte
|
||||
hmac
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/crypto/hmac
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -20,35 +20,35 @@ type RSA2048PrivateKey [512]byte
|
||||
```go
|
||||
func (r RSA2048PrivateKey) Bytes() []byte
|
||||
```
|
||||
Bytes implements types.PrivateKey.
|
||||
Bytes implements types.PrivateKey. Returns the raw bytes of the private key
|
||||
|
||||
#### func (RSA2048PrivateKey) Public
|
||||
|
||||
```go
|
||||
func (r RSA2048PrivateKey) Public() (types.SigningPublicKey, error)
|
||||
```
|
||||
Public implements types.PrivateKey.
|
||||
Public implements types.PrivateKey. Extracts the public key from the private key
|
||||
|
||||
#### func (RSA2048PrivateKey) Sign
|
||||
|
||||
```go
|
||||
func (r RSA2048PrivateKey) Sign(data []byte) (sig []byte, err error)
|
||||
```
|
||||
Sign implements types.Signer.
|
||||
Sign implements types.Signer. Signs data by first hashing it with SHA-256
|
||||
|
||||
#### func (RSA2048PrivateKey) SignHash
|
||||
|
||||
```go
|
||||
func (r RSA2048PrivateKey) SignHash(h []byte) (sig []byte, err error)
|
||||
```
|
||||
SignHash implements types.Signer.
|
||||
SignHash implements types.Signer. Signs a pre-computed hash
|
||||
|
||||
#### func (RSA2048PrivateKey) Zero
|
||||
|
||||
```go
|
||||
func (r RSA2048PrivateKey) Zero()
|
||||
```
|
||||
Zero implements types.PrivateKey.
|
||||
Zero implements types.PrivateKey. Securely erases key material
|
||||
|
||||
#### type RSA2048PublicKey
|
||||
|
||||
@ -62,35 +62,38 @@ type RSA2048PublicKey [256]byte
|
||||
```go
|
||||
func (r RSA2048PublicKey) Bytes() []byte
|
||||
```
|
||||
Bytes implements SigningPublicKey.
|
||||
Bytes implements SigningPublicKey. Returns the raw bytes of the public key
|
||||
|
||||
#### func (RSA2048PublicKey) Len
|
||||
|
||||
```go
|
||||
func (r RSA2048PublicKey) Len() int
|
||||
```
|
||||
Len implements SigningPublicKey.
|
||||
Len implements SigningPublicKey. Returns the length of the public key in bytes
|
||||
|
||||
#### func (RSA2048PublicKey) NewVerifier
|
||||
|
||||
```go
|
||||
func (r RSA2048PublicKey) NewVerifier() (types.Verifier, error)
|
||||
```
|
||||
NewVerifier implements SigningPublicKey.
|
||||
NewVerifier implements SigningPublicKey. Creates a new verifier object that can
|
||||
be used to verify signatures
|
||||
|
||||
#### func (RSA2048PublicKey) Verify
|
||||
|
||||
```go
|
||||
func (r RSA2048PublicKey) Verify(data []byte, sig []byte) error
|
||||
```
|
||||
Verify implements types.Verifier.
|
||||
Verify implements types.Verifier. This method hashes the data with SHA-256 and
|
||||
verifies the signature
|
||||
|
||||
#### func (RSA2048PublicKey) VerifyHash
|
||||
|
||||
```go
|
||||
func (r RSA2048PublicKey) VerifyHash(h []byte, sig []byte) error
|
||||
```
|
||||
VerifyHash implements types.Verifier.
|
||||
VerifyHash implements types.Verifier. This method verifies a pre-computed hash
|
||||
against the signature
|
||||
|
||||
#### type RSA3072PrivateKey
|
||||
|
||||
@ -104,35 +107,56 @@ type RSA3072PrivateKey [786]byte
|
||||
```go
|
||||
func (r RSA3072PrivateKey) Bytes() []byte
|
||||
```
|
||||
Bytes implements types.PrivateKey.
|
||||
Bytes implements types.PrivateKey - returns raw key bytes
|
||||
|
||||
#### func (*RSA3072PrivateKey) Generate
|
||||
|
||||
```go
|
||||
func (r *RSA3072PrivateKey) Generate() (types.SigningPrivateKey, error)
|
||||
```
|
||||
Generate creates a new RSA-3072 private key
|
||||
|
||||
#### func (*RSA3072PrivateKey) Len
|
||||
|
||||
```go
|
||||
func (r *RSA3072PrivateKey) Len() int
|
||||
```
|
||||
Len implements types.SigningPrivateKey.
|
||||
|
||||
#### func (*RSA3072PrivateKey) NewSigner
|
||||
|
||||
```go
|
||||
func (r *RSA3072PrivateKey) NewSigner() (types.Signer, error)
|
||||
```
|
||||
NewSigner implements types.SigningPrivateKey.
|
||||
|
||||
#### func (RSA3072PrivateKey) Public
|
||||
|
||||
```go
|
||||
func (r RSA3072PrivateKey) Public() (types.SigningPublicKey, error)
|
||||
```
|
||||
Public implements types.PrivateKey.
|
||||
Public implements types.PrivateKey - derives public key from private key
|
||||
|
||||
#### func (RSA3072PrivateKey) Sign
|
||||
|
||||
```go
|
||||
func (r RSA3072PrivateKey) Sign(data []byte) (sig []byte, err error)
|
||||
```
|
||||
Sign implements types.Signer.
|
||||
Sign implements types.Signer - signs data with SHA512 hash
|
||||
|
||||
#### func (RSA3072PrivateKey) SignHash
|
||||
|
||||
```go
|
||||
func (r RSA3072PrivateKey) SignHash(h []byte) (sig []byte, err error)
|
||||
```
|
||||
SignHash implements types.Signer.
|
||||
SignHash implements types.Signer - signs a pre-computed hash
|
||||
|
||||
#### func (RSA3072PrivateKey) Zero
|
||||
|
||||
```go
|
||||
func (r RSA3072PrivateKey) Zero()
|
||||
```
|
||||
Zero implements types.PrivateKey.
|
||||
Zero implements types.PrivateKey - securely erases key material
|
||||
|
||||
#### type RSA3072PublicKey
|
||||
|
||||
@ -188,35 +212,35 @@ type RSA4096PrivateKey [1024]byte
|
||||
```go
|
||||
func (r RSA4096PrivateKey) Bytes() []byte
|
||||
```
|
||||
Bytes implements types.PrivateKey.
|
||||
Bytes implements types.PrivateKey. Returns the raw bytes of the private key
|
||||
|
||||
#### func (RSA4096PrivateKey) Public
|
||||
|
||||
```go
|
||||
func (r RSA4096PrivateKey) Public() (types.SigningPublicKey, error)
|
||||
```
|
||||
Public implements types.PrivateKey.
|
||||
Public implements types.PrivateKey. Extracts the public key from the private key
|
||||
|
||||
#### func (RSA4096PrivateKey) Sign
|
||||
|
||||
```go
|
||||
func (r RSA4096PrivateKey) Sign(data []byte) (sig []byte, err error)
|
||||
```
|
||||
Sign implements types.Signer.
|
||||
Sign implements types.Signer. Signs data by first hashing it with SHA-512
|
||||
|
||||
#### func (RSA4096PrivateKey) SignHash
|
||||
|
||||
```go
|
||||
func (r RSA4096PrivateKey) SignHash(h []byte) (sig []byte, err error)
|
||||
```
|
||||
SignHash implements types.Signer.
|
||||
SignHash implements types.Signer. Signs a pre-computed hash
|
||||
|
||||
#### func (RSA4096PrivateKey) Zero
|
||||
|
||||
```go
|
||||
func (r RSA4096PrivateKey) Zero()
|
||||
```
|
||||
Zero implements types.PrivateKey.
|
||||
Zero implements types.PrivateKey. Securely clears the private key from memory
|
||||
|
||||
#### type RSA4096PublicKey
|
||||
|
||||
@ -230,38 +254,43 @@ type RSA4096PublicKey [512]byte
|
||||
```go
|
||||
func (r RSA4096PublicKey) Bytes() []byte
|
||||
```
|
||||
Bytes implements SigningPublicKey.
|
||||
Bytes implements SigningPublicKey. Returns the raw bytes of the public key
|
||||
|
||||
#### func (RSA4096PublicKey) Len
|
||||
|
||||
```go
|
||||
func (r RSA4096PublicKey) Len() int
|
||||
```
|
||||
Len implements SigningPublicKey.
|
||||
Len implements SigningPublicKey. Returns the length of the public key in bytes
|
||||
|
||||
#### func (RSA4096PublicKey) NewVerifier
|
||||
|
||||
```go
|
||||
func (r RSA4096PublicKey) NewVerifier() (types.Verifier, error)
|
||||
```
|
||||
NewVerifier implements SigningPublicKey.
|
||||
NewVerifier implements SigningPublicKey. Creates a new verifier instance for
|
||||
this public key
|
||||
|
||||
#### func (RSA4096PublicKey) Verify
|
||||
|
||||
```go
|
||||
func (r RSA4096PublicKey) Verify(data []byte, sig []byte) error
|
||||
```
|
||||
Verify implements types.Verifier.
|
||||
Verify implements types.Verifier. This method hashes the data with SHA-512 and
|
||||
verifies the signature
|
||||
|
||||
#### func (RSA4096PublicKey) VerifyHash
|
||||
|
||||
```go
|
||||
func (r RSA4096PublicKey) VerifyHash(h []byte, sig []byte) error
|
||||
```
|
||||
VerifyHash implements types.Verifier.
|
||||
VerifyHash implements types.Verifier. This method verifies a pre-computed hash
|
||||
against the signature
|
||||
|
||||
|
||||
|
||||
rsa
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/crypto/rsa
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -51,6 +51,12 @@ 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)
|
||||
// Public key
|
||||
Public() (SigningPublicKey, error)
|
||||
// Bytes returns the raw bytes of this private key
|
||||
Bytes() []byte
|
||||
// Zero clears all sensitive data from the private key
|
||||
Zero()
|
||||
}
|
||||
```
|
||||
|
||||
@ -79,6 +85,7 @@ type PublicEncryptionKey interface {
|
||||
|
||||
// length of this public key in bytes
|
||||
Len() int
|
||||
Bytes() []byte
|
||||
}
|
||||
```
|
||||
|
||||
@ -173,3 +180,5 @@ type for verifying signatures
|
||||
types
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/crypto/types
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -33,6 +33,10 @@ var ERR_BUILD_REQUEST_RECORD_NOT_ENOUGH_DATA = oops.Errorf("not enough i2np buil
|
||||
var ERR_BUILD_RESPONSE_RECORD_NOT_ENOUGH_DATA = errors.New("not enough i2np build request record data")
|
||||
```
|
||||
|
||||
```go
|
||||
var ERR_DATABASE_LOOKUP_NOT_ENOUGH_DATA = errors.New("not enough i2np database lookup data")
|
||||
```
|
||||
|
||||
```go
|
||||
var ERR_I2NP_NOT_ENOUGH_DATA = oops.Errorf("not enough i2np header data")
|
||||
```
|
||||
@ -173,12 +177,18 @@ type DatabaseLookup struct {
|
||||
Size int
|
||||
ExcludedPeers []common.Hash
|
||||
ReplyKey session_key.SessionKey
|
||||
|
||||
ReplyTags []session_tag.SessionTag
|
||||
Tags int
|
||||
ReplyTags []session_tag.SessionTag
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func ReadDatabaseLookup
|
||||
|
||||
```go
|
||||
func ReadDatabaseLookup(data []byte) (DatabaseLookup, error)
|
||||
```
|
||||
|
||||
#### type DatabaseSearchReply
|
||||
|
||||
```go
|
||||
@ -362,3 +372,5 @@ type VariableTunnelBuildReply struct {
|
||||
i2np
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/i2np
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -19,3 +19,5 @@ func Fuzz(data []byte) int
|
||||
exportable
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/i2np/fuzz/header
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -103,3 +103,5 @@ func (ks *RouterInfoKeystore) StoreKeys() error
|
||||
keys
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/keys
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -36,6 +36,23 @@ func (e *Entry) ReadFrom(r io.Reader) (err error)
|
||||
func (e *Entry) WriteTo(w io.Writer) (err error)
|
||||
```
|
||||
|
||||
#### type KademliaResolver
|
||||
|
||||
```go
|
||||
type KademliaResolver struct {
|
||||
// netdb to store result into
|
||||
NetworkDatabase
|
||||
}
|
||||
```
|
||||
|
||||
resolves router infos with recursive kademlia lookup
|
||||
|
||||
#### func (*KademliaResolver) Lookup
|
||||
|
||||
```go
|
||||
func (kr *KademliaResolver) Lookup(h common.Hash, timeout time.Duration) (*router_info.RouterInfo, error)
|
||||
```
|
||||
|
||||
#### type NetworkDatabase
|
||||
|
||||
```go
|
||||
@ -45,6 +62,10 @@ type NetworkDatabase interface {
|
||||
// return nil if the RouterInfo cannot be found locally
|
||||
GetRouterInfo(hash common.Hash) router_info.RouterInfo
|
||||
|
||||
// obtain all routerInfos, ordered by their hash
|
||||
// return a slice of routerInfos
|
||||
GetAllRouterInfos() []router_info.RouterInfo
|
||||
|
||||
// store a router info locally
|
||||
StoreRouterInfo(ri router_info.RouterInfo)
|
||||
|
||||
@ -71,16 +92,16 @@ i2p network database, storage of i2p RouterInfos
|
||||
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
|
||||
Lookup(hash common.Hash, timeout time.Duration) (*router_info.RouterInfo, error)
|
||||
}
|
||||
```
|
||||
|
||||
resolves unknown RouterInfos given the hash of their RouterIdentity
|
||||
|
||||
#### func KademliaResolver
|
||||
#### func NewKademliaResolver
|
||||
|
||||
```go
|
||||
func KademliaResolver(netDb NetworkDatabase, pool *tunnel.Pool) (r Resolver)
|
||||
func NewKademliaResolver(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
|
||||
@ -130,6 +151,12 @@ func (db *StdNetDB) Exists() bool
|
||||
```
|
||||
return true if the network db directory exists and is writable
|
||||
|
||||
#### func (*StdNetDB) GetAllRouterInfos
|
||||
|
||||
```go
|
||||
func (db *StdNetDB) GetAllRouterInfos() (ri []router_info.RouterInfo)
|
||||
```
|
||||
|
||||
#### func (*StdNetDB) GetRouterInfo
|
||||
|
||||
```go
|
||||
@ -189,3 +216,5 @@ get the skiplist file that a RouterInfo with this hash would go in
|
||||
netdb
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/netdb
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -34,3 +34,5 @@ func (r Reseed) SingleReseed(uri string) ([]router_info.RouterInfo, error)
|
||||
reseed
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/netdb/reseed
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -69,3 +69,5 @@ Wait blocks until router is fully stopped
|
||||
router
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/router
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -195,3 +195,5 @@ const (
|
||||
su3
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/su3
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -128,3 +128,5 @@ a session between 2 routers for tranmitting i2np messages securly
|
||||
transport
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/transport
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -33,3 +33,5 @@ HandshakeState manages the Noise handshake state
|
||||
handshake
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/transport/handshake
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -337,3 +337,5 @@ type VerifyCallbackFunc func(publicKey []byte, data []byte) error
|
||||
noise
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/transport/noise
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -42,6 +42,16 @@ const (
|
||||
```
|
||||
Constants for NTCP2 handshake
|
||||
|
||||
```go
|
||||
const (
|
||||
MaxPaddingSize = 64
|
||||
MinPaddingSize = 1
|
||||
DefaultMinSize = 128
|
||||
DefaultMinPadding = 1
|
||||
DefaultMaxExtra = 30
|
||||
)
|
||||
```
|
||||
|
||||
```go
|
||||
const (
|
||||
NTCP_PROTOCOL_VERSION = 2
|
||||
@ -50,35 +60,47 @@ const (
|
||||
)
|
||||
```
|
||||
|
||||
#### func PerformOutboundHandshake
|
||||
#### func CalculatePaddingLength
|
||||
|
||||
```go
|
||||
func PerformOutboundHandshake(conn net.Conn, hs *HandshakeState) error
|
||||
func CalculatePaddingLength(contentSize int, minSize int, minPadding int, maxExtraPadding int) int
|
||||
```
|
||||
PerformOutboundHandshake initiates and completes a handshake as the initiator
|
||||
CalculatePaddingLength determines padding length based on content size and
|
||||
randomness
|
||||
|
||||
#### type HandshakeState
|
||||
#### func GenerateRandomPadding
|
||||
|
||||
```go
|
||||
type HandshakeState struct {
|
||||
func GenerateRandomPadding(length int) ([]byte, error)
|
||||
```
|
||||
GenerateRandomPadding creates a byte slice of random data with the given length
|
||||
|
||||
#### func ReadAndValidatePadding
|
||||
|
||||
```go
|
||||
func ReadAndValidatePadding(conn net.Conn, paddingLen int) error
|
||||
```
|
||||
ReadAndValidatePadding reads padding from a connection and validates its length
|
||||
|
||||
#### type AEADOperator
|
||||
|
||||
```go
|
||||
type AEADOperator interface {
|
||||
// EncryptWithAssociatedData encrypts data using the provided key and associated data
|
||||
EncryptWithAssociatedData(key, data, associatedData []byte, nonceCounter uint64) ([]byte, error)
|
||||
|
||||
// DecryptWithAssociatedData decrypts data using the provided key and associated data
|
||||
DecryptWithAssociatedData(key, data, associatedData []byte, nonceCounter uint64) ([]byte, error)
|
||||
|
||||
// EncryptWithDerivedKey encrypts data, deriving the key from raw key material first
|
||||
EncryptWithDerivedKey(keyMaterial, data, associatedData []byte, nonceCounter uint64) ([]byte, error)
|
||||
|
||||
// DecryptWithDerivedKey decrypts data, deriving the key from raw key material first
|
||||
DecryptWithDerivedKey(keyMaterial, data, associatedData []byte, nonceCounter uint64) ([]byte, error)
|
||||
}
|
||||
```
|
||||
|
||||
HandshakeState maintains the state for an in-progress handshake
|
||||
|
||||
#### func NewHandshakeState
|
||||
|
||||
```go
|
||||
func NewHandshakeState(localKey types.PrivateKey, remoteKey types.PublicKey, ri *router_info.RouterInfo) (*HandshakeState, error)
|
||||
```
|
||||
NewHandshakeState creates a new handshake state for initiating a connection
|
||||
|
||||
#### func PerformInboundHandshake
|
||||
|
||||
```go
|
||||
func PerformInboundHandshake(conn net.Conn, localKey types.PrivateKey) (*HandshakeState, error)
|
||||
```
|
||||
PerformInboundHandshake handles a handshake initiated by a remote peer
|
||||
AEADOperator defines the interface for AEAD operations in the NTCP2 protocol
|
||||
|
||||
#### type NTCP2Session
|
||||
|
||||
@ -86,6 +108,9 @@ PerformInboundHandshake handles a handshake initiated by a remote peer
|
||||
type NTCP2Session struct {
|
||||
*noise.NoiseSession
|
||||
*NTCP2Transport
|
||||
|
||||
// Processors for handling handshake messages
|
||||
Processors map[messages.MessageType]handshake.HandshakeMessageProcessor
|
||||
}
|
||||
```
|
||||
|
||||
@ -100,51 +125,12 @@ func NewNTCP2Session(routerInfo router_info.RouterInfo) (*NTCP2Session, error)
|
||||
NewNTCP2Session creates a new NTCP2 session using the existing noise
|
||||
implementation
|
||||
|
||||
#### func (*NTCP2Session) ComposeInitiatorHandshakeMessage
|
||||
#### func (*NTCP2Session) CreateHandshakeProcessors
|
||||
|
||||
```go
|
||||
func (c *NTCP2Session) ComposeInitiatorHandshakeMessage(
|
||||
localStatic noise.DHKey,
|
||||
remoteStatic []byte,
|
||||
payload []byte,
|
||||
ephemeralPrivate []byte,
|
||||
) (
|
||||
negotiationData,
|
||||
handshakeMessage []byte,
|
||||
handshakeState *noise.HandshakeState,
|
||||
err error,
|
||||
)
|
||||
func (s *NTCP2Session) CreateHandshakeProcessors()
|
||||
```
|
||||
Modify ComposeInitiatorHandshakeMessage in outgoing_handshake.go At the moment,
|
||||
remoteStatic is stored in the NTCP2Session() and doesn't need to be passed as an
|
||||
argument. You actually get it directly out of the remote RouterInfo, which the
|
||||
NoiseSession also has access to. So maybe, the interface should change so that
|
||||
we:
|
||||
|
||||
- A: get the localStatic out of the parent NTCP2Transport's routerInfo, which is the "local" routerInfo
|
||||
- B: get the remoteStatic out of the NTCP2Session router, which is the "remote" routerInfo
|
||||
|
||||
#### func (*NTCP2Session) CreateSessionConfirmed
|
||||
|
||||
```go
|
||||
func (c *NTCP2Session) CreateSessionConfirmed(
|
||||
handshakeState *noise.HandshakeState,
|
||||
localRouterInfo *router_info.RouterInfo,
|
||||
) (*messages.SessionConfirmed, error)
|
||||
```
|
||||
CreateSessionConfirmed builds the SessionConfirmed message (Message 3 in NTCP2
|
||||
handshake) This is sent by Alice to Bob after receiving SessionCreated
|
||||
|
||||
#### func (*NTCP2Session) CreateSessionCreated
|
||||
|
||||
```go
|
||||
func (s *NTCP2Session) CreateSessionCreated(
|
||||
handshakeState *noise.HandshakeState,
|
||||
localRouterInfo *router_info.RouterInfo,
|
||||
) (*messages.SessionCreated, error)
|
||||
```
|
||||
CreateSessionCreated builds the SessionCreated message (Message 2 in NTCP2
|
||||
handshake) This is sent by Bob to Alice after receiving SessionRequest
|
||||
CreateHandshakeProcessors initializes all the handshake message processors
|
||||
|
||||
#### func (*NTCP2Session) CreateSessionRequest
|
||||
|
||||
@ -152,6 +138,39 @@ handshake) This is sent by Bob to Alice after receiving SessionRequest
|
||||
func (s *NTCP2Session) CreateSessionRequest() (*messages.SessionRequest, error)
|
||||
```
|
||||
|
||||
#### func (*NTCP2Session) DecryptOptionsBlock
|
||||
|
||||
```go
|
||||
func (c *NTCP2Session) DecryptOptionsBlock(encryptedOptions []byte, obfuscatedX []byte, deobfuscatedX []byte) ([]byte, error)
|
||||
```
|
||||
DecryptOptionsBlock decrypts the options block from a SessionRequest message
|
||||
|
||||
#### func (*NTCP2Session) DecryptWithAssociatedData
|
||||
|
||||
```go
|
||||
func (c *NTCP2Session) DecryptWithAssociatedData(
|
||||
key []byte,
|
||||
data []byte,
|
||||
associatedData []byte,
|
||||
nonceCounter uint64,
|
||||
) ([]byte, error)
|
||||
```
|
||||
DecryptWithAssociatedData decrypts data using ChaCha20-Poly1305 with the
|
||||
provided key and associated data
|
||||
|
||||
#### func (*NTCP2Session) DecryptWithDerivedKey
|
||||
|
||||
```go
|
||||
func (c *NTCP2Session) DecryptWithDerivedKey(
|
||||
keyMaterial []byte,
|
||||
data []byte,
|
||||
associatedData []byte,
|
||||
nonceCounter uint64,
|
||||
) ([]byte, error)
|
||||
```
|
||||
DecryptWithDerivedKey decrypts data, deriving the key from raw key material
|
||||
first
|
||||
|
||||
#### func (*NTCP2Session) DeobfuscateEphemeral
|
||||
|
||||
```go
|
||||
@ -159,6 +178,47 @@ func (s *NTCP2Session) DeobfuscateEphemeral(obfuscatedEphemeralKey []byte) ([]by
|
||||
```
|
||||
DeobfuscateEphemeral reverses the key obfuscation
|
||||
|
||||
#### func (*NTCP2Session) DeriveSessionKeys
|
||||
|
||||
```go
|
||||
func (c *NTCP2Session) DeriveSessionKeys(sharedSecret []byte, ephemeralKey []byte) error
|
||||
```
|
||||
DeriveSessionKeys derives all required keys for a session using existing X25519
|
||||
shared secret This replaces scattered key derivation across session files
|
||||
|
||||
#### func (*NTCP2Session) EncryptWithAssociatedData
|
||||
|
||||
```go
|
||||
func (c *NTCP2Session) EncryptWithAssociatedData(
|
||||
key []byte,
|
||||
data []byte,
|
||||
associatedData []byte,
|
||||
nonceCounter uint64,
|
||||
) ([]byte, error)
|
||||
```
|
||||
EncryptWithAssociatedData encrypts data using ChaCha20-Poly1305 with the
|
||||
provided key and associated data
|
||||
|
||||
#### func (*NTCP2Session) EncryptWithDerivedKey
|
||||
|
||||
```go
|
||||
func (c *NTCP2Session) EncryptWithDerivedKey(
|
||||
keyMaterial []byte,
|
||||
data []byte,
|
||||
associatedData []byte,
|
||||
nonceCounter uint64,
|
||||
) ([]byte, error)
|
||||
```
|
||||
EncryptWithDerivedKey encrypts data, deriving the key from raw key material
|
||||
first
|
||||
|
||||
#### func (*NTCP2Session) GetProcessor
|
||||
|
||||
```go
|
||||
func (s *NTCP2Session) GetProcessor(messageType messages.MessageType) (handshake.HandshakeMessageProcessor, error)
|
||||
```
|
||||
GetProcessor returns the appropriate processor for a message type
|
||||
|
||||
#### func (*NTCP2Session) ObfuscateEphemeral
|
||||
|
||||
```go
|
||||
@ -166,6 +226,56 @@ func (s *NTCP2Session) ObfuscateEphemeral(ephemeralKey []byte) ([]byte, error)
|
||||
```
|
||||
ObfuscateEphemeral implements NTCP2's key obfuscation using AES-256-CBC
|
||||
|
||||
#### func (*NTCP2Session) PerformAEADOperation
|
||||
|
||||
```go
|
||||
func (c *NTCP2Session) PerformAEADOperation(
|
||||
keyMaterial []byte,
|
||||
data []byte,
|
||||
associatedData []byte,
|
||||
nonceCounter uint64,
|
||||
encrypt bool,
|
||||
) ([]byte, error)
|
||||
```
|
||||
PerformAEADOperation handles both encryption and decryption using
|
||||
ChaCha20-Poly1305
|
||||
|
||||
#### func (*NTCP2Session) PerformAEADWithDerivedKey
|
||||
|
||||
```go
|
||||
func (c *NTCP2Session) PerformAEADWithDerivedKey(
|
||||
keyMaterial []byte,
|
||||
data []byte,
|
||||
associatedData []byte,
|
||||
nonceCounter uint64,
|
||||
encrypt bool,
|
||||
) ([]byte, error)
|
||||
```
|
||||
PerformAEADWithDerivedKey performs AEAD operation, deriving the key from raw key
|
||||
material first
|
||||
|
||||
#### func (*NTCP2Session) PerformIncomingHandshake
|
||||
|
||||
```go
|
||||
func (s *NTCP2Session) PerformIncomingHandshake(conn net.Conn) error
|
||||
```
|
||||
PerformIncomingHandshake conducts the NTCP2 handshake as the responder (server).
|
||||
It performs the server side of the 3-message handshake sequence: 1. Receives and
|
||||
processes SessionRequest (Message 1) 2. Creates and sends SessionCreated
|
||||
(Message 2) 3. Receives and processes SessionConfirmed (Message 3) After
|
||||
successful completion, the session is established and ready for data exchange.
|
||||
|
||||
#### func (*NTCP2Session) PerformOutboundHandshake
|
||||
|
||||
```go
|
||||
func (s *NTCP2Session) PerformOutboundHandshake(conn net.Conn) error
|
||||
```
|
||||
PerformOutboundHandshake conducts the NTCP2 handshake as the initiator (client).
|
||||
It performs the full 3-message handshake sequence: 1. Creates and sends
|
||||
SessionRequest (Message 1) 2. Receives and processes SessionCreated (Message 2)
|
||||
3. Creates and sends SessionConfirmed (Message 3) After successful completion,
|
||||
the session is established and ready for data exchange.
|
||||
|
||||
#### type NTCP2Transport
|
||||
|
||||
```go
|
||||
@ -214,8 +324,207 @@ func (t *NTCP2Transport) GetSession(routerInfo router_info.RouterInfo) (transpor
|
||||
func (t *NTCP2Transport) Name() string
|
||||
```
|
||||
|
||||
#### type SessionConfirmedProcessor
|
||||
|
||||
```go
|
||||
type SessionConfirmedProcessor struct {
|
||||
*NTCP2Session
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func (*SessionConfirmedProcessor) CreateMessage
|
||||
|
||||
```go
|
||||
func (s *SessionConfirmedProcessor) CreateMessage(hs *handshake.HandshakeState) (messages.Message, error)
|
||||
```
|
||||
CreateMessage implements handshake.HandshakeMessageProcessor.
|
||||
|
||||
#### func (*SessionConfirmedProcessor) EncryptPayload
|
||||
|
||||
```go
|
||||
func (s *SessionConfirmedProcessor) EncryptPayload(msg messages.Message, obfuscatedKey []byte, hs *handshake.HandshakeState) ([]byte, error)
|
||||
```
|
||||
EncryptPayload implements handshake.HandshakeMessageProcessor.
|
||||
|
||||
#### func (*SessionConfirmedProcessor) GetPadding
|
||||
|
||||
```go
|
||||
func (s *SessionConfirmedProcessor) GetPadding(msg messages.Message) []byte
|
||||
```
|
||||
GetPadding implements handshake.HandshakeMessageProcessor.
|
||||
|
||||
#### func (*SessionConfirmedProcessor) MessageType
|
||||
|
||||
```go
|
||||
func (s *SessionConfirmedProcessor) MessageType() messages.MessageType
|
||||
```
|
||||
MessageType implements handshake.HandshakeMessageProcessor.
|
||||
|
||||
#### func (*SessionConfirmedProcessor) ObfuscateKey
|
||||
|
||||
```go
|
||||
func (s *SessionConfirmedProcessor) ObfuscateKey(msg messages.Message, hs *handshake.HandshakeState) ([]byte, error)
|
||||
```
|
||||
ObfuscateKey implements handshake.HandshakeMessageProcessor.
|
||||
|
||||
#### func (*SessionConfirmedProcessor) ProcessMessage
|
||||
|
||||
```go
|
||||
func (s *SessionConfirmedProcessor) ProcessMessage(message messages.Message, hs *handshake.HandshakeState) error
|
||||
```
|
||||
ProcessMessage implements handshake.HandshakeMessageProcessor.
|
||||
|
||||
#### func (*SessionConfirmedProcessor) ReadMessage
|
||||
|
||||
```go
|
||||
func (s *SessionConfirmedProcessor) ReadMessage(conn net.Conn, hs *handshake.HandshakeState) (messages.Message, error)
|
||||
```
|
||||
ReadMessage implements handshake.HandshakeMessageProcessor.
|
||||
|
||||
#### type SessionCreatedProcessor
|
||||
|
||||
```go
|
||||
type SessionCreatedProcessor struct {
|
||||
*NTCP2Session
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### func (*SessionCreatedProcessor) CreateMessage
|
||||
|
||||
```go
|
||||
func (s *SessionCreatedProcessor) CreateMessage(hs *handshake.HandshakeState) (messages.Message, error)
|
||||
```
|
||||
CreateMessage implements handshake.HandshakeMessageProcessor.
|
||||
|
||||
#### func (*SessionCreatedProcessor) EncryptPayload
|
||||
|
||||
```go
|
||||
func (s *SessionCreatedProcessor) EncryptPayload(
|
||||
msg messages.Message,
|
||||
obfuscatedKey []byte,
|
||||
hs *handshake.HandshakeState,
|
||||
) ([]byte, error)
|
||||
```
|
||||
EncryptPayload implements handshake.HandshakeMessageProcessor.
|
||||
|
||||
#### func (*SessionCreatedProcessor) GetPadding
|
||||
|
||||
```go
|
||||
func (s *SessionCreatedProcessor) GetPadding(msg messages.Message) []byte
|
||||
```
|
||||
GetPadding retrieves padding from a message
|
||||
|
||||
#### func (*SessionCreatedProcessor) MessageType
|
||||
|
||||
```go
|
||||
func (s *SessionCreatedProcessor) MessageType() messages.MessageType
|
||||
```
|
||||
MessageType implements handshake.HandshakeMessageProcessor.
|
||||
|
||||
#### func (*SessionCreatedProcessor) ObfuscateKey
|
||||
|
||||
```go
|
||||
func (s *SessionCreatedProcessor) ObfuscateKey(msg messages.Message, hs *handshake.HandshakeState) ([]byte, error)
|
||||
```
|
||||
ObfuscateKey should follow the same pattern as in SessionRequestProcessor
|
||||
|
||||
#### func (*SessionCreatedProcessor) ProcessMessage
|
||||
|
||||
```go
|
||||
func (s *SessionCreatedProcessor) ProcessMessage(message messages.Message, hs *handshake.HandshakeState) error
|
||||
```
|
||||
ProcessMessage implements handshake.HandshakeMessageProcessor.
|
||||
|
||||
#### func (*SessionCreatedProcessor) ReadMessage
|
||||
|
||||
```go
|
||||
func (s *SessionCreatedProcessor) ReadMessage(conn net.Conn, hs *handshake.HandshakeState) (messages.Message, error)
|
||||
```
|
||||
ReadMessage implements handshake.HandshakeMessageProcessor.
|
||||
|
||||
#### type SessionRequestProcessor
|
||||
|
||||
```go
|
||||
type SessionRequestProcessor struct {
|
||||
*NTCP2Session
|
||||
}
|
||||
```
|
||||
|
||||
SessionRequestProcessor implements NTCP2 Message 1 (SessionRequest): 1. Create
|
||||
session request message with options block (version, padding length, etc.) 2.
|
||||
Set timeout deadline for the connection 3. Obfuscate ephemeral key (X) using AES
|
||||
with Bob's router hash as key 4. Encrypt options block using ChaCha20-Poly1305
|
||||
5. Assemble final message: obfuscated X + encrypted options + padding 6. Write
|
||||
complete message to connection
|
||||
|
||||
SessionRequestProcessor processes incoming NTCP2 Message 1 (SessionRequest): 1.
|
||||
Read and buffer the fixed-length ephemeral key portion (X) 2. Deobfuscate X
|
||||
using AES with local router hash as key 3. Validate the ephemeral key (X) is a
|
||||
valid Curve25519 point 4. Read the ChaCha20-Poly1305 encrypted options block 5.
|
||||
Derive KDF for handshake message 1 using X and local static key 6. Decrypt and
|
||||
authenticate the options block 7. Extract and validate handshake parameters
|
||||
(timestamp, version, padding length) 8. Read and validate any padding bytes 9.
|
||||
Check timestamp for acceptable clock skew (±60 seconds?)
|
||||
|
||||
#### func (*SessionRequestProcessor) CreateMessage
|
||||
|
||||
```go
|
||||
func (s *SessionRequestProcessor) CreateMessage(hs *handshake.HandshakeState) (messages.Message, error)
|
||||
```
|
||||
CreateMessage implements HandshakeMessageProcessor.
|
||||
|
||||
#### func (*SessionRequestProcessor) EncryptPayload
|
||||
|
||||
```go
|
||||
func (p *SessionRequestProcessor) EncryptPayload(
|
||||
message messages.Message,
|
||||
obfuscatedKey []byte,
|
||||
hs *handshake.HandshakeState,
|
||||
) ([]byte, error)
|
||||
```
|
||||
EncryptPayload encrypts the payload portion of the message
|
||||
|
||||
#### func (*SessionRequestProcessor) GetPadding
|
||||
|
||||
```go
|
||||
func (p *SessionRequestProcessor) GetPadding(message messages.Message) []byte
|
||||
```
|
||||
GetPadding retrieves padding from a message
|
||||
|
||||
#### func (*SessionRequestProcessor) MessageType
|
||||
|
||||
```go
|
||||
func (s *SessionRequestProcessor) MessageType() messages.MessageType
|
||||
```
|
||||
MessageType implements handshake.HandshakeMessageProcessor.
|
||||
|
||||
#### func (*SessionRequestProcessor) ObfuscateKey
|
||||
|
||||
```go
|
||||
func (p *SessionRequestProcessor) ObfuscateKey(message messages.Message, hs *handshake.HandshakeState) ([]byte, error)
|
||||
```
|
||||
ObfuscateKey obfuscates the ephemeral key for transmission
|
||||
|
||||
#### func (*SessionRequestProcessor) ProcessMessage
|
||||
|
||||
```go
|
||||
func (s *SessionRequestProcessor) ProcessMessage(message messages.Message, hs *handshake.HandshakeState) error
|
||||
```
|
||||
ProcessMessage implements handshake.HandshakeMessageProcessor.
|
||||
|
||||
#### func (*SessionRequestProcessor) ReadMessage
|
||||
|
||||
```go
|
||||
func (p *SessionRequestProcessor) ReadMessage(conn net.Conn, hs *handshake.HandshakeState) (messages.Message, error)
|
||||
```
|
||||
ReadMessage reads a SessionRequest message from the connection
|
||||
|
||||
|
||||
|
||||
ntcp
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/transport/ntcp
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# messages
|
||||
--
|
||||
import "github.com/go-i2p/go-i2p/lib/transport/messages"
|
||||
import "github.com/go-i2p/go-i2p/lib/transport/ntcp/messages"
|
||||
|
||||

|
||||
|
||||
@ -217,4 +217,6 @@ Type returns the message type
|
||||
|
||||
messages
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/transport/messages
|
||||
github.com/go-i2p/go-i2p/lib/transport/ntcp/messages
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -29,3 +29,5 @@ AES-256-CBC without padding
|
||||
obfs
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/transport/obfs
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -8,6 +8,24 @@
|
||||
|
||||
## Usage
|
||||
|
||||
#### func Quant
|
||||
|
||||
```go
|
||||
func Quant(input, quantum int) int
|
||||
```
|
||||
Quant returns the next multiple of quantum that is greater than or equal to
|
||||
input. For example, Quant(10, 8) returns 16, as 16 is the next multiple of 8
|
||||
that's >= 10.
|
||||
|
||||
#### func QuantAdjustment
|
||||
|
||||
```go
|
||||
func QuantAdjustment(input, quantum int) int
|
||||
```
|
||||
QuantAdujustment returns the amount of padding needed to make the input a
|
||||
multiple of quantum. For example, if input is 10 and quantum is 8, the
|
||||
adjustment would be 6 (to reach 16).
|
||||
|
||||
#### type NullPaddingStrategy
|
||||
|
||||
```go
|
||||
@ -41,3 +59,5 @@ type PaddingStrategy interface {
|
||||
padding
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/transport/padding
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -13,3 +13,5 @@ i2p ssu transport implementation
|
||||
ssu
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/transport/ssu
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -265,3 +265,5 @@ type TunnelID uint32
|
||||
tunnel
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/tunnel
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -52,3 +52,5 @@ func UserHome() string
|
||||
util
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/util
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -37,3 +37,5 @@ type Handler func()
|
||||
signals
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/util/signals
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
@ -122,3 +122,5 @@ func (z *Zones) GetZone(countryCode string) string
|
||||
sntp
|
||||
|
||||
github.com/go-i2p/go-i2p/lib/util/time/sntp
|
||||
|
||||
[go-i2p template file](/template.md)
|
||||
|
Reference in New Issue
Block a user