Documentation ¶
Index ¶
- Constants
- Variables
- func CheckTimebank(params *TimebankParams, prevUpdateTime time.Time, prevTimebank int, ...) int
- func FetchListFile(url string) ([]string, error)
- func IngestBanLists(db *leveldb.DB, bs blob.Store, lists []string) error
- func ParseBanListVersion(line string) (int, error)
- func ParseDDRPKeyRecord(record string) (*btcec.PublicKey, error)
- func PingPeer(ctx context.Context, cfg *PingConfig) error
- func ReadBanList(r io.Reader) ([]string, error)
- func SyncSectors(opts *SyncSectorsOpts) error
- func SyncTreeBases(opts *SyncTreeBasesOpts) (blob.MerkleBase, error)
- func UpdateBlob(cfg *UpdateConfig) error
- type DDRPKeyRecord
- type HNSName
- type Heartbeat
- type Heartbeater
- type NameImporter
- type NameSyncer
- func (ns *NameSyncer) OnJobComplete(cb func(count int)) util.Unsubscriber
- func (ns *NameSyncer) OnNameComplete(cb func(name string, receiptCount int)) util.Unsubscriber
- func (ns *NameSyncer) OnSyncError(cb func(name string, err error)) util.Unsubscriber
- func (ns *NameSyncer) Start() error
- func (ns *NameSyncer) Stop() error
- type PeerExchanger
- type PeerSet
- type PingConfig
- type Pinger
- type SectorServer
- type SyncSectorsOpts
- type SyncTreeBasesOpts
- type TimebankParams
- type UpdateConfig
- type UpdateQueue
- type UpdateQueueItem
- type UpdateServer
- type Updater
Constants ¶
View Source
const ( DefaultInterval = 30 * time.Second DefaultTimeout = 10 * time.Second )
View Source
const ( DefaultPingerCheckInterval = time.Second DefaultPingerPingInterval = 5 * time.Second DefaultPingerTimeout = 30 * time.Second )
View Source
const ( DefaultSyncerTreeBaseResTimeout = 10 * time.Second DefaultSyncerSectorResTimeout = 15 * time.Second )
View Source
const (
BanListUpdateInterval = 7 * 24 * time.Hour
)
View Source
const (
CurrentBanListVersion = 1
)
View Source
const (
MaxSentPeerCount = math.MaxUint8
)
Variables ¶
View Source
var ( ErrPingTimeout = errors.New("ping timeout") ErrPingPeerClosed = errors.New("peer closed") )
View Source
var ( ErrNoTreeBaseCandidates = errors.New("no tree base candidates") ErrSyncerNoProgress = errors.New("sync not progressing") ErrSyncerMaxAttempts = errors.New("reached max sync attempts") )
View Source
var ( ErrUpdateQueueMaxLen = errors.New("update queue is at max length") ErrUpdateQueueIdenticalTimestamp = errors.New("timestamp is identical to stored") ErrUpdateQueueThrottled = errors.New("update is throttled") ErrUpdateQueueStaleTimestamp = errors.New("update is stale") ErrUpdateQueueSpltBrain = errors.New("split brain") ErrInitialImportIncomplete = errors.New("initial import incomplete") )
View Source
var ( ErrUpdaterAlreadySynchronized = errors.New("updater already synchronized") ErrUpdaterMerkleRootMismatch = errors.New("updater merkle root mismatch") ErrNameLocked = errors.New("name is locked") ErrInsufficientTimebank = errors.New("insufficient timebank") )
View Source
var (
ErrNameSyncerSyncResponseTimeout = errors.New("sync timed out")
)
Functions ¶
func CheckTimebank ¶
func FetchListFile ¶
func ParseBanListVersion ¶
func SyncSectors ¶
func SyncSectors(opts *SyncSectorsOpts) error
func SyncTreeBases ¶
func SyncTreeBases(opts *SyncTreeBasesOpts) (blob.MerkleBase, error)
func UpdateBlob ¶
func UpdateBlob(cfg *UpdateConfig) error
Types ¶
type DDRPKeyRecord ¶
func ExtractTXTRecordsBlock ¶
func ExtractTXTRecordsBlock(block *primitives.Block) []*DDRPKeyRecord
func ExtractTXTRecordsTx ¶
func ExtractTXTRecordsTx(tx *primitives.Transaction) []*DDRPKeyRecord
type Heartbeater ¶
type Heartbeater struct { Interval time.Duration Timeout time.Duration // contains filtered or unexported fields }
func NewHeartbeater ¶
func NewHeartbeater(url string, moniker string, peerID crypto.Hash) *Heartbeater
func (*Heartbeater) Start ¶
func (s *Heartbeater) Start() error
func (*Heartbeater) Stop ¶
func (s *Heartbeater) Stop() error
type NameImporter ¶
type NameImporter struct { ConfirmationDepth int CheckInterval time.Duration Workers int VerificationThreshold float64 // contains filtered or unexported fields }
func NewNameImporter ¶
func NewNameImporter(client *client.Client, db *leveldb.DB) *NameImporter
func (*NameImporter) Start ¶
func (n *NameImporter) Start() error
func (*NameImporter) Stop ¶
func (n *NameImporter) Stop() error
type NameSyncer ¶
type NameSyncer struct { Workers int SampleSize int UpdateResponseTimeout time.Duration Interval time.Duration SyncResponseTimeout time.Duration // contains filtered or unexported fields }
func NewNameSyncer ¶
func NewNameSyncer(mux *p2p.PeerMuxer, db *leveldb.DB, nameLocker util.MultiLocker, updater *Updater) *NameSyncer
func (*NameSyncer) OnJobComplete ¶
func (ns *NameSyncer) OnJobComplete(cb func(count int)) util.Unsubscriber
func (*NameSyncer) OnNameComplete ¶
func (ns *NameSyncer) OnNameComplete(cb func(name string, receiptCount int)) util.Unsubscriber
func (*NameSyncer) OnSyncError ¶
func (ns *NameSyncer) OnSyncError(cb func(name string, err error)) util.Unsubscriber
func (*NameSyncer) Start ¶
func (ns *NameSyncer) Start() error
func (*NameSyncer) Stop ¶
func (ns *NameSyncer) Stop() error
type PeerExchanger ¶
type PeerExchanger struct { SampleSize int ResponseTimeout time.Duration RequestInterval time.Duration // contains filtered or unexported fields }
func NewPeerExchanger ¶
func NewPeerExchanger(dialer p2p.PeerDialer, mux *p2p.PeerMuxer, db *leveldb.DB) *PeerExchanger
func (*PeerExchanger) Start ¶
func (pe *PeerExchanger) Start() error
func (*PeerExchanger) Stop ¶
func (pe *PeerExchanger) Stop() error
type PingConfig ¶
type Pinger ¶
type SectorServer ¶
func NewSectorServer ¶
func NewSectorServer(mux *p2p.PeerMuxer, db *leveldb.DB, bs blob.Store, nameLocker util.MultiLocker) *SectorServer
func (*SectorServer) Start ¶
func (s *SectorServer) Start() error
func (*SectorServer) Stop ¶
func (s *SectorServer) Stop() error
type SyncSectorsOpts ¶
type SyncTreeBasesOpts ¶
type TimebankParams ¶
type UpdateConfig ¶
type UpdateConfig struct { Mux *p2p.PeerMuxer DB *leveldb.DB NameLocker util.MultiLocker BlobStore blob.Store Item *UpdateQueueItem }
type UpdateQueue ¶
type UpdateQueue struct { MaxLen int32 MinUpdateInterval time.Duration // contains filtered or unexported fields }
func NewUpdateQueue ¶
func NewUpdateQueue(mux *p2p.PeerMuxer, db *leveldb.DB) *UpdateQueue
func (*UpdateQueue) Dequeue ¶
func (u *UpdateQueue) Dequeue() *UpdateQueueItem
func (*UpdateQueue) Start ¶
func (u *UpdateQueue) Start() error
func (*UpdateQueue) Stop ¶
func (u *UpdateQueue) Stop() error
type UpdateQueueItem ¶
type UpdateQueueItem struct { PeerIDs *PeerSet Name string Timestamp time.Time MerkleRoot crypto.Hash ReservedRoot crypto.Hash Signature crypto.Signature Pub *btcec.PublicKey Height int Disposed int32 }
func (*UpdateQueueItem) Dispose ¶
func (u *UpdateQueueItem) Dispose()
type UpdateServer ¶
type UpdateServer struct {
// contains filtered or unexported fields
}
func NewUpdateServer ¶
func NewUpdateServer(mux *p2p.PeerMuxer, db *leveldb.DB, nameLocker util.MultiLocker) *UpdateServer
func (*UpdateServer) Start ¶
func (u *UpdateServer) Start() error
func (*UpdateServer) Stop ¶
func (u *UpdateServer) Stop() error
func (*UpdateServer) UpdateReqHandler ¶
func (u *UpdateServer) UpdateReqHandler(peerID crypto.Hash, envelope *wire.Envelope)
type Updater ¶
type Updater struct { PollInterval time.Duration Workers int // contains filtered or unexported fields }
func NewUpdater ¶
func NewUpdater(mux *p2p.PeerMuxer, db *leveldb.DB, queue *UpdateQueue, nameLocker util.MultiLocker, bs blob.Store) *Updater
func (*Updater) OnUpdateProcessed ¶
func (u *Updater) OnUpdateProcessed(hdlr func(item *UpdateQueueItem, err error)) util.Unsubscriber
Click to show internal directories.
Click to hide internal directories.