p2p

package
v0.0.0-...-6721946 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: LGPL-2.1 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthorizationChannel       string = "ml-authorization-channel"
	TopicChannel               string = "ml-topic-channel"
	MessageChannel             string = "ml-message-channel"
	SubscriptionChannel               = "ml-subscription-channel"
	UnSubscribeChannel                = "ml-unsubscribe-channel"
	ApproveSubscriptionChannel        = "ml-approve-subscription-channel"
	BatchChannel                      = "ml-batch-channel"
	DeliveryProofChannel              = "ml-delivery-proof"
)
View Source
const DiscoveryServiceTag = "ml-network"

Variables

This section is empty.

Functions

func Discover

func Discover(ctx context.Context, h host.Host, kdht *dht.IpfsDHT, rendezvous string)

func ProcessEventsReceivedFromOtherNodes

func ProcessEventsReceivedFromOtherNodes[PayloadData any](payload *PayloadData, fromPubSubChannel *Channel, mainCtx *context.Context, process func(event *entities.Event, ctx *context.Context))

func PublishChannelEventToNetwork

func PublishChannelEventToNetwork(channelPool chan *entities.Event, pubsubChannel *Channel, mainCtx *context.Context)

** Publish Events to a specified p2p broadcast channel ****

func Run

func Run(mainCtx *context.Context)

Types

type Channel

type Channel struct {
	// Messages is a channel of messages received from other peers in the chat channel
	Messages chan entities.PubSubMessage

	Ctx context.Context

	Topic *pubsub.Topic

	ChannelName string
	ID          peer.ID
	Wallet      string
	// contains filtered or unexported fields
}

func JoinChannel

func JoinChannel(ctx context.Context, ps *pubsub.PubSub, selfID peer.ID, walletAddress string, channelName string, channelBufferSize uint) (*Channel, error)

func (*Channel) ListPeers

func (cr *Channel) ListPeers() []peer.ID

func (*Channel) Publish

func (cr *Channel) Publish(m entities.PubSubMessage) error

Publish sends a message to the pubsub topic.

Jump to

Keyboard shortcuts

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