* remove cobra dependency and split execs to mochi and e2e * add log init synchronization
2.2 KiB
Approved torrents list
Package torrentapproval can be used for only allow or block
specified hashes or block specified hashes.
Functionality
As said above, there are two modes of approval: white list and black list.
If mode is white list (invert set to false), tracker works in
semi-private mode, which means, than peers can could share and receive info
about only specified list of torrents' hashes.
I.e.: if configuration contains hash AAAA, but peer announces hash BBBB
tracker will return unapproved torrent message back to peer.
If mode is black list (invert set to true), tracker will allow all hashes
except specified.
Hash sources
There are two sources of hashes: list and directory.
-
listis the static set of hashes, specified in configuration file. -
directorywill watch for*.torrentfiles in specified path and append/delete records from storage. This source will parse all existing files at start and then watch for new files to add, or for delete events to remove hash from storage.
Note: if storage is not memory, and preserve option set to true, records
will be persisted in storage until somebody or something (different tool with access
to storage) won't delete it.
Configuration
This middleware provides the following parameters for configuration:
initial_source- source type:listordirectorypreserve: - save source provided data into storageconfiguration- options for specified sourcelist:hash_list- list of HEX encoded hashesinvert- working mode:true- black list,false- white liststorage_ctx- name of storage context where to store data. It may be redis hash key, DB table name etc.
directory:path- directory to watchinvertandstorage_ctxhas the same meanins aslist's options
Configuration example:
An example config might look like this:
mochi:
prehooks:
- name: torrent approval
options:
initial_source: list
preserve: true
configuration:
hash_list: [ "AAA", "BBB" ]
invert: false
storage_ctx: APPROVED_HASH