list

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package list implements container with pre-defined list of torrent hashes from config file

Index

Constants

View Source
const DUMMY = "_"

DUMMY used as value placeholder if storage needs some value with

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// HashList static list of HEX-encoded InfoHashes.
	HashList []string `cfg:"hash_list"`
	// If Invert set to true, all InfoHashes stored in HashList should be blacklisted.
	Invert bool
	// StorageCtx is the name of storage context where to store hash list.
	// It might be table name, REDIS record key or something else, depending on storage.
	StorageCtx string `cfg:"storage_ctx"`
}

Config - implementation of list container configuration.

type List

type List struct {
	// Invert see Config.Invert description.
	Invert bool
	// Storage implementation where hashes are stored for approval checks.
	Storage storage.DataStorage
	// StorageCtx see Config.StorageCtx description.
	StorageCtx string
}

List work structure of hash list. Might be reused in another containers.

func (*List) Approved

func (l *List) Approved(ctx context.Context, hash bittorrent.InfoHash) (contains bool)

Approved checks if specified hash is approved or not. If List.Invert set to true and hash found in storage, function will return false, that means that hash is blacklisted.

Jump to

Keyboard shortcuts

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