net

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: May 16, 2018 License: MIT Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTLS

func IsTLS(addr string) bool

IsTLS returns true if the address starts with HTTPS

Types

type Client

type Client interface {
	Public(p Peer, in *drand.PublicRandRequest) (*drand.PublicRandResponse, error)
	Private(p Peer, in *drand.PrivateRandRequest) (*drand.PrivateRandResponse, error)
	NewBeacon(p Peer, in *drand.BeaconRequest) (*drand.BeaconResponse, error)
	Setup(p Peer, in *dkg.DKGPacket) (*dkg.DKGResponse, error)
}

Client represents all methods that are callable on drand nodes

func NewGrpcClient

func NewGrpcClient(opts ...grpc.DialOption) Client

NewGrpcClient returns a Client using gRPC connections

type Gateway

type Gateway struct {
	Listener
	Client
}

Gateway is the main interface to communicate to the drand world. It acts as a listener to receive incoming requests and acts a client connecting to drand particpants. The gateway fixes all drand functionalities offered by drand.

func NewGrpcGateway

func NewGrpcGateway(listen string, s Service, opts ...grpc.DialOption) Gateway

type Listener

type Listener interface {
	Start()
	Stop()
	Service
}

Listener is the active listener for incoming requests.

func NewGrpcListener

func NewGrpcListener(l net.Listener, s Service, opts ...grpc.ServerOption) Listener

NewGrpcListener returns a new Listener from the given network Listener and some options that may be necessary to gRPC. The caller should preferable use NewTCPGrpcListener or NewTLSgRPCListener.

func NewTCPGrpcListener

func NewTCPGrpcListener(addr string, s Service) Listener

NewTCPGrpcListener returns a gRPC listener using plain TCP connections without TLS. The listener will bind to the given address:port tuple.

type Peer

type Peer interface {
	Address() string
}

Peer is a simple interface that allows retrieving the address of a destination. It might further e enhanced with certificates properties and all.

type Service

type Service interface {
	drand.RandomnessServer
	drand.BeaconServer
	dkg.DkgServer
}

Service holds all functionalities that a drand node should implement

Jump to

Keyboard shortcuts

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