host

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host

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

Host listens on grpc

func New

func New(props *Props) *Host

New returns a new grpc host

func (*Host) CloseAllPeerConnections

func (h *Host) CloseAllPeerConnections(ctx context.Context, _ *empty.Empty) (*pb.CloseAllPeerConnectionsReply, error)

CloseAllPeerConnections closes all connections note: is this working correctly?

func (*Host) ClosePeerConnections

func (h *Host) ClosePeerConnections(ctx context.Context, peersList *pb.PeersList) (*pb.ClosePeerConnectionsReply, error)

ClosePeerConnections closes connections to listed peers

func (*Host) ID

func (h *Host) ID(ctx context.Context, _ *empty.Empty) (*pb.IDReply, error)

ID returns the libp2p host id

func (*Host) ListConnectedPeers

func (h *Host) ListConnectedPeers(ctx context.Context, _ *empty.Empty) (*pb.PeersList, error)

ListConnectedPeers lists the host's connected peers

func (*Host) Listen

func (h *Host) Listen(ctx context.Context, addr string) error

Listen starts the grpc host

func (*Host) ListenAddresses

func (h *Host) ListenAddresses(ctx context.Context, _ *empty.Empty) (*pb.ListenAddressesReply, error)

ListenAddresses returns the addresses on which the libp2p is listening

func (*Host) OpenPeersConnections

func (h *Host) OpenPeersConnections(ctx context.Context, peersList *pb.PeersList) (*pb.OpenPeersConnectionsReplies, error)

OpenPeersConnections opens connections to listed peers

func (*Host) PublishMessage

func (h *Host) PublishMessage(ctx context.Context, in *pb.Message) (*pb.PublishReply, error)

PublishMessage implements

func (*Host) Shutdown

func (h *Host) Shutdown(ctx context.Context, _ *empty.Empty) (*pb.ShutdownReply, error)

Shutdown shuts the host down

type Props

type Props struct {
	Host        host.Host
	CH          chan error
	PS          *pubsub.PubSub
	PubsubTopic string
	CTX         context.Context
	Shutdown    chan struct{}
}

Props are passed to New

Jump to

Keyboard shortcuts

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