Documentation ¶
Index ¶
- Variables
- type EndpointTimeoutError
- type RemoteSignerError
- type RemoteSignerLoadBalancer
- type SignerListener
- func (se SignerListener) Close() error
- func (se SignerListener) DropConnection()
- func (se SignerListener) GetAvailableConnection(connectionAvailableCh chan net.Conn) bool
- func (se SignerListener) IsConnected() bool
- func (se SignerListener) ReadMessage() (msg privvalproto.Message, err error)
- func (se SignerListener) SetConnection(newConnection net.Conn)
- func (se SignerListener) WaitConnection(connectionAvailableCh chan net.Conn, maxWait time.Duration) error
- func (se SignerListener) WriteMessage(msg privvalproto.Message) (err error)
- type SignerListenerEndpoint
- func (se *SignerListenerEndpoint) Close() error
- func (se *SignerListenerEndpoint) DropConnection()
- func (se *SignerListenerEndpoint) GetAvailableConnection(connectionAvailableCh chan net.Conn) bool
- func (se *SignerListenerEndpoint) IsConnected() bool
- func (sl *SignerListenerEndpoint) OnStart() error
- func (sl *SignerListenerEndpoint) OnStop()
- func (se *SignerListenerEndpoint) ReadMessage() (msg privvalproto.Message, err error)
- func (sl *SignerListenerEndpoint) SendRequest(request privvalproto.Message) (*privvalproto.Message, error)
- func (se *SignerListenerEndpoint) SetConnection(newConnection net.Conn)
- func (se *SignerListenerEndpoint) WaitConnection(connectionAvailableCh chan net.Conn, maxWait time.Duration) error
- func (sl *SignerListenerEndpoint) WaitForConnection(maxWait time.Duration) error
- func (se *SignerListenerEndpoint) WriteMessage(msg privvalproto.Message) (err error)
- type SignerListenerEndpointOption
- type TCPListener
- type TCPListenerOption
- type UnixListener
- type UnixListenerOption
Constants ¶
This section is empty.
Variables ¶
var ( ErrConnectionTimeout = EndpointTimeoutError{} ErrNoConnection = errors.New("endpoint is not connected") ErrReadTimeout = errors.New("endpoint read timed out") ErrUnexpectedResponse = errors.New("empty response") ErrWriteTimeout = errors.New("endpoint write timed out") )
Socket errors.
Functions ¶
This section is empty.
Types ¶
type EndpointTimeoutError ¶
type EndpointTimeoutError struct{}
EndpointTimeoutError occurs when endpoint times out.
func (EndpointTimeoutError) Error ¶
func (e EndpointTimeoutError) Error() string
Implement the net.Error interface.
func (EndpointTimeoutError) Temporary ¶
func (e EndpointTimeoutError) Temporary() bool
func (EndpointTimeoutError) Timeout ¶
func (e EndpointTimeoutError) Timeout() bool
type RemoteSignerError ¶
type RemoteSignerError struct { // TODO(ismail): create an enum of known errors Code int Description string }
RemoteSignerError allows (remote) validators to include meaningful error descriptions in their reply.
func (*RemoteSignerError) Error ¶
func (e *RemoteSignerError) Error() string
type RemoteSignerLoadBalancer ¶ added in v0.0.3
type RemoteSignerLoadBalancer struct {
// contains filtered or unexported fields
}
RemoteSignerLoadBalancer load balances incoming requests across multiple listeners.
func NewRemoteSignerLoadBalancer ¶ added in v0.0.3
func NewRemoteSignerLoadBalancer(logger cometlog.Logger, listeners []SignerListener) *RemoteSignerLoadBalancer
func (*RemoteSignerLoadBalancer) SendRequest ¶ added in v0.0.3
func (lb *RemoteSignerLoadBalancer) SendRequest(request privvalproto.Message) (*privvalproto.Message, error)
SendRequest sends a request to the first available listener.
func (*RemoteSignerLoadBalancer) Start ¶ added in v0.0.3
func (lb *RemoteSignerLoadBalancer) Start() error
func (*RemoteSignerLoadBalancer) Stop ¶ added in v0.0.3
func (lb *RemoteSignerLoadBalancer) Stop() error
type SignerListener ¶ added in v0.0.3
type SignerListener struct { *SignerListenerEndpoint // contains filtered or unexported fields }
func NewSignerListener ¶ added in v0.0.3
func NewSignerListener(logger cometlog.Logger, address string) SignerListener
func (SignerListener) Close ¶ added in v0.0.3
func (se SignerListener) Close() error
Close closes the underlying net.Conn.
func (SignerListener) DropConnection ¶ added in v0.0.3
func (se SignerListener) DropConnection()
IsConnected indicates if there is an active connection
func (SignerListener) GetAvailableConnection ¶ added in v0.0.3
TryGetConnection retrieves a connection if it is already available
func (SignerListener) IsConnected ¶ added in v0.0.3
func (se SignerListener) IsConnected() bool
IsConnected indicates if there is an active connection
func (SignerListener) ReadMessage ¶ added in v0.0.3
func (se SignerListener) ReadMessage() (msg privvalproto.Message, err error)
ReadMessage reads a message from the endpoint
func (SignerListener) SetConnection ¶ added in v0.0.3
SetConnection replaces the current connection object
func (SignerListener) WaitConnection ¶ added in v0.0.3
func (se SignerListener) WaitConnection(connectionAvailableCh chan net.Conn, maxWait time.Duration) error
TryGetConnection retrieves a connection if it is already available
func (SignerListener) WriteMessage ¶ added in v0.0.3
func (se SignerListener) WriteMessage(msg privvalproto.Message) (err error)
WriteMessage writes a message from the endpoint
type SignerListenerEndpoint ¶
type SignerListenerEndpoint struct {
// contains filtered or unexported fields
}
SignerListenerEndpoint listens for an external process to dial in and keeps the connection alive by dropping and reconnecting.
The process will send pings every ~3s (read/write timeout * 2/3) to keep the connection alive.
func NewSignerListenerEndpoint ¶
func NewSignerListenerEndpoint( logger log.Logger, listener net.Listener, options ...SignerListenerEndpointOption, ) *SignerListenerEndpoint
NewSignerListenerEndpoint returns an instance of SignerListenerEndpoint.
func (*SignerListenerEndpoint) Close ¶
func (se *SignerListenerEndpoint) Close() error
Close closes the underlying net.Conn.
func (*SignerListenerEndpoint) DropConnection ¶
func (se *SignerListenerEndpoint) DropConnection()
IsConnected indicates if there is an active connection
func (*SignerListenerEndpoint) GetAvailableConnection ¶
TryGetConnection retrieves a connection if it is already available
func (*SignerListenerEndpoint) IsConnected ¶
func (se *SignerListenerEndpoint) IsConnected() bool
IsConnected indicates if there is an active connection
func (*SignerListenerEndpoint) OnStart ¶
func (sl *SignerListenerEndpoint) OnStart() error
OnStart implements service.Service.
func (*SignerListenerEndpoint) OnStop ¶
func (sl *SignerListenerEndpoint) OnStop()
OnStop implements service.Service
func (*SignerListenerEndpoint) ReadMessage ¶
func (se *SignerListenerEndpoint) ReadMessage() (msg privvalproto.Message, err error)
ReadMessage reads a message from the endpoint
func (*SignerListenerEndpoint) SendRequest ¶
func (sl *SignerListenerEndpoint) SendRequest(request privvalproto.Message) (*privvalproto.Message, error)
SendRequest ensures there is a connection, sends a request and waits for a response
func (*SignerListenerEndpoint) SetConnection ¶
SetConnection replaces the current connection object
func (*SignerListenerEndpoint) WaitConnection ¶
func (se *SignerListenerEndpoint) WaitConnection(connectionAvailableCh chan net.Conn, maxWait time.Duration) error
TryGetConnection retrieves a connection if it is already available
func (*SignerListenerEndpoint) WaitForConnection ¶
func (sl *SignerListenerEndpoint) WaitForConnection(maxWait time.Duration) error
WaitForConnection waits maxWait for a connection or returns a timeout error
func (*SignerListenerEndpoint) WriteMessage ¶
func (se *SignerListenerEndpoint) WriteMessage(msg privvalproto.Message) (err error)
WriteMessage writes a message from the endpoint
type SignerListenerEndpointOption ¶
type SignerListenerEndpointOption func(*SignerListenerEndpoint)
SignerListenerEndpointOption sets an optional parameter on the SignerListenerEndpoint.
func SignerListenerEndpointTimeoutReadWrite ¶
func SignerListenerEndpointTimeoutReadWrite(timeout time.Duration) SignerListenerEndpointOption
SignerListenerEndpointTimeoutReadWrite sets the read and write timeout for connections from external signing processes.
Default: 5s
type TCPListener ¶
type TCPListener struct { *net.TCPListener // contains filtered or unexported fields }
TCPListener wraps a *net.TCPListener to standardize protocol timeouts and potentially other tuning parameters. It also returns encrypted connections.
func NewTCPListener ¶
func NewTCPListener(ln net.Listener, secretConnKey ed25519.PrivKey) *TCPListener
NewTCPListener returns a listener that accepts authenticated encrypted connections using the given secretConnKey and the default timeout values.
type TCPListenerOption ¶
type TCPListenerOption func(*TCPListener)
TCPListenerOption sets an optional parameter on the tcpListener.
func TCPListenerTimeoutAccept ¶
func TCPListenerTimeoutAccept(timeout time.Duration) TCPListenerOption
TCPListenerTimeoutAccept sets the timeout for the listener. A zero time value disables the timeout.
func TCPListenerTimeoutReadWrite ¶
func TCPListenerTimeoutReadWrite(timeout time.Duration) TCPListenerOption
TCPListenerTimeoutReadWrite sets the read and write timeout for connections from external signing processes.
type UnixListener ¶
type UnixListener struct { *net.UnixListener // contains filtered or unexported fields }
UnixListener wraps a *net.UnixListener to standardize protocol timeouts and potentially other tuning parameters. It returns unencrypted connections.
func NewUnixListener ¶
func NewUnixListener(ln net.Listener) *UnixListener
NewUnixListener returns a listener that accepts unencrypted connections using the default timeout values.
type UnixListenerOption ¶
type UnixListenerOption func(*UnixListener)
func UnixListenerTimeoutAccept ¶
func UnixListenerTimeoutAccept(timeout time.Duration) UnixListenerOption
UnixListenerTimeoutAccept sets the timeout for the listener. A zero time value disables the timeout.
func UnixListenerTimeoutReadWrite ¶
func UnixListenerTimeoutReadWrite(timeout time.Duration) UnixListenerOption
UnixListenerTimeoutReadWrite sets the read and write timeout for connections from external signing processes.