knock

package
v0.0.0-...-fd3cab2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

knock = version (1 byte) || pk (ed25519.PublicKeySize) || sig (ed25519.SignatureSize)

Variables

View Source
var (
	ErrSizeMismatch     = fmt.Errorf("knock size mismatch")
	ErrFromSelfDial     = fmt.Errorf("knock from self-dial")
	ErrInvalidSignature = fmt.Errorf("knock has invalid signature")
)

Functions

func BuildKnock

func BuildKnock(other types.PeerID, self types.PeerID, secretKey ed25519.PrivateKey) []byte

Builds a knock message based on the PeerID of the node being dialed (other), the dialing node (self). The dialing node's secretKey is used for signing the message and must correspond to self.

Returns a knock message exactly KnockSize bytes long.

func VerifyKnock

func VerifyKnock(self types.PeerID, knock []byte) (*types.PeerID, error)

Verifies a knock message allegedly destined to self. If the message is valid, returns the PeerId of the sender. Otherwise returns nil and an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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