settings

package
v0.0.0-...-db95cbe Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Path string
)
View Source
var (
	StartTime time.Time
)

Functions

func AddInfo

func AddInfo(hash, info string) error

func CloseDB

func CloseDB()

func GetInfo

func GetInfo(hash string) string

func GetViewed

func GetViewed(hash, filename string) bool

func GetViewedList

func GetViewedList() map[string][]string

func ReadSettings

func ReadSettings() error

func RemTorrentViewed

func RemTorrentViewed(hash string) error

func RemoveTorrentDB

func RemoveTorrentDB(hash string) error

func SaveSettings

func SaveSettings() error

func SaveTorrentDB

func SaveTorrentDB(torrent *Torrent) error

func SetRDB

func SetRDB()

func SetViewed

func SetViewed(hash, filename string) error

func SortFiles

func SortFiles(files []File)

Types

type File

type File struct {
	Name string
	Id   int
	Size int64
}

type Settings

type Settings struct {
	CacheSize         int64 // in byte, def 200 mb
	PreloadBufferSize int64 // in byte, buffer for preload

	RetrackersMode int //0 - don`t add, 1 - add retrackers, 2 - remove retrackers

	//BT Config
	EnableIPv6         bool
	EnableDebug        bool
	DisableTCP         bool
	DisableUTP         bool
	DisableUPNP        bool
	DisableDHT         bool
	DisableUpload      bool
	ReadOnlyMode       bool
	Encryption         int // 0 - Enable, 1 - disable, 2 - force
	DownloadRateLimit  int // in kb, 0 - inf
	UploadRateLimit    int // in kb, 0 - inf
	ConnectionsLimit   int
	DhtConnectionLimit int // 0 - inf
	PeersListenPort    int

	TorrentDisconnectTimeout int // in seconds
}

func Get

func Get() *Settings

func (*Settings) String

func (s *Settings) String() string

type Torrent

type Torrent struct {
	Name      string
	Magnet    string
	InfoBytes []byte
	Hash      string
	Size      int64
	Timestamp int64

	Files []File
}

func LoadTorrentDB

func LoadTorrentDB(hash string) (*Torrent, error)

func LoadTorrentsDB

func LoadTorrentsDB() ([]*Torrent, error)

Jump to

Keyboard shortcuts

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