Documentation ¶
Index ¶
- type CallOption
- type CertManager
- type Client
- type ControlClient
- func (c ControlClient) CollectiveKey() (*control.CokeyResponse, error)
- func (c ControlClient) GroupFile() (*control.GroupTOMLResponse, error)
- func (c *ControlClient) InitDKG(groupPath string, leader bool, timeout string) (*control.Empty, error)
- func (c *ControlClient) InitReshare(oldPath, newPath string, leader bool, timeout string) (*control.Empty, error)
- func (c *ControlClient) Ping() error
- func (c ControlClient) PrivateKey() (*control.PrivateKeyResponse, error)
- func (c ControlClient) PublicKey() (*control.PublicKeyResponse, error)
- func (c ControlClient) Share() (*control.ShareResponse, error)
- type ControlListener
- type DefaultControlServer
- func (s *DefaultControlServer) CollectiveKey(c context.Context, in *control.CokeyRequest) (*control.CokeyResponse, error)
- func (s *DefaultControlServer) PingPong(c context.Context, in *control.Ping) (*control.Pong, error)
- func (s *DefaultControlServer) PrivateKey(c context.Context, in *control.PrivateKeyRequest) (*control.PrivateKeyResponse, error)
- func (s *DefaultControlServer) PublicKey(c context.Context, in *control.PublicKeyRequest) (*control.PublicKeyResponse, error)
- func (s *DefaultControlServer) Share(c context.Context, in *control.ShareRequest) (*control.ShareResponse, error)
- type EmptyServer
- func (s *EmptyServer) CollectiveKey(context.Context, *drand.CokeyRequest) (*drand.CokeyResponse, error)
- func (s *EmptyServer) DistKey(context.Context, *drand.DistKeyRequest) (*drand.DistKeyResponse, error)
- func (s *EmptyServer) Group(context.Context, *drand.GroupRequest) (*drand.GroupResponse, error)
- func (s *EmptyServer) GroupFile(context.Context, *drand.GroupTOMLRequest) (*drand.GroupTOMLResponse, error)
- func (s *EmptyServer) Home(context.Context, *drand.HomeRequest) (*drand.HomeResponse, error)
- func (s *EmptyServer) InitDKG(context.Context, *drand.InitDKGPacket) (*drand.Empty, error)
- func (s *EmptyServer) InitReshare(context.Context, *drand.InitResharePacket) (*drand.Empty, error)
- func (s *EmptyServer) NewBeacon(context.Context, *drand.BeaconRequest) (*drand.BeaconResponse, error)
- func (s *EmptyServer) PingPong(context.Context, *drand.Ping) (*drand.Pong, error)
- func (s *EmptyServer) PrivateKey(context.Context, *drand.PrivateKeyRequest) (*drand.PrivateKeyResponse, error)
- func (s *EmptyServer) PrivateRand(context.Context, *drand.PrivateRandRequest) (*drand.PrivateRandResponse, error)
- func (s *EmptyServer) PublicKey(context.Context, *drand.PublicKeyRequest) (*drand.PublicKeyResponse, error)
- func (s *EmptyServer) PublicRand(context.Context, *drand.PublicRandRequest) (*drand.PublicRandResponse, error)
- func (s *EmptyServer) Reshare(context.Context, *drand.ResharePacket) (*drand.Empty, error)
- func (s *EmptyServer) Setup(context.Context, *drand.SetupPacket) (*drand.Empty, error)
- func (s *EmptyServer) Share(context.Context, *drand.ShareRequest) (*drand.ShareResponse, error)
- type Gateway
- type HexJSON
- func (*HexJSON) ContentType() string
- func (j *HexJSON) Delimiter() []byte
- func (j *HexJSON) Marshal(v interface{}) ([]byte, error)
- func (j *HexJSON) NewDecoder(r io.Reader) runtime.Decoder
- func (j *HexJSON) NewEncoder(w io.Writer) runtime.Encoder
- func (j *HexJSON) Unmarshal(data []byte, v interface{}) error
- type Listener
- type Peer
- type ProtocolClient
- type PublicClient
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallOption ¶ added in v0.3.7
type CallOption = grpc.CallOption
CallOption is simply a wrapper around the grpc options
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
NewCertManager returns a cert manager filled with the trusted certificates of the running system
func (*CertManager) Add ¶ added in v0.3.7
func (p *CertManager) Add(certPath string) error
Add tries to add the certificate at the given path to the pool and returns an error otherwise
func (*CertManager) Pool ¶ added in v0.3.7
func (p *CertManager) Pool() *x509.CertPool
Pool returns the pool of trusted certificates
type Client ¶
type Client interface { ProtocolClient PublicClient }
Client implements methods to call on the protocol API and the public API of a drand node
func NewGrpcClient ¶
func NewGrpcClient(opts ...grpc.DialOption) Client
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) Client
NewGrpcClientFromCertManager returns a Client using gRPC with the given trust store of certificates.
func NewGrpcClientWithTimeout ¶ added in v0.3.6
func NewGrpcClientWithTimeout(timeout time.Duration, opts ...grpc.DialOption) Client
NewGrpcClientWithTimeout returns a Client using gRPC using fixed timeout for method calls.
type ControlClient ¶ added in v0.4.0
type ControlClient struct {
// contains filtered or unexported fields
}
ControlClient is a struct that implement control.ControlClient and is used to request a Share to a ControlListener on a specific port
func NewControlClient ¶ added in v0.4.0
func NewControlClient(port string) (*ControlClient, error)
NewControlClient creates a client capable of issuing control commands to a localhost running drand node.
func (ControlClient) CollectiveKey ¶ added in v0.4.0
func (c ControlClient) CollectiveKey() (*control.CokeyResponse, error)
CollectiveKey returns the collective key of the remote node
func (ControlClient) GroupFile ¶ added in v0.5.0
func (c ControlClient) GroupFile() (*control.GroupTOMLResponse, error)
GroupFile returns the TOML-encoded group file
func (*ControlClient) InitDKG ¶ added in v0.4.0
func (c *ControlClient) InitDKG(groupPath string, leader bool, timeout string) (*control.Empty, error)
InitDKG sets up the node to be ready for a first DKG protocol. groupPart NOTE: only group referral via filesystem path is supported at the moment. XXX Might be best to move to core/
func (*ControlClient) InitReshare ¶ added in v0.4.0
func (c *ControlClient) InitReshare(oldPath, newPath string, leader bool, timeout string) (*control.Empty, error)
InitReshare sets up the node to be ready for a resharing protocol. oldPath and newPath represents the paths in the filesystems of the old group and the new group respectively. Leader is true if the destination node should start the protocol. NOTE: only group referral via filesystem path is supported at the moment. XXX Might be best to move to core/
func (*ControlClient) Ping ¶ added in v0.4.0
func (c *ControlClient) Ping() error
Ping the drand daemon to check if it's up and running
func (ControlClient) PrivateKey ¶ added in v0.4.0
func (c ControlClient) PrivateKey() (*control.PrivateKeyResponse, error)
PrivateKey returns the private key of the remote node
func (ControlClient) PublicKey ¶ added in v0.4.0
func (c ControlClient) PublicKey() (*control.PublicKeyResponse, error)
PublicKey returns the public key of the remote node
func (ControlClient) Share ¶ added in v0.4.0
func (c ControlClient) Share() (*control.ShareResponse, error)
Share returns the share of the remote node
type ControlListener ¶ added in v0.4.0
type ControlListener struct {
// contains filtered or unexported fields
}
ControlListener is used to keep state of the connections of our drand instance
func NewTCPGrpcControlListener ¶ added in v0.4.0
func NewTCPGrpcControlListener(s control.ControlServer, port string) ControlListener
NewTCPGrpcControlListener registers the pairing between a ControlServer and a grpx server
func (*ControlListener) Start ¶ added in v0.4.0
func (g *ControlListener) Start()
Start the listener for the control commands
func (*ControlListener) Stop ¶ added in v0.4.0
func (g *ControlListener) Stop()
Stop the listener and connections
type DefaultControlServer ¶ added in v0.4.0
type DefaultControlServer struct {
C control.ControlServer
}
DefaultControlServer implements the functionalities of Control Service, and just as Default Service, it is used for testing.
func (*DefaultControlServer) CollectiveKey ¶ added in v0.4.0
func (s *DefaultControlServer) CollectiveKey(c context.Context, in *control.CokeyRequest) (*control.CokeyResponse, error)
CollectiveKey ...
func (*DefaultControlServer) PrivateKey ¶ added in v0.4.0
func (s *DefaultControlServer) PrivateKey(c context.Context, in *control.PrivateKeyRequest) (*control.PrivateKeyResponse, error)
PrivateKey ...
func (*DefaultControlServer) PublicKey ¶ added in v0.4.0
func (s *DefaultControlServer) PublicKey(c context.Context, in *control.PublicKeyRequest) (*control.PublicKeyResponse, error)
PublicKey ...
func (*DefaultControlServer) Share ¶ added in v0.4.0
func (s *DefaultControlServer) Share(c context.Context, in *control.ShareRequest) (*control.ShareResponse, error)
Share ...
type EmptyServer ¶ added in v0.5.1
type EmptyServer struct{}
EmptyServer is an PublicServer + ProtocolServer that does nothing
func (*EmptyServer) CollectiveKey ¶ added in v0.5.1
func (s *EmptyServer) CollectiveKey(context.Context, *drand.CokeyRequest) (*drand.CokeyResponse, error)
CollectiveKey ...
func (*EmptyServer) DistKey ¶ added in v0.5.1
func (s *EmptyServer) DistKey(context.Context, *drand.DistKeyRequest) (*drand.DistKeyResponse, error)
DistKey ...
func (*EmptyServer) Group ¶ added in v0.5.1
func (s *EmptyServer) Group(context.Context, *drand.GroupRequest) (*drand.GroupResponse, error)
Group ...
func (*EmptyServer) GroupFile ¶ added in v0.5.1
func (s *EmptyServer) GroupFile(context.Context, *drand.GroupTOMLRequest) (*drand.GroupTOMLResponse, error)
GroupFile ...
func (*EmptyServer) Home ¶ added in v0.5.1
func (s *EmptyServer) Home(context.Context, *drand.HomeRequest) (*drand.HomeResponse, error)
Home ...
func (*EmptyServer) InitDKG ¶ added in v0.5.1
func (s *EmptyServer) InitDKG(context.Context, *drand.InitDKGPacket) (*drand.Empty, error)
InitDKG ...
func (*EmptyServer) InitReshare ¶ added in v0.5.1
func (s *EmptyServer) InitReshare(context.Context, *drand.InitResharePacket) (*drand.Empty, error)
InitReshare ...
func (*EmptyServer) NewBeacon ¶ added in v0.5.1
func (s *EmptyServer) NewBeacon(context.Context, *drand.BeaconRequest) (*drand.BeaconResponse, error)
NewBeacon ...
func (*EmptyServer) PrivateKey ¶ added in v0.5.1
func (s *EmptyServer) PrivateKey(context.Context, *drand.PrivateKeyRequest) (*drand.PrivateKeyResponse, error)
PrivateKey ...
func (*EmptyServer) PrivateRand ¶ added in v0.5.1
func (s *EmptyServer) PrivateRand(context.Context, *drand.PrivateRandRequest) (*drand.PrivateRandResponse, error)
PrivateRand ...
func (*EmptyServer) PublicKey ¶ added in v0.5.1
func (s *EmptyServer) PublicKey(context.Context, *drand.PublicKeyRequest) (*drand.PublicKeyResponse, error)
PublicKey ...
func (*EmptyServer) PublicRand ¶ added in v0.5.1
func (s *EmptyServer) PublicRand(context.Context, *drand.PublicRandRequest) (*drand.PublicRandResponse, error)
PublicRand ...
func (*EmptyServer) Reshare ¶ added in v0.5.1
func (s *EmptyServer) Reshare(context.Context, *drand.ResharePacket) (*drand.Empty, error)
Reshare ...
func (*EmptyServer) Setup ¶ added in v0.5.1
func (s *EmptyServer) Setup(context.Context, *drand.SetupPacket) (*drand.Empty, error)
Setup ...
func (*EmptyServer) Share ¶ added in v0.5.1
func (s *EmptyServer) Share(context.Context, *drand.ShareRequest) (*drand.ShareResponse, error)
Share ...
type Gateway ¶
type Gateway struct { Listener ProtocolClient }
Gateway is the main interface to communicate to other drand nodes. 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 NewGrpcGatewayFromCertManager ¶ added in v0.3.7
func NewGrpcGatewayFromCertManager(listen string, certPath, keyPath string, certs *CertManager, s Service, opts ...grpc.DialOption) Gateway
NewGrpcGatewayFromCertManager returns a grpc gateway using the TLS certificate manager
func NewGrpcGatewayInsecure ¶ added in v0.3.7
func NewGrpcGatewayInsecure(listen string, s Service, opts ...grpc.DialOption) Gateway
NewGrpcGatewayInsecure returns a grpc Gateway listening on "listen" for the public methods, listening on "port" for the control methods, using the given Service s with the given options.
type HexJSON ¶ added in v0.4.0
type HexJSON struct{}
HexJSON transforms json into hex string instead of b64
func (*HexJSON) ContentType ¶ added in v0.4.0
ContentType always Returns "application/json".
func (*HexJSON) NewDecoder ¶ added in v0.4.0
NewDecoder returns a Decoder which reads JSON stream from "r".
func (*HexJSON) NewEncoder ¶ added in v0.4.0
NewEncoder returns an Encoder which writes JSON stream into "w".
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
func NewTLSGrpcListener(bindingAddr string, certPath, keyPath string, s Service, opts ...grpc.ServerOption) (Listener, error)
NewTLSGrpcListener brings...
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 ProtocolClient ¶ added in v0.5.1
type ProtocolClient interface { NewBeacon(p Peer, in *drand.BeaconRequest, opts ...CallOption) (*drand.BeaconResponse, error) Setup(p Peer, in *drand.SetupPacket, opts ...CallOption) (*drand.Empty, error) SetTimeout(time.Duration) }
ProtocolClient holds all the methods of the protocol API that drand protocols use. See protobuf/drand/protocol.proto for more information.
type PublicClient ¶ added in v0.5.1
type PublicClient interface { PublicRand(p Peer, in *drand.PublicRandRequest) (*drand.PublicRandResponse, error) PrivateRand(p Peer, in *drand.PrivateRandRequest) (*drand.PrivateRandResponse, error) DistKey(p Peer, in *drand.DistKeyRequest) (*drand.DistKeyResponse, error) Group(p Peer, in *drand.GroupRequest) (*drand.GroupResponse, error) Home(p Peer, in *drand.HomeRequest) (*drand.HomeResponse, error) }
PublicClient holds all the methods of the public API . See `protobuf/drand/public.proto` for more information.
func NewRestClient ¶ added in v0.3.7
func NewRestClient() PublicClient
NewRestClient returns a client capable of calling external public method on drand nodes using the RESP API
func NewRestClientFromCertManager ¶ added in v0.3.7
func NewRestClientFromCertManager(c *CertManager) PublicClient
NewRestClientFromCertManager returns a Rest Client with the given cert manager
type Service ¶
type Service interface { drand.PublicServer drand.ControlServer drand.ProtocolServer }
Service holds all functionalities that a drand node should implement