Documentation
¶
Index ¶
Constants ¶
const ( DefaultKeepAlivePeriod = 2 * time.Second DefaultResponseTimeout = 3 * time.Second )
Default connection config.
Variables ¶
var ( // Init. ErrNilSigner = errors.New("nil signer") ErrInvalidAddressProtocol = errors.New("invalid server address protocol") ErrNilLogger = errors.New("nil logger") // Connection. ErrListenFailed = errors.New("failed to listen") // State. ErrServerAlreadyStarted = errors.New("server already started") ErrServerAlreadyStopped = errors.New("server already stopped") )
Errors returned by the remote signer server.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*RemoteSignerServer)
Option is a functional option type used for optional configuration.
func WithAuthorizedKeys ¶
func WithAuthorizedKeys(keys []ed25519.PubKeyEd25519) Option
WithAuthorizedKeys sets the list of authorized public keys that the server will accept. If empty (default), all keys are authorized.
func WithKeepAlivePeriod ¶
WithKeepAlivePeriod sets the keep alive period for the TCP connection to the client. If set to 0, keep alive is disabled. The default is 2 seconds.
func WithResponseTimeout ¶
WithResponseTimeout sets the timeout for sending response to the client. If set to 0, no timeout is set. The default is 3 seconds.
func WithServerPrivKey ¶
func WithServerPrivKey(privKey ed25519.PrivKeyEd25519) Option
WithServerPrivKey sets the private key used by the server to authenticate with the client. The default is a random key.
type RemoteSignerServer ¶
type RemoteSignerServer struct {
// contains filtered or unexported fields
}
RemoteSignerServer provides a service that forwards requests to a types.Signer.
func NewRemoteSignerServer ¶
func NewRemoteSignerServer( signer types.Signer, listenAddress string, logger *slog.Logger, options ...Option, ) (*RemoteSignerServer, error)
NewRemoteSignerServer creates a new RemoteSignerServer with the required server address and logger. The server can be further configured using functional options.
func (*RemoteSignerServer) IsRunning ¶
func (rss *RemoteSignerServer) IsRunning() bool
IsRunning returns true if the server is running.
func (*RemoteSignerServer) ListenAddress ¶
func (rss *RemoteSignerServer) ListenAddress(t *testing.T) net.Addr
ListenAddress returns the listen address of the server. NOTE: This method is only used for testing purposes.
func (*RemoteSignerServer) Start ¶
func (rss *RemoteSignerServer) Start() error
Start starts the remote signer server.
func (*RemoteSignerServer) Stop ¶
func (rss *RemoteSignerServer) Stop() error
Stop stops the remote signer server.