syncerutil

package
v1.2.0-hsc Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EphemeralPeerStore

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

EphemeralPeerStore implements PeerStore with an in-memory map.

func NewEphemeralPeerStore

func NewEphemeralPeerStore() *EphemeralPeerStore

NewEphemeralPeerStore initializes an EphemeralPeerStore.

func (*EphemeralPeerStore) AddPeer

func (eps *EphemeralPeerStore) AddPeer(addr string) error

AddPeer implements PeerStore.

func (*EphemeralPeerStore) Ban

func (eps *EphemeralPeerStore) Ban(addr string, duration time.Duration, reason string) error

Ban implements PeerStore.

func (*EphemeralPeerStore) Banned

func (eps *EphemeralPeerStore) Banned(addr string) (bool, error)

Banned implements PeerStore.

func (*EphemeralPeerStore) PeerInfo

func (eps *EphemeralPeerStore) PeerInfo(peer string) (syncer.PeerInfo, bool)

PeerInfo implements PeerStore.

func (*EphemeralPeerStore) Peers

func (eps *EphemeralPeerStore) Peers() ([]syncer.PeerInfo, error)

Peers implements PeerStore.

func (*EphemeralPeerStore) UpdatePeerInfo

func (eps *EphemeralPeerStore) UpdatePeerInfo(addr string, fn func(*syncer.PeerInfo)) error

UpdatePeerInfo implements PeerStore.

type JSONPeerStore

type JSONPeerStore struct {
	*EphemeralPeerStore
	// contains filtered or unexported fields
}

JSONPeerStore implements PeerStore with a JSON file on disk.

func NewJSONPeerStore

func NewJSONPeerStore(path string) (*JSONPeerStore, error)

NewJSONPeerStore returns a JSONPeerStore backed by the specified file.

func (*JSONPeerStore) AddPeer

func (jps *JSONPeerStore) AddPeer(addr string) error

AddPeer implements PeerStore.

func (*JSONPeerStore) Ban

func (jps *JSONPeerStore) Ban(addr string, duration time.Duration, reason string) error

Ban implements PeerStore.

func (*JSONPeerStore) UpdatePeerInfo

func (jps *JSONPeerStore) UpdatePeerInfo(addr string, fn func(*syncer.PeerInfo)) error

UpdatePeerInfo implements PeerStore.

Jump to

Keyboard shortcuts

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