sniffer

package
v0.0.0-...-ada256f Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package sniffer contains sniffer components which can be wired into a libp2p dht node by proxying the datastore.

The canonical implementation thereof can be found in: https://github.com/ipfs-search/ipfs-sniffer

If all you want is to sniff CID's, you probably want to use a `factory` to facilitate the setup of the sniffer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	LastSeenExpiration time.Duration // Expiration time for the last-seen resources
	LastSeenPruneLen   int           // Cleanup expired resources from the last-seen
	LoggerTimeout      time.Duration // Throw timeout error when no log messages arrive
	BufferSize         uint          // Size of the channels buffering between yielder, filter and adder
}

Config holds configuration for a Sniffer.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration for a Sniffer.

type Sniffer

type Sniffer struct {
	*instr.Instrumentation
	// contains filtered or unexported fields
}

Sniffer allows sniffing Batching datastore's events, effectively allowing sniffing of the IPFS DHT. To effectively use the Sniffer, the proxied datastore needs to be acquired by calling `Batching()` on the Sniffer.

func New

func New(cfg *Config, ds datastore.Batching, pub queue.PublisherFactory, i *instr.Instrumentation) (*Sniffer, error)

New creates a new Sniffer based on a datastore, or returns an error.

func (*Sniffer) Batching

func (s *Sniffer) Batching() datastore.Batching

Batching returns the datastore wrapped with sniffing hooks.

func (*Sniffer) Sniff

func (s *Sniffer) Sniff(ctx context.Context) error

Sniff starts sniffing until the context is closed - it restarts itself on intermittant errors.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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