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 ControlClient
- func (c ControlClient) CollectiveKey() (*control.CokeyResponse, error)
- func (c *ControlClient) Group() (*control.GroupResponse, error)
- func (c *ControlClient) InitDKG(groupPath string, leader bool) (*control.DKGResponse, error)
- func (c *ControlClient) InitReshare(oldPath, newPath string, leader bool) (*control.ReshareResponse, 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) Group(c context.Context, in *control.GroupRequest) (*control.GroupResponse, 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 DefaultService
- func (s *DefaultService) DistKey(c context.Context, in *drand.DistKeyRequest) (*drand.DistKeyResponse, error)
- func (s *DefaultService) Home(c context.Context, in *drand.HomeRequest) (*drand.HomeResponse, 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) Reshare(c context.Context, in *dkg.ResharePacket) (*dkg.ReshareResponse, error)
- func (s *DefaultService) Setup(c context.Context, in *dkg.DKGPacket) (*dkg.DKGResponse, error)
- type ExternalClient
- 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 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
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) *grpcClient
NewGrpcClientWithTimeout returns a Client using gRPC using fixed timeout for method calls.
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
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 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)
func (*ControlClient) Group ¶ added in v0.4.0
func (c *ControlClient) Group() (*control.GroupResponse, error)
func (*ControlClient) InitDKG ¶ added in v0.4.0
func (c *ControlClient) InitDKG(groupPath string, leader bool) (*control.DKGResponse, 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) (*control.ReshareResponse, 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
func (ControlClient) PrivateKey ¶ added in v0.4.0
func (c ControlClient) PrivateKey() (*control.PrivateKeyResponse, error)
func (ControlClient) PublicKey ¶ added in v0.4.0
func (c ControlClient) PublicKey() (*control.PublicKeyResponse, error)
func (ControlClient) Share ¶ added in v0.4.0
func (c ControlClient) Share() (*control.ShareResponse, error)
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()
func (*ControlListener) Stop ¶ added in v0.4.0
func (g *ControlListener) Stop()
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)
func (*DefaultControlServer) Group ¶ added in v0.4.0
func (s *DefaultControlServer) Group(c context.Context, in *control.GroupRequest) (*control.GroupResponse, error)
func (*DefaultControlServer) PrivateKey ¶ added in v0.4.0
func (s *DefaultControlServer) PrivateKey(c context.Context, in *control.PrivateKeyRequest) (*control.PrivateKeyResponse, error)
func (*DefaultControlServer) PublicKey ¶ added in v0.4.0
func (s *DefaultControlServer) PublicKey(c context.Context, in *control.PublicKeyRequest) (*control.PublicKeyResponse, error)
func (*DefaultControlServer) Share ¶ added in v0.4.0
func (s *DefaultControlServer) Share(c context.Context, in *control.ShareRequest) (*control.ShareResponse, error)
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) Home ¶ added in v0.4.1
func (s *DefaultService) Home(c context.Context, in *drand.HomeRequest) (*drand.HomeResponse, 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) Reshare ¶ added in v0.4.0
func (s *DefaultService) Reshare(c context.Context, in *dkg.ResharePacket) (*dkg.ReshareResponse, 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
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) ExternalClient
NewRestClientFromCertManager returns a Rest Client with the given cert manager
type Gateway ¶
type Gateway struct { Listener InternalClient ControlListener }
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 NewGrpcGatewayFromCertManager ¶ added in v0.3.7
func NewGrpcGatewayFromCertManager(listen string, port string, certPath, keyPath string, certs *CertManager, s Service, cs control.ControlServer, opts ...grpc.DialOption) Gateway
func NewGrpcGatewayInsecure ¶ added in v0.3.7
func NewGrpcGatewayInsecure(listen string, port string, s Service, cs control.ControlServer, opts ...grpc.DialOption) Gateway
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 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 relevant protobuf files in `/protobuf` for more informations.
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 Service ¶
type Service interface { drand.RandomnessServer drand.InfoServer drand.BeaconServer dkg.DkgServer }
Service holds all functionalities that a drand node should implement