Documentation ¶
Overview ¶
Package server provides a server that can wrap a node and serve an http api for interacting with the node.
Index ¶
- type Server
- func (srv *Server) APIAddress() string
- func (srv *Server) Close() error
- func (srv *Server) GatewayAddress() modules.NetAddress
- func (srv *Server) HostPublicKey() (types.I3vPublicKey, error)
- func (srv *Server) RenterCurrentPeriod() (types.BlockHeight, error)
- func (srv *Server) RenterSettings() (modules.RenterSettings, error)
- func (srv *Server) ServeErr() <-chan error
- func (srv *Server) Unlock(password string) error
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 i3vd 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 ¶
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 ¶
APIAddress returns the underlying node's api address
func (*Server) GatewayAddress ¶
func (srv *Server) GatewayAddress() modules.NetAddress
GatewayAddress returns the underlying node's gateway address
func (*Server) HostPublicKey ¶
func (srv *Server) HostPublicKey() (types.I3vPublicKey, error)
HostPublicKey returns the host's public key or an error if the node has no host.
func (*Server) RenterCurrentPeriod ¶
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 ¶
func (srv *Server) RenterSettings() (modules.RenterSettings, error)
RenterSettings returns the renter's settings or an error if the node has no renter