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 ¶
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 }
Click to show internal directories.
Click to hide internal directories.