settings

package
v0.0.0-...-78dab50 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Path     string
	Port     string
	Ssl      bool
	SslPort  string
	ReadOnly bool
	HttpAuth bool
	SearchWA bool
	PubIPv4  string
	PubIPv6  string
	TorAddr  string
	MaxSize  int64
)

Functions

func AddTorrent

func AddTorrent(torr *TorrentDB)

func CloseDB

func CloseDB()

func InitSets

func InitSets(readOnly, searchWA bool)

func Migrate1

func Migrate1()

Migrate from torrserver.db to config.db

func Migrate2

func Migrate2(bboltDB, jsonDB TorrServerDB) error
=== Migrate 2 ===

Migrate 'Settings' and 'Viewed' buckets from BBolt ('config.db') to separate JSON files ('settings.json' and 'viewed.json')

'Torrents' data continues to remain in the BBolt database ('config.db') due to the fact that BLOBs are stored there

To make user be able to roll settings back, no data is deleted from 'config.db' file.

func RemTorrent

func RemTorrent(hash metainfo.Hash)

func RemViewed

func RemViewed(vv *Viewed)

func SetBTSets

func SetBTSets(sets *BTSets)

func SetDefaultConfig

func SetDefaultConfig()

func SetViewed

func SetViewed(vv *Viewed)

Types

type BTSets

type BTSets struct {
	// Cache
	CacheSize       int64 // in byte, def 64 MB
	ReaderReadAHead int   // in percent, 5%-100%, [...S__X__E...] [S-E] not clean
	PreloadCache    int   // in percent

	// Disk
	UseDisk           bool
	TorrentsSavePath  string
	RemoveCacheOnDrop bool

	// Torrent
	ForceEncrypt             bool
	RetrackersMode           int  // 0 - don`t add, 1 - add retrackers (def), 2 - remove retrackers 3 - replace retrackers
	TorrentDisconnectTimeout int  // in seconds
	EnableDebug              bool // debug logs

	// DLNA
	EnableDLNA   bool
	FriendlyName string

	// Rutor
	EnableRutorSearch bool

	// BT Config
	EnableIPv6        bool
	DisableTCP        bool
	DisableUTP        bool
	DisableUPNP       bool
	DisableDHT        bool
	DisablePEX        bool
	DisableUpload     bool
	DownloadRateLimit int // in kb, 0 - inf
	UploadRateLimit   int // in kb, 0 - inf
	ConnectionsLimit  int
	PeersListenPort   int

	// HTTPS
	SslPort int
	SslCert string
	SslKey  string
}
var BTsets *BTSets

func (*BTSets) String

func (v *BTSets) String() string

type DBReadCache

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

func (*DBReadCache) CloseDB

func (v *DBReadCache) CloseDB()

func (*DBReadCache) Get

func (v *DBReadCache) Get(xPath, name string) []byte

func (*DBReadCache) List

func (v *DBReadCache) List(xPath string) []string

func (*DBReadCache) Rem

func (v *DBReadCache) Rem(xPath, name string)

func (*DBReadCache) Set

func (v *DBReadCache) Set(xPath, name string, value []byte)

type File

type File struct {
	Name string `json:"name,omitempty"`
	Id   int    `json:"id,omitempty"`
	Size int64  `json:"size,omitempty"`
}

type JsonDB

type JsonDB struct {
	Path string
	// contains filtered or unexported fields
}

func (*JsonDB) CloseDB

func (v *JsonDB) CloseDB()

func (*JsonDB) Get

func (v *JsonDB) Get(xPath, name string) []byte

func (*JsonDB) List

func (v *JsonDB) List(xPath string) []string

func (*JsonDB) Rem

func (v *JsonDB) Rem(xPath, name string)

func (*JsonDB) Set

func (v *JsonDB) Set(xPath, name string, value []byte)

type TDB

type TDB struct {
	Path string
	// contains filtered or unexported fields
}

func (*TDB) CloseDB

func (v *TDB) CloseDB()

func (*TDB) Get

func (v *TDB) Get(xpath, name string) []byte

func (*TDB) List

func (v *TDB) List(xpath string) []string

func (*TDB) Rem

func (v *TDB) Rem(xpath, name string)

func (*TDB) Set

func (v *TDB) Set(xpath, name string, value []byte)

type TorrServerDB

type TorrServerDB interface {
	CloseDB()
	Get(xPath, name string) []byte
	Set(xPath, name string, value []byte)
	List(xPath string) []string
	Rem(xPath, name string)
}

func NewDBReadCache

func NewDBReadCache(db TorrServerDB) TorrServerDB

func NewJsonDB

func NewJsonDB() TorrServerDB

func NewTDB

func NewTDB() TorrServerDB

type TorrentDB

type TorrentDB struct {
	*torrent.TorrentSpec

	Title  string `json:"title,omitempty"`
	Poster string `json:"poster,omitempty"`
	Data   string `json:"data,omitempty"`

	Timestamp int64 `json:"timestamp,omitempty"`
	Size      int64 `json:"size,omitempty"`
}

func ListTorrent

func ListTorrent() []*TorrentDB

type Viewed

type Viewed struct {
	Hash      string `json:"hash"`
	FileIndex int    `json:"file_index"`
}

func ListViewed

func ListViewed(hash string) []*Viewed

type XPathDBRouter

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

func NewXPathDBRouter

func NewXPathDBRouter() *XPathDBRouter

func (*XPathDBRouter) CloseDB

func (v *XPathDBRouter) CloseDB()

func (*XPathDBRouter) Get

func (v *XPathDBRouter) Get(xPath, name string) []byte

func (*XPathDBRouter) List

func (v *XPathDBRouter) List(xPath string) []string

func (*XPathDBRouter) RegisterRoute

func (v *XPathDBRouter) RegisterRoute(db TorrServerDB, xPath string) error

func (*XPathDBRouter) Rem

func (v *XPathDBRouter) Rem(xPath, name string)

func (*XPathDBRouter) Set

func (v *XPathDBRouter) Set(xPath, name string, value []byte)

Jump to

Keyboard shortcuts

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