Documentation
¶
Index ¶
- Variables
- func NewGrpcClient(opts ...grpc.DialOption) *grpcClient
- func NewGrpcClientFromCertManager(c *CertManager, opts ...grpc.DialOption) *grpcClient
- func NewGrpcClientWithTimeout(timeout time.Duration, opts ...grpc.DialOption) *grpcClient
- type CallOption
- type CertManager
- type DefaultService
- func (s *DefaultService) DistKey(c context.Context, in *drand.DistKeyRequest) (*drand.DistKeyResponse, error)
- func (s *DefaultService) NewBeacon(c context.Context, in *drand.BeaconRequest) (*drand.BeaconResponse, error)
- func (s *DefaultService) Private(c context.Context, in *drand.PrivateRandRequest) (*drand.PrivateRandResponse, error)
- func (s *DefaultService) Public(c context.Context, in *drand.PublicRandRequest) (*drand.PublicRandResponse, error)
- func (s *DefaultService) Setup(c context.Context, in *dkg.DKGPacket) (*dkg.DKGResponse, error)
- type ExternalClient
- type Gateway
- func NewGrpcGateway(listen string, certPath, keyPath string, s Service, opts ...grpc.DialOption) Gateway
- func NewGrpcGatewayFromCertManager(listen string, certPath, keyPath string, certs *CertManager, s Service, ...) Gateway
- func NewGrpcGatewayInsecure(listen string, s Service, opts ...grpc.DialOption) Gateway
- type InternalClient
- type Listener
- type Peer
- type Service
Constants ¶
This section is empty.
Variables ¶
var DefaultTimeout = time.Duration(30) * time.Second
Functions ¶
func NewGrpcClient ¶
func NewGrpcClient(opts ...grpc.DialOption) *grpcClient
NewGrpcClient returns an implementation of an InternalClient and ExternalClient using gRPC connections
func NewGrpcClientFromCertManager ¶ added in v0.3.7
func NewGrpcClientFromCertManager(c *CertManager, opts ...grpc.DialOption) *grpcClient
func NewGrpcClientWithTimeout ¶ added in v0.3.6
func NewGrpcClientWithTimeout(timeout time.Duration, opts ...grpc.DialOption) *grpcClient
Types ¶
type CallOption ¶ added in v0.3.7
type CallOption = grpc.CallOption
type CertManager ¶ added in v0.3.7
type CertManager struct {
// contains filtered or unexported fields
}
CertManager is used to managed certificates. It is most commonly used for testing with self signed certificate. By default, it returns the bundled set of certificates coming with the OS (Go's implementation).
func NewCertManager ¶ added in v0.3.7
func NewCertManager() *CertManager
func (*CertManager) Add ¶ added in v0.3.7
func (p *CertManager) Add(certPath string) error
func (*CertManager) Pool ¶ added in v0.3.7
func (p *CertManager) Pool() *x509.CertPool
type DefaultService ¶ added in v0.3.7
type DefaultService struct { B drand.BeaconServer R drand.RandomnessServer I drand.InfoServer D dkg.DkgServer }
Default service implements the Service interface with methods that returns empty messages. Default service is useful mainly for testing, where you want to implement only a specific functionality of a Service. To use : depending on which server you want to test, define a struct that implemants BeaconServer, RandomnessServer or DkgServer and instanciate defaultService with &DefaultService{<your struct>}.
func (*DefaultService) DistKey ¶ added in v0.3.7
func (s *DefaultService) DistKey(c context.Context, in *drand.DistKeyRequest) (*drand.DistKeyResponse, error)
func (*DefaultService) NewBeacon ¶ added in v0.3.7
func (s *DefaultService) NewBeacon(c context.Context, in *drand.BeaconRequest) (*drand.BeaconResponse, error)
func (*DefaultService) Private ¶ added in v0.3.7
func (s *DefaultService) Private(c context.Context, in *drand.PrivateRandRequest) (*drand.PrivateRandResponse, error)
func (*DefaultService) Public ¶ added in v0.3.7
func (s *DefaultService) Public(c context.Context, in *drand.PublicRandRequest) (*drand.PublicRandResponse, error)
func (*DefaultService) Setup ¶ added in v0.3.7
func (s *DefaultService) Setup(c context.Context, in *dkg.DKGPacket) (*dkg.DKGResponse, error)
type ExternalClient ¶ added in v0.3.7
type ExternalClient interface { Public(p Peer, in *drand.PublicRandRequest) (*drand.PublicRandResponse, error) Private(p Peer, in *drand.PrivateRandRequest) (*drand.PrivateRandResponse, error) DistKey(p Peer, in *drand.DistKeyRequest) (*drand.DistKeyResponse, error) }
func NewRestClient ¶ added in v0.3.7
func NewRestClient() ExternalClient
func NewRestClientFromCertManager ¶ added in v0.3.7
func NewRestClientFromCertManager(c *CertManager) ExternalClient
type Gateway ¶
type Gateway struct { Listener InternalClient }
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 NewGrpcGatewayFromCertManager ¶ added in v0.3.7
func NewGrpcGatewayFromCertManager(listen string, certPath, keyPath string, certs *CertManager, s Service, opts ...grpc.DialOption) Gateway
func NewGrpcGatewayInsecure ¶ added in v0.3.7
func NewGrpcGatewayInsecure(listen string, s Service, opts ...grpc.DialOption) Gateway
type InternalClient ¶ added in v0.3.7
type InternalClient interface { NewBeacon(p Peer, in *drand.BeaconRequest, opts ...CallOption) (*drand.BeaconResponse, error) Setup(p Peer, in *dkg.DKGPacket, opts ...CallOption) (*dkg.DKGResponse, error) }
InternalClient represents all methods callable on drand nodes which are internal to the system. See the folder api/ to get more info on the external API drand nodes offer.
type Listener ¶
type Listener interface { Service Start() Stop() }
Listener is the active listener for incoming requests.
func NewTCPGrpcListener ¶
func NewTCPGrpcListener(addr string, s Service, opts ...grpc.ServerOption) Listener
NewTCPGrpcListener returns a gRPC listener using plain TCP connections without TLS. The listener will bind to the given address:port tuple.
func NewTLSGrpcListener ¶ added in v0.3.7
type Peer ¶
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.InfoServer drand.BeaconServer dkg.DkgServer }
Service holds all functionalities that a drand node should implement