p2p

package
v0.0.0-...-3e8bfaa Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const ProtocolID = "/cipher/v5/chunk/1.0.0"

Variables

This section is empty.

Functions

func GetHostPrivateKey

func GetHostPrivateKey(h host.Host) crypto.PrivKey

GetHostPrivateKey returns the private key for the given host.

func NewHost

func NewHost(ctx context.Context, opts HostOptions) (host.Host, error)

NewHost creates a new libp2p host for CIPHER.

func ProviderStreamHandler

func ProviderStreamHandler(store *engine.ChunkStore) network.StreamHandler

ProviderStreamHandler adapts the engine to a libp2p stream.

func RequestChunk

func RequestChunk(ctx context.Context, h host.Host, providerID peer.ID,
	fileID [32]byte, merkleRoot [32]byte, chunkIndex uint64,
	signingKey p2pcrypto.PrivKey) ([]byte, error)

RequestChunk performs the full 4-message handshake for one chunk.

Types

type HostOptions

type HostOptions struct {
	ListenPort  int
	PrivKeyPath string
	EnableMDNS  bool
	RelayAddr   string
}

HostOptions configures the libp2p host.

Jump to

Keyboard shortcuts

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