storage

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 14 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlackListedPeer

type BlackListedPeer = restrictedPeer

func NewBlackListedPeer

func NewBlackListedPeer(ip IP, blackListTimestampMillis int64, blackListDuration time.Duration, reason string) BlackListedPeer

type CBORStorage

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

func NewCBORStorage

func NewCBORStorage(baseDir string, now time.Time) (*CBORStorage, error)

func (*CBORStorage) AddOrUpdateKnown

func (bs *CBORStorage) AddOrUpdateKnown(known []KnownPeer, now time.Time) error

AddOrUpdateKnown adds known peers with now timestamp into peers storage with strong error guarantees.

func (*CBORStorage) AddSuspended

func (bs *CBORStorage) AddSuspended(suspended []SuspendedPeer) error

AddSuspended adds suspended peers into peers storage with strong error guarantees.

func (*CBORStorage) AddToBlackList

func (bs *CBORStorage) AddToBlackList(blackListed []BlackListedPeer) error

AddToBlackList adds suspended peers into peers storage with strong error guarantees.

func (*CBORStorage) BlackList

func (bs *CBORStorage) BlackList(now time.Time) []BlackListedPeer

func (*CBORStorage) DeleteBlackListedByIP

func (bs *CBORStorage) DeleteBlackListedByIP(restricted []BlackListedPeer) error

func (*CBORStorage) DeleteKnown

func (bs *CBORStorage) DeleteKnown(known []KnownPeer) error

DeleteKnown removes known peers from peers storage with strong error guarantees.

func (*CBORStorage) DeleteSuspendedByIP

func (bs *CBORStorage) DeleteSuspendedByIP(suspended []SuspendedPeer) error

DeleteSuspendedByIP removes suspended peers from peers storage with strong error guarantees. Note, that only IP field in input parameter will be used.

func (*CBORStorage) DropBlackList

func (bs *CBORStorage) DropBlackList() error

func (*CBORStorage) DropKnown

func (bs *CBORStorage) DropKnown() error

DropKnown clear known in memory cache and truncates known peers storage file with strong error guarantee.

func (*CBORStorage) DropStorage

func (bs *CBORStorage) DropStorage() error

DropStorage clear storage memory cache and truncates storage files. In case of error we can lose suspended peers storage file, but honestly it's almost impossible case.

func (*CBORStorage) DropSuspended

func (bs *CBORStorage) DropSuspended() error

DropSuspended clear suspended in memory cache and truncates suspended peers storage file with strong error guarantee.

func (*CBORStorage) IsBlackListedIP

func (bs *CBORStorage) IsBlackListedIP(ip IP, now time.Time) bool

func (*CBORStorage) IsBlackListedIPs

func (bs *CBORStorage) IsBlackListedIPs(ips []IP, now time.Time) []bool

func (*CBORStorage) IsSuspendedIP

func (bs *CBORStorage) IsSuspendedIP(ip IP, now time.Time) bool

func (*CBORStorage) IsSuspendedIPs

func (bs *CBORStorage) IsSuspendedIPs(ips []IP, now time.Time) []bool

func (*CBORStorage) Known

func (bs *CBORStorage) Known(limit int) []KnownPeer

func (*CBORStorage) RefreshBlackList

func (bs *CBORStorage) RefreshBlackList(now time.Time) error

func (*CBORStorage) RefreshSuspended

func (bs *CBORStorage) RefreshSuspended(now time.Time) error

RefreshSuspended removes expired peers from suspended peers storage with strong error guarantee.

func (*CBORStorage) Suspended

func (bs *CBORStorage) Suspended(now time.Time) []SuspendedPeer

type IP

type IP [net.IPv6len]byte

func IPFromString

func IPFromString(s string) IP

func IpFromIpPort

func IpFromIpPort(ipPort proto.IpPort) IP

func (*IP) String

func (i *IP) String() string

type KnownPeer

type KnownPeer proto.IpPort

func (*KnownPeer) IP

func (kp *KnownPeer) IP() IP

func (*KnownPeer) IpPort

func (kp *KnownPeer) IpPort() proto.IpPort

func (*KnownPeer) String

func (kp *KnownPeer) String() string

type SuspendedPeer

type SuspendedPeer = restrictedPeer

func NewSuspendedPeer

func NewSuspendedPeer(ip IP, suspendTimestampMillis int64, suspendDuration time.Duration, reason string) SuspendedPeer

Jump to

Keyboard shortcuts

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