netserv

package
v0.0.0-...-37869b2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTorInvalidAddressResponse indicates an invalid address was
	// returned by the Tor DNS resolver.
	ErrTorInvalidAddressResponse = errors.New("invalid address response")

	// ErrTorInvalidProxyResponse indicates the Tor proxy returned a
	// response in an unexpected format.
	ErrTorInvalidProxyResponse = errors.New("invalid proxy response")

	// ErrTorUnrecognizedAuthMethod indicates the authentication method
	// provided is not recognized.
	ErrTorUnrecognizedAuthMethod = errors.New("invalid proxy authentication method")
)
View Source
var SFNodeBitcoinCash wire.ServiceFlag = 1 << 5

Functions

func TorLookupIP

func TorLookupIP(host string) ([]net.IP, error)

TorLookupIP uses Tor to resolve DNS via the SOCKS extension they provide for resolution over the Tor network. Tor itself doesn't support ipv6 so this doesn't either.

Types

type PeerManager

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

func NewPeerManager

func NewPeerManager(config *PeerManagerConfig) (*PeerManager, error)

func (*PeerManager) ConnectedPeers

func (pm *PeerManager) ConnectedPeers() []*peer.Peer

func (*PeerManager) Start

func (pm *PeerManager) Start()

func (*PeerManager) Stop

func (pm *PeerManager) Stop()

type PeerManagerConfig

type PeerManagerConfig struct {

	// The network parameters to use
	Params *chaincfg.Params

	// The target number of outbound peers. Defaults to 10.
	TargetOutbound uint32

	// Duration of time to retry a connection. Defaults to 5 seconds.
	RetryDuration time.Duration

	// UserAgentName specifies the user agent name to advertise.  It is
	// highly recommended to specify this value.
	UserAgentName string

	// UserAgentVersion specifies the user agent version to advertise.  It
	// is highly recommended to specify this value and that it follows the
	// form "major.minor.revision" e.g. "2.6.41".
	UserAgentVersion string

	// The directory to store cached peers
	AddressCacheDir string

	// If this field is not nil the PeerManager will only connect to this address
	TrustedPeer net.Addr

	// Listeners to handle messages from peers. If nil, no messages will be handled.
	Listeners *peer.MessageListeners

	// An optional proxy dialer. Will use net.Dial if nil.
	Proxy proxy.Dialer

	// Function to return current block hash and height
	GetNewestBlock func() (hash *chainhash.Hash, height int32, err error)

	// The main channel over which to send outgoing events
	MsgChan chan interface{}
}

type WireService

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

func NewWireService

func NewWireService(config *WireServiceConfig) *WireService

func (*WireService) Current

func (ws *WireService) Current() bool

func (*WireService) MsgChan

func (ws *WireService) MsgChan() chan interface{}

func (*WireService) Resync

func (ws *WireService) Resync()

func (*WireService) ResyncWithNil

func (ws *WireService) ResyncWithNil()

func (*WireService) Start

func (ws *WireService) Start()

The start function must be run in its own goroutine. The entire WireService is single threaded which means all messages are processed sequentially removing the need for complex locking.

func (*WireService) Stop

func (ws *WireService) Stop()

type WireServiceConfig

type WireServiceConfig struct {
	Params          *chaincfg.Params
	Chain           *chain.Blockchain
	MinPeersForSync int
}

Jump to

Keyboard shortcuts

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