server

package
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2025 License: Apache-2.0, UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultKeepAlivePeriod = 2 * time.Second
	DefaultResponseTimeout = 3 * time.Second
)

Default connection config.

Variables

View Source
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

func WithKeepAlivePeriod(period time.Duration) Option

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

func WithResponseTimeout(timeout time.Duration) Option

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL