server

package
v0.0.0-...-4f0ab6e Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server provides a bitcoin server for handling communications to and from bitcoin peers.

func NewServer

func NewServer(listenAddrs []string, chainParams *chaincfg.Params, monitorListenAddrs []string) (*Server, error)

NewServer returns a new btcd Server configured to listen on addr for the bitcoin network type specified by chainParams. Use start to begin accepting connections from peers. monitorListenAddrs is added for temporary hardcoded metrics exporting. TODO: remove monitorListenAddrs when we use metric exporter instead.

func (*Server) NetTotals

func (s *Server) NetTotals() (uint64, uint64)

NetTotals returns the sum of all bytes received and sent across the network for all peers. It is safe for concurrent access.

func (*Server) OutboundGroupCount

func (s *Server) OutboundGroupCount(key string) int

OutboundGroupCount returns the number of peers connected to the given outbound group key.

func (*Server) ScheduleShutdown

func (s *Server) ScheduleShutdown(duration time.Duration)

ScheduleShutdown schedules a Server shutdown after the specified duration. It also dynamically adjusts how often to warn the Server is going down based on remaining duration.

func (*Server) Start

func (s *Server) Start()

Start begins accepting connections from peers.

func (*Server) Stop

func (s *Server) Stop() error

Stop gracefully shuts down the Server by stopping and disconnecting all peers and the main listener.

func (*Server) WaitForShutdown

func (s *Server) WaitForShutdown()

WaitForShutdown blocks until the main listener and peer handlers are stopped.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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