bcnet

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

bcnet implements the Blobcache Protocol (BCP).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessFunc

type AccessFunc func(blobcache.PeerID) blobcache.Service

AccessFun is called to get a service to access

type Marshaller

type Marshaller interface {
	Marshal(out []byte) []byte
}

type Message

type Message = bcp.Message

type Node

type Node struct {
	// contains filtered or unexported fields
}

func New

func New(privateKey ed25519.PrivateKey, pc net.PacketConn) *Node

func (*Node) Ask

func (n *Node) Ask(ctx context.Context, remote blobcache.Endpoint, req Message, resp *Message) error

Ask opens a bidirectional stream to the given peer and sends the given request, then waits for a response.

func (*Node) LocalAddr

func (n *Node) LocalAddr() netip.AddrPort

func (*Node) LocalEndpoint

func (n *Node) LocalEndpoint() blobcache.Endpoint

func (*Node) LocalID

func (n *Node) LocalID() blobcache.PeerID

func (*Node) Serve

func (n *Node) Serve(ctx context.Context, srv Server) error

Serve blocks handling all incoming connections, until ctx is cancelled.

func (*Node) Tell

func (n *Node) Tell(ctx context.Context, remote blobcache.Endpoint, req bcp.Message) error

Tell opens a uni-stream to the given peer and sends the given request.

type Server

type Server struct {
	Access  AccessFunc
	Deliver func(ctx context.Context, from blobcache.Endpoint, ttm bcp.TopicTellMsg) error
}

type TopicMessage

type TopicMessage = blobcache.Message

type Unmarshaller

type Unmarshaller interface {
	Unmarshal(data []byte) error
}

Jump to

Keyboard shortcuts

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