ping

package
v0.0.0-...-9721c62 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: GPL-3.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DefaultTimeout = time.Second * 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Ping

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

func New

func New(publicKey *dht.PublicKey) (*Ping, error)

func (*Ping) Expired

func (p *Ping) Expired(timeout time.Duration) bool

func (*Ping) ID

func (p *Ping) ID() uint64

type Set

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

func NewSet

func NewSet(timeout time.Duration) *Set

func (*Set) Add

func (s *Set) Add(publicKey *dht.PublicKey) (*Ping, error)

func (*Set) Pop

func (s *Set) Pop(publicKey *dht.PublicKey, id uint64) (*Ping, error)

Pop tries to find the given ping ID and public key in the set of pings. If it is found, it is removed from the set and returned. If it is not found, an error is returned. Expiry can also be the reason that the given ping ID is not found, but this will not be reported as a separate error.

func (*Set) Size

func (s *Set) Size() int

Jump to

Keyboard shortcuts

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