mirror of
https://github.com/go-i2p/go-i2p.git
synced 2025-06-07 18:24:25 -04:00
Remove unused function, fix spelling, update godoc
This commit is contained in:
@ -48,8 +48,8 @@ please keep up with these changes, as they will not be backward compatible and r
|
|||||||
- [ ] Message parsing
|
- [ ] Message parsing
|
||||||
- [ ] Message handling
|
- [ ] Message handling
|
||||||
- NetDB
|
- NetDB
|
||||||
- [/] Local storage
|
- [~] Local storage
|
||||||
- [/] Persistence to disk
|
- [~] Persistence to disk
|
||||||
- [X] Reseeding
|
- [X] Reseeding
|
||||||
- [ ] Lookups
|
- [ ] Lookups
|
||||||
- [ ] Expiry
|
- [ ] Expiry
|
||||||
|
@ -79,7 +79,7 @@ close every transport that this transport muxer has
|
|||||||
```go
|
```go
|
||||||
func (tmux *TransportMuxer) Compatible(routerInfo router_info.RouterInfo) (compat bool)
|
func (tmux *TransportMuxer) Compatible(routerInfo router_info.RouterInfo) (compat bool)
|
||||||
```
|
```
|
||||||
is there a transport that we mux that is compatable with this router info?
|
is there a transport that we mux that is compatible with this router info?
|
||||||
|
|
||||||
#### func (*TransportMuxer) GetSession
|
#### func (*TransportMuxer) GetSession
|
||||||
|
|
||||||
|
@ -23,11 +23,48 @@ type HandshakeState interface {
|
|||||||
|
|
||||||
// CompleteHandshake completes the handshake
|
// CompleteHandshake completes the handshake
|
||||||
CompleteHandshake() error
|
CompleteHandshake() error
|
||||||
|
|
||||||
|
SetEphemeralTransformer(transformer KeyTransformer)
|
||||||
|
GetHandshakeHash() []byte
|
||||||
|
SetPrologue(prologue []byte) error
|
||||||
|
MixHash(data []byte) error
|
||||||
|
MixKey(input []byte) ([]byte, error)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
HandshakeState manages the Noise handshake state
|
HandshakeState manages the Noise handshake state
|
||||||
|
|
||||||
|
#### type KeyTransformer
|
||||||
|
|
||||||
|
```go
|
||||||
|
type KeyTransformer interface {
|
||||||
|
ObfuscateKey(publicKey []byte) ([]byte, error)
|
||||||
|
DeobfuscateKey(obfuscatedKey []byte) ([]byte, error)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
KeyTransformer defines operations for transforming keys during handshake
|
||||||
|
|
||||||
|
#### type NoOpTransformer
|
||||||
|
|
||||||
|
```go
|
||||||
|
type NoOpTransformer struct{}
|
||||||
|
```
|
||||||
|
|
||||||
|
NoOpTransformer is a default implementation that doesn't transform keys
|
||||||
|
|
||||||
|
#### func (*NoOpTransformer) DeobfuscateKey
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (t *NoOpTransformer) DeobfuscateKey(obfuscatedKey []byte) ([]byte, error)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### func (*NoOpTransformer) ObfuscateKey
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (t *NoOpTransformer) ObfuscateKey(publicKey []byte) ([]byte, error)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
handshake
|
handshake
|
||||||
|
@ -74,7 +74,7 @@ func (tmux *TransportMuxer) Name() string {
|
|||||||
func (tmux *TransportMuxer) GetSession(routerInfo router_info.RouterInfo) (s TransportSession, err error) {
|
func (tmux *TransportMuxer) GetSession(routerInfo router_info.RouterInfo) (s TransportSession, err error) {
|
||||||
log.WithField("router_info", routerInfo.String()).Debug("TransportMuxer: Attempting to get session")
|
log.WithField("router_info", routerInfo.String()).Debug("TransportMuxer: Attempting to get session")
|
||||||
for i, t := range tmux.trans {
|
for i, t := range tmux.trans {
|
||||||
// pick the first one that is compatable
|
// pick the first one that is compatible
|
||||||
if t.Compatible(routerInfo) {
|
if t.Compatible(routerInfo) {
|
||||||
log.WithField("transport_index", i).Debug("TransportMuxer: Found compatible transport, attempting to get session")
|
log.WithField("transport_index", i).Debug("TransportMuxer: Found compatible transport, attempting to get session")
|
||||||
// try to get a session
|
// try to get a session
|
||||||
@ -96,7 +96,7 @@ func (tmux *TransportMuxer) GetSession(routerInfo router_info.RouterInfo) (s Tra
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// is there a transport that we mux that is compatable with this router info?
|
// is there a transport that we mux that is compatible with this router info?
|
||||||
func (tmux *TransportMuxer) Compatible(routerInfo router_info.RouterInfo) (compat bool) {
|
func (tmux *TransportMuxer) Compatible(routerInfo router_info.RouterInfo) (compat bool) {
|
||||||
log.WithField("router_info", routerInfo.String()).Debug("TransportMuxer: Checking compatibility")
|
log.WithField("router_info", routerInfo.String()).Debug("TransportMuxer: Checking compatibility")
|
||||||
for i, t := range tmux.trans {
|
for i, t := range tmux.trans {
|
||||||
|
@ -45,70 +45,17 @@ var (
|
|||||||
func NewNoiseTransportSession(ri router_info.RouterInfo) (transport.TransportSession, error)
|
func NewNoiseTransportSession(ri router_info.RouterInfo) (transport.TransportSession, error)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### type NoiseHandshakeState
|
|
||||||
|
|
||||||
```go
|
|
||||||
type NoiseHandshakeState struct {
|
|
||||||
*noise.HandshakeState
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
#### func NewHandshakeState
|
|
||||||
|
|
||||||
```go
|
|
||||||
func NewHandshakeState(staticKey noise.DHKey, isInitiator bool) (*NoiseHandshakeState, error)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### func (*NoiseHandshakeState) CompleteHandshake
|
|
||||||
|
|
||||||
```go
|
|
||||||
func (h *NoiseHandshakeState) CompleteHandshake() error
|
|
||||||
```
|
|
||||||
|
|
||||||
#### func (*NoiseHandshakeState) GenerateEphemeral
|
|
||||||
|
|
||||||
```go
|
|
||||||
func (h *NoiseHandshakeState) GenerateEphemeral() (*noise.DHKey, error)
|
|
||||||
```
|
|
||||||
GenerateEphemeral creates the ephemeral keypair that will be used in handshake
|
|
||||||
This needs to be separate so NTCP2 can obfuscate it
|
|
||||||
|
|
||||||
#### func (*NoiseHandshakeState) HandshakeComplete
|
|
||||||
|
|
||||||
```go
|
|
||||||
func (h *NoiseHandshakeState) HandshakeComplete() bool
|
|
||||||
```
|
|
||||||
|
|
||||||
#### func (*NoiseHandshakeState) ReadMessage
|
|
||||||
|
|
||||||
```go
|
|
||||||
func (h *NoiseHandshakeState) ReadMessage(message []byte) ([]byte, *noise.CipherState, *noise.CipherState, error)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### func (*NoiseHandshakeState) SetEphemeral
|
|
||||||
|
|
||||||
```go
|
|
||||||
func (h *NoiseHandshakeState) SetEphemeral(key *noise.DHKey) error
|
|
||||||
```
|
|
||||||
SetEphemeral allows setting a potentially modified ephemeral key This is needed
|
|
||||||
for NTCP2's obfuscation layer
|
|
||||||
|
|
||||||
#### func (*NoiseHandshakeState) WriteMessage
|
|
||||||
|
|
||||||
```go
|
|
||||||
func (h *NoiseHandshakeState) WriteMessage(payload []byte) ([]byte, *noise.CipherState, *noise.CipherState, error)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### type NoiseSession
|
#### type NoiseSession
|
||||||
|
|
||||||
```go
|
```go
|
||||||
type NoiseSession struct {
|
type NoiseSession struct {
|
||||||
router_info.RouterInfo
|
router_info.RouterInfo
|
||||||
|
handshake.HandshakeState
|
||||||
|
|
||||||
*noise.CipherState
|
*noise.CipherState
|
||||||
*sync.Cond
|
*sync.Cond
|
||||||
*NoiseTransport // The parent transport, which "Dialed" the connection to the peer with whom we established the session
|
*NoiseTransport // The parent transport, which "Dialed" the connection to the peer with whom we established the session
|
||||||
handshake.HandshakeState
|
|
||||||
RecvQueue *cb.Queue
|
RecvQueue *cb.Queue
|
||||||
SendQueue *cb.Queue
|
SendQueue *cb.Queue
|
||||||
VerifyCallback VerifyCallbackFunc
|
VerifyCallback VerifyCallbackFunc
|
||||||
@ -275,13 +222,6 @@ func (noopt *NoiseTransport) Close() error
|
|||||||
```
|
```
|
||||||
close the transport cleanly blocks until done returns an error if one happens
|
close the transport cleanly blocks until done returns an error if one happens
|
||||||
|
|
||||||
#### func (*NoiseTransport) Compatable
|
|
||||||
|
|
||||||
```go
|
|
||||||
func (noopt *NoiseTransport) Compatable(routerInfo router_info.RouterInfo) bool
|
|
||||||
```
|
|
||||||
Compatable return true if a routerInfo is compatable with this transport
|
|
||||||
|
|
||||||
#### func (*NoiseTransport) Compatible
|
#### func (*NoiseTransport) Compatible
|
||||||
|
|
||||||
```go
|
```go
|
||||||
|
179
lib/transport/noise/handshake/README.md
Normal file
179
lib/transport/noise/handshake/README.md
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
# handshake
|
||||||
|
--
|
||||||
|
import "github.com/go-i2p/go-i2p/lib/transport/noise/handshake"
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
#### type HandshakeBuilder
|
||||||
|
|
||||||
|
```go
|
||||||
|
type HandshakeBuilder struct {
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
HandshakeBuilder constructs customized HandshakeState instances
|
||||||
|
|
||||||
|
#### func NewHandshakeBuilder
|
||||||
|
|
||||||
|
```go
|
||||||
|
func NewHandshakeBuilder() *HandshakeBuilder
|
||||||
|
```
|
||||||
|
NewHandshakeBuilder creates a new HandshakeBuilder with default values
|
||||||
|
|
||||||
|
#### func (*HandshakeBuilder) AsInitiator
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (b *HandshakeBuilder) AsInitiator(isInitiator bool) *HandshakeBuilder
|
||||||
|
```
|
||||||
|
AsInitiator sets this handshake as the initiator
|
||||||
|
|
||||||
|
#### func (*HandshakeBuilder) Build
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (b *HandshakeBuilder) Build() (handshake.HandshakeState, error)
|
||||||
|
```
|
||||||
|
Build creates a configured HandshakeState
|
||||||
|
|
||||||
|
#### func (*HandshakeBuilder) WithKeyTransformer
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (b *HandshakeBuilder) WithKeyTransformer(transformer handshake.KeyTransformer) *HandshakeBuilder
|
||||||
|
```
|
||||||
|
WithKeyTransformer sets a custom key transformer
|
||||||
|
|
||||||
|
#### func (*HandshakeBuilder) WithPattern
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (b *HandshakeBuilder) WithPattern(pattern noise.HandshakePattern) *HandshakeBuilder
|
||||||
|
```
|
||||||
|
WithPattern sets the handshake pattern
|
||||||
|
|
||||||
|
#### func (*HandshakeBuilder) WithPeerStaticKey
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (b *HandshakeBuilder) WithPeerStaticKey(key []byte) *HandshakeBuilder
|
||||||
|
```
|
||||||
|
WithPeerStaticKey sets the peer's static key
|
||||||
|
|
||||||
|
#### func (*HandshakeBuilder) WithPrologue
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (b *HandshakeBuilder) WithPrologue(prologue []byte) *HandshakeBuilder
|
||||||
|
```
|
||||||
|
WithPrologue sets the prologue data
|
||||||
|
|
||||||
|
#### func (*HandshakeBuilder) WithStaticKey
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (b *HandshakeBuilder) WithStaticKey(key noise.DHKey) *HandshakeBuilder
|
||||||
|
```
|
||||||
|
WithStaticKey sets the local static key
|
||||||
|
|
||||||
|
#### type NoiseHandshakeState
|
||||||
|
|
||||||
|
```go
|
||||||
|
type NoiseHandshakeState struct {
|
||||||
|
noise.HandshakePattern
|
||||||
|
*noise.HandshakeState
|
||||||
|
handshake.KeyTransformer
|
||||||
|
*kdf.NoiseKDF
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
HandshakeState wraps noise.HandshakeState with additional functionality
|
||||||
|
|
||||||
|
#### func NewHandshakeState
|
||||||
|
|
||||||
|
```go
|
||||||
|
func NewHandshakeState(staticKey noise.DHKey, isInitiator bool) (*NoiseHandshakeState, error)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### func (*NoiseHandshakeState) CompleteHandshake
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (hs *NoiseHandshakeState) CompleteHandshake() error
|
||||||
|
```
|
||||||
|
CompleteHandshake implements handshake.HandshakeState
|
||||||
|
|
||||||
|
#### func (*NoiseHandshakeState) GenerateEphemeral
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (hs *NoiseHandshakeState) GenerateEphemeral() (*noise.DHKey, error)
|
||||||
|
```
|
||||||
|
GenerateEphemeral implements handshake.HandshakeState
|
||||||
|
|
||||||
|
#### func (*NoiseHandshakeState) GetHandshakeHash
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (hs *NoiseHandshakeState) GetHandshakeHash() []byte
|
||||||
|
```
|
||||||
|
GetHandshakeHash implements handshake.HandshakeState
|
||||||
|
|
||||||
|
#### func (*NoiseHandshakeState) HandshakeComplete
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (hs *NoiseHandshakeState) HandshakeComplete() bool
|
||||||
|
```
|
||||||
|
HandshakeComplete implements handshake.HandshakeState
|
||||||
|
|
||||||
|
#### func (*NoiseHandshakeState) MixHash
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (hs *NoiseHandshakeState) MixHash(data []byte) error
|
||||||
|
```
|
||||||
|
MixHash implements handshake.HandshakeState
|
||||||
|
|
||||||
|
#### func (*NoiseHandshakeState) MixKey
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (hs *NoiseHandshakeState) MixKey(input []byte) ([]byte, error)
|
||||||
|
```
|
||||||
|
MixKey implements handshake.HandshakeState
|
||||||
|
|
||||||
|
#### func (*NoiseHandshakeState) ReadMessage
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (hs *NoiseHandshakeState) ReadMessage(message []byte) ([]byte, *noise.CipherState, *noise.CipherState, error)
|
||||||
|
```
|
||||||
|
ReadMessage implements handshake.HandshakeState
|
||||||
|
|
||||||
|
#### func (*NoiseHandshakeState) SetEphemeral
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (h *NoiseHandshakeState) SetEphemeral(key *noise.DHKey) error
|
||||||
|
```
|
||||||
|
SetEphemeral allows setting a potentially modified ephemeral key This is needed
|
||||||
|
for NTCP2's obfuscation layer
|
||||||
|
|
||||||
|
#### func (*NoiseHandshakeState) SetEphemeralTransformer
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (hs *NoiseHandshakeState) SetEphemeralTransformer(transformer handshake.KeyTransformer)
|
||||||
|
```
|
||||||
|
SetEphemeralTransformer implements handshake.HandshakeState
|
||||||
|
|
||||||
|
#### func (*NoiseHandshakeState) SetPrologue
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (hs *NoiseHandshakeState) SetPrologue(prologue []byte) error
|
||||||
|
```
|
||||||
|
SetPrologue implements handshake.HandshakeState
|
||||||
|
|
||||||
|
#### func (*NoiseHandshakeState) WriteMessage
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (hs *NoiseHandshakeState) WriteMessage(payload []byte) ([]byte, *noise.CipherState, *noise.CipherState, error)
|
||||||
|
```
|
||||||
|
WriteMessage implements handshake.HandshakeState
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
handshake
|
||||||
|
|
||||||
|
github.com/go-i2p/go-i2p/lib/transport/noise/handshake
|
||||||
|
|
||||||
|
[go-i2p template file](/template.md)
|
67
lib/transport/noise/kdf/README.md
Normal file
67
lib/transport/noise/kdf/README.md
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# kdf
|
||||||
|
--
|
||||||
|
import "github.com/go-i2p/go-i2p/lib/transport/noise/kdf"
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
#### type NoiseKDF
|
||||||
|
|
||||||
|
```go
|
||||||
|
type NoiseKDF struct {
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
NoiseKDF handles key derivation functions for Noise protocols
|
||||||
|
|
||||||
|
#### func NewNoiseKDF
|
||||||
|
|
||||||
|
```go
|
||||||
|
func NewNoiseKDF(protocolName []byte) *NoiseKDF
|
||||||
|
```
|
||||||
|
NewNoiseKDF creates a new KDF instance with the protocol name
|
||||||
|
|
||||||
|
#### func (*NoiseKDF) DeriveSessionKeys
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (k *NoiseKDF) DeriveSessionKeys() (sendKey, recvKey []byte, err error)
|
||||||
|
```
|
||||||
|
DeriveSessionKeys derives transport keys from the KDF state
|
||||||
|
|
||||||
|
#### func (*NoiseKDF) GetHandshakeHash
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (k *NoiseKDF) GetHandshakeHash() []byte
|
||||||
|
```
|
||||||
|
GetHandshakeHash returns the current handshake hash
|
||||||
|
|
||||||
|
#### func (*NoiseKDF) MixHash
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (k *NoiseKDF) MixHash(data []byte) error
|
||||||
|
```
|
||||||
|
MixHash updates the handshake hash with new data
|
||||||
|
|
||||||
|
#### func (*NoiseKDF) MixKey
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (k *NoiseKDF) MixKey(input []byte) ([]byte, error)
|
||||||
|
```
|
||||||
|
MixKey derives a new key from the chaining key and input material
|
||||||
|
|
||||||
|
#### func (*NoiseKDF) SetHash
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (k *NoiseKDF) SetHash(hash []byte)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
kdf
|
||||||
|
|
||||||
|
github.com/go-i2p/go-i2p/lib/transport/noise/kdf
|
||||||
|
|
||||||
|
[go-i2p template file](/template.md)
|
@ -156,16 +156,6 @@ func (c *NoiseTransport) getSession(routerInfo router_info.RouterInfo) (transpor
|
|||||||
return session, nil
|
return session, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compatable return true if a routerInfo is compatable with this transport
|
|
||||||
func (noopt *NoiseTransport) Compatable(routerInfo router_info.RouterInfo) bool {
|
|
||||||
_, ok := noopt.peerConnections[routerInfo.IdentHash()]
|
|
||||||
log.WithFields(logrus.Fields{
|
|
||||||
"router_info": routerInfo.String(),
|
|
||||||
"compatible": ok,
|
|
||||||
}).Debug("NoiseTransport: Checking compatibility")
|
|
||||||
return ok
|
|
||||||
}
|
|
||||||
|
|
||||||
// close the transport cleanly
|
// close the transport cleanly
|
||||||
// blocks until done
|
// blocks until done
|
||||||
// returns an error if one happens
|
// returns an error if one happens
|
||||||
|
@ -134,6 +134,13 @@ func NewNTCP2Session(routerInfo router_info.RouterInfo) (*NTCP2Session, error)
|
|||||||
NewNTCP2Session creates a new NTCP2 session using the existing noise
|
NewNTCP2Session creates a new NTCP2 session using the existing noise
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
#### func (*NTCP2Session) AddDelayForSecurity
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *NTCP2Session) AddDelayForSecurity()
|
||||||
|
```
|
||||||
|
addDelayForSecurity adds a small random delay to resist probing
|
||||||
|
|
||||||
#### func (*NTCP2Session) CreateHandshakeProcessors
|
#### func (*NTCP2Session) CreateHandshakeProcessors
|
||||||
|
|
||||||
```go
|
```go
|
||||||
@ -279,6 +286,35 @@ SessionRequest (Message 1) 2. Receives and processes SessionCreated (Message 2)
|
|||||||
3. Creates and sends SessionConfirmed (Message 3) After successful completion,
|
3. Creates and sends SessionConfirmed (Message 3) After successful completion,
|
||||||
the session is established and ready for data exchange.
|
the session is established and ready for data exchange.
|
||||||
|
|
||||||
|
#### func (*NTCP2Session) ProcessEphemeralKey
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *NTCP2Session) ProcessEphemeralKey(obfuscatedX []byte, hs *handshake.HandshakeState) ([]byte, error)
|
||||||
|
```
|
||||||
|
processEphemeralKey deobfuscates and validates the ephemeral key
|
||||||
|
|
||||||
|
#### func (*NTCP2Session) ReadAndValidatePadding
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *NTCP2Session) ReadAndValidatePadding(conn net.Conn, paddingLen int) error
|
||||||
|
```
|
||||||
|
readAndValidatePadding reads the padding from the connection
|
||||||
|
|
||||||
|
#### func (*NTCP2Session) ReadEphemeralKey
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (c *NTCP2Session) ReadEphemeralKey(conn net.Conn) ([]byte, error)
|
||||||
|
```
|
||||||
|
readEphemeralKey reads the ephemeral key (X) from the connection
|
||||||
|
|
||||||
|
#### func (*NTCP2Session) ValidateTimestamp
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (s *NTCP2Session) ValidateTimestamp(timestamp time.Time) error
|
||||||
|
```
|
||||||
|
Add this method to NTCP2Session ValidateTimestamp validates a timestamp is
|
||||||
|
within acceptable range
|
||||||
|
|
||||||
#### type NTCP2Transport
|
#### type NTCP2Transport
|
||||||
|
|
||||||
```go
|
```go
|
||||||
@ -321,6 +357,13 @@ func (t *NTCP2Transport) Compatible(routerInfo router_info.RouterInfo) bool
|
|||||||
func (t *NTCP2Transport) GetSession(routerInfo router_info.RouterInfo) (transport.TransportSession, error)
|
func (t *NTCP2Transport) GetSession(routerInfo router_info.RouterInfo) (transport.TransportSession, error)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### func (*NTCP2Transport) LocalStaticKey
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (s *NTCP2Transport) LocalStaticKey() ([32]byte, error)
|
||||||
|
```
|
||||||
|
LocalStaticKey is equal to the NTCP2 static public key, found in our router info
|
||||||
|
|
||||||
#### func (*NTCP2Transport) Name
|
#### func (*NTCP2Transport) Name
|
||||||
|
|
||||||
```go
|
```go
|
||||||
|
@ -83,6 +83,13 @@ func (h *HandshakeState) GenerateEphemeral() (*noise.DHKey, error)
|
|||||||
```
|
```
|
||||||
GenerateEphemeral implements handshake.HandshakeState.
|
GenerateEphemeral implements handshake.HandshakeState.
|
||||||
|
|
||||||
|
#### func (*HandshakeState) GetHandshakeHash
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (h *HandshakeState) GetHandshakeHash() []byte
|
||||||
|
```
|
||||||
|
GetHandshakeHash implements handshake.HandshakeState.
|
||||||
|
|
||||||
#### func (*HandshakeState) HandshakeComplete
|
#### func (*HandshakeState) HandshakeComplete
|
||||||
|
|
||||||
```go
|
```go
|
||||||
@ -90,6 +97,34 @@ func (h *HandshakeState) HandshakeComplete() bool
|
|||||||
```
|
```
|
||||||
HandshakeComplete implements handshake.HandshakeState.
|
HandshakeComplete implements handshake.HandshakeState.
|
||||||
|
|
||||||
|
#### func (*HandshakeState) MixHash
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (h *HandshakeState) MixHash(data []byte) error
|
||||||
|
```
|
||||||
|
MixHash implements handshake.HandshakeState.
|
||||||
|
|
||||||
|
#### func (*HandshakeState) MixKey
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (h *HandshakeState) MixKey(input []byte) ([]byte, error)
|
||||||
|
```
|
||||||
|
MixKey implements handshake.HandshakeState.
|
||||||
|
|
||||||
|
#### func (*HandshakeState) SetEphemeralTransformer
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (h *HandshakeState) SetEphemeralTransformer(transformer handshake.KeyTransformer)
|
||||||
|
```
|
||||||
|
SetEphemeralTransformer implements handshake.HandshakeState.
|
||||||
|
|
||||||
|
#### func (*HandshakeState) SetPrologue
|
||||||
|
|
||||||
|
```go
|
||||||
|
func (h *HandshakeState) SetPrologue(prologue []byte) error
|
||||||
|
```
|
||||||
|
SetPrologue implements handshake.HandshakeState.
|
||||||
|
|
||||||
#### func (*HandshakeState) WriteMessage
|
#### func (*HandshakeState) WriteMessage
|
||||||
|
|
||||||
```go
|
```go
|
||||||
|
Reference in New Issue
Block a user