server

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package server provides a server that can wrap a node and serve an http api for interacting with the node.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	Dir string
	// contains filtered or unexported fields
}

A Server is a collection of ScPrime modules that can be communicated with over an http api.

func New

func New(APIaddr string, requiredUserAgent string, requiredPassword string, nodeParams node.NodeParams, loadStartTime time.Time) (*Server, error)

New creates a new API server from the provided modules. The API will require authentication using HTTP basic auth if the supplied password is not the empty string. Usernames are ignored for authentication. This type of authentication sends passwords in plaintext and should therefore only be used if the APIaddr is localhost.

func NewAsync added in v1.5.0

func NewAsync(APIaddr string, requiredUserAgent string, requiredPassword string, nodeParams node.NodeParams, loadStartTime time.Time) (*Server, <-chan error)

NewAsync creates a new API server from the provided modules. The API will require authentication using HTTP basic auth if the supplied password is not the empty string. Usernames are ignored for authentication. This type of authentication sends passwords in plaintext and should therefore only be used if the APIaddr is localhost.

func (*Server) APIAddress

func (srv *Server) APIAddress() string

APIAddress returns the underlying node's api address

func (*Server) Close

func (srv *Server) Close() error

Close closes the Server's listener, causing the HTTP server to shut down.

func (*Server) GatewayAddress

func (srv *Server) GatewayAddress() modules.NetAddress

GatewayAddress returns the underlying node's gateway address

func (*Server) HostPublicKey added in v1.3.3

func (srv *Server) HostPublicKey() (types.SiaPublicKey, error)

HostPublicKey returns the host's public key or an error if the node has no host.

func (*Server) RenterCurrentPeriod added in v1.5.0

func (srv *Server) RenterCurrentPeriod() (types.BlockHeight, error)

RenterCurrentPeriod returns the renter's current period or an error if the node has no renter

func (*Server) RenterSettings added in v1.5.0

func (srv *Server) RenterSettings() (modules.RenterSettings, error)

RenterSettings returns the renter's settings or an error if the node has no renter

func (*Server) ServeErr added in v1.5.0

func (srv *Server) ServeErr() <-chan error

ServeErr is a blocking call that will return the result of srv.serve after the server stopped.

func (*Server) Unlock added in v1.5.0

func (srv *Server) Unlock(password string) error

Unlock unlocks the server's wallet using the provided password.

func (*Server) WaitClose added in v1.5.0

func (srv *Server) WaitClose()

WaitClose blocks until the server is done shutting down.

Jump to

Keyboard shortcuts

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