types

package
v0.0.0-...-0a5e2f9 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: MIT Imports: 6 Imported by: 48

Documentation

Index

Constants

View Source
const MaxMessageLength = 1024 * 1024 * 1024 // 1 GiB. This must be smaller than INT32_MAX
View Source
const MaxPeersPerHost = 256

The maximum number of peers we can have across all concurrent streams on a host. The exact number is chosen arbitrarily. Better to have an arbitrary limit than no limit. If you are using ragedisco for peer discovery, also note the separate limit in ragedisco.MaxOracles.

View Source
const MaxStreamNameLength = 256
View Source
const MaxStreamsPerPeer = 2_000

Variables

This section is empty.

Functions

func Ed25519PublicKeyFromPeerPublicKey

func Ed25519PublicKeyFromPeerPublicKey(pk PeerPublicKey) ed25519.PublicKey

Types

type Address

type Address string

Address represents a network address & port such as "192.168.1.2:8080". It can also contain special bind addresses such as "0.0.0.0:80".

type PeerID

type PeerID [ed25519.PublicKeySize]byte

PeerID represents a unique identifier for another peer.

func PeerIDFromKeyring

func PeerIDFromKeyring(keyring PeerKeyring) PeerID

func PeerIDFromPeerPublicKey

func PeerIDFromPeerPublicKey(pk PeerPublicKey) PeerID

func PeerIDFromPrivateKey

func PeerIDFromPrivateKey(sk ed25519.PrivateKey) (PeerID, error)

func PeerIDFromPublicKey

func PeerIDFromPublicKey(pk ed25519.PublicKey) (PeerID, error)

func (PeerID) MarshalBinary

func (p PeerID) MarshalBinary() (data []byte, err error)

func (PeerID) MarshalText

func (p PeerID) MarshalText() (text []byte, err error)

func (PeerID) String

func (p PeerID) String() string

func (*PeerID) UnmarshalBinary

func (p *PeerID) UnmarshalBinary(data []byte) error

func (*PeerID) UnmarshalText

func (p *PeerID) UnmarshalText(text []byte) error

type PeerInfo

type PeerInfo struct {
	ID    PeerID
	Addrs []Address
}

type PeerKeyring

type PeerKeyring interface {
	// Sign returns an EdDSA-Ed25519 signature on msg produced using the
	// standard library's ed25519.Sign function. Must be fast.
	Sign(msg []byte) (signature []byte, err error)

	// PublicKey returns the public component of the keypair used in Sign.
	PublicKey() PeerPublicKey
}

type PeerPublicKey

type PeerPublicKey [ed25519.PublicKeySize]byte

PeerPublicKey is the public key used to cryptographically identify an oracle in p2p related communications and peer discovery.

func MustPeerPublicKeyFromGenericPublicKey

func MustPeerPublicKeyFromGenericPublicKey(publickey crypto.PublicKey) PeerPublicKey

func PeerPublicKeyFromGenericPublicKey

func PeerPublicKeyFromGenericPublicKey(publickey crypto.PublicKey) (PeerPublicKey, error)

type TokenBucketParams

type TokenBucketParams struct {
	Rate     float64
	Capacity uint32
}

TokenBucketParams contains the two parameters for a token bucket rate limiter.

Jump to

Keyboard shortcuts

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