protocol

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2019 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package protocol defines types for the clock protocol.

Index

Constants

This section is empty.

Variables

View Source
var ProtocolID = protocol.ID("/stratumn/node/clock/v1.0.0")

ProtocolID is the protocol ID of the protocol.

Functions

This section is empty.

Types

type Clock

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

Clock implements the clock protocol.

func NewClock

func NewClock(host Host, timeout time.Duration) *Clock

NewClock creates a new clock.

func (*Clock) ProtocolID

func (c *Clock) ProtocolID() protocol.ID

ProtocolID returns this protocol ID

func (*Clock) RemoteTime

func (c *Clock) RemoteTime(ctx context.Context, pid peer.ID) (*time.Time, error)

RemoteTime asks a peer for its time.

func (*Clock) StreamHandler

func (c *Clock) StreamHandler(ctx context.Context, stream inet.Stream)

StreamHandler handles incoming messages from a peer.

func (*Clock) Wait

func (c *Clock) Wait()

Wait waits for all the streams to be closed.

type Host

type Host = ihost.Host

Host represents a Stratumn Node host.

Jump to

Keyboard shortcuts

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