Documentation ¶
Index ¶
- Constants
- Variables
- func AbandonTorrent(User string, infohash metainfo.Hash)
- func AddMetaCache(ih metainfo.Hash, mi metainfo.MetaInfo)
- func AddTrackerstoTorrent(User string, infohash metainfo.Hash, announcelist [][]string)
- func AddfromSpec(User string, spec *torrent.TorrentSpec, dontstart bool, nofsdb bool)
- func AuthCheck(w http.ResponseWriter, r *http.Request)
- func DeleteFilePath(User string, infohash metainfo.Hash, fp string)
- func DeleteTorrent(User string, infohash metainfo.Hash)
- func EmptyMetaCache()
- func GetFsDirInfo(ih metainfo.Hash, fp string) (ret []byte)
- func GetFsFileInfo(ih metainfo.Hash, fp string) (ret []byte)
- func GetMetaCache(ih metainfo.Hash) (spec *torrent.TorrentSpec, reterr error)
- func GetTorrentFileInfo(ih metainfo.Hash, fp string) (ret []byte)
- func GetTorrentFiles(ih metainfo.Hash) (ret []byte)
- func GetTorrentInfo(ih metainfo.Hash) (ret []byte)
- func GetTorrentInfoStat(ih metainfo.Hash) (ret []byte)
- func GetTorrentKnownSwarm(ih metainfo.Hash) (ret []byte)
- func GetTorrentMetainfo(ih metainfo.Hash) (ret []byte)
- func GetTorrentNumpieces(ih metainfo.Hash) (ret []byte)
- func GetTorrentPeerConns(ih metainfo.Hash) (ret []byte)
- func GetTorrentPieceStateRuns(ih metainfo.Hash) (ret []byte)
- func GetTorrentStats(ih metainfo.Hash) (ret []byte)
- func GetTorrents(lt []metainfo.Hash) (ret []byte)
- func Initialize()
- func MetafromHex(infohash string) (h metainfo.Hash, err error)
- func RemMetaCache(ih metainfo.Hash)
- func RemTrackersSpec(spec *torrent.TorrentSpec)
- func RemoveTorrent(User string, infohash metainfo.Hash)
- func SocketAPI(w http.ResponseWriter, r *http.Request)
- func SpecfromB64String(trnt string) (spec *torrent.TorrentSpec, reterr error)
- func SpecfromBytes(trnt []byte) (spec *torrent.TorrentSpec, reterr error)
- func SpecfromPath(path string) (spec *torrent.TorrentSpec, reterr error)
- func SpecfromURL(torrentURL string) (spec *torrent.TorrentSpec, reterr error)
- func StartFile(User string, infohash metainfo.Hash, fp string)
- func StartTorrent(User string, infohash metainfo.Hash, nofsdb bool)
- func StopFile(User string, infohash metainfo.Hash, fp string)
- func StopTorrent(User string, infohash metainfo.Hash)
- func StreamFile(w http.ResponseWriter, r *http.Request)
- func TarDir(dirpath string, w http.ResponseWriter, name string)
- func TorrentRoutine()
- func TorrentServe(w http.ResponseWriter, r *http.Request)
- func UpdateTrackers()
- func ZipDir(dirpath string, w http.ResponseWriter, name string)
- type ConReq
- type ConnectionMsg
- type DataMsg
- type DiskUsageStat
- type Eng
- type EngConfig
- func (ec *EngConfig) DRCI() (ret bool)
- func (ec *EngConfig) GetDLC() (ret bool)
- func (ec *EngConfig) GetDTC() (ret bool)
- func (ec *EngConfig) GetDTU() (ret bool)
- func (ec *EngConfig) GetGSR() (ret float64)
- func (ec *EngConfig) GetHPU() (ret string)
- func (ec *EngConfig) GetLBD() (ret bool)
- func (ec *EngConfig) GetListenC() (ret bool)
- func (ec *EngConfig) GetNOC() (ret bool)
- func (ec *EngConfig) GetOCU() (ret string)
- func (ec *EngConfig) GetSRR() (ret int64)
- func (ec *EngConfig) GetTLU() (ret []string)
- func (ec *EngConfig) GetTR() (ret int64)
- func (ec *EngConfig) WriteConfig() (err error)
- type FileInfo
- type FsFileInfo
- type Hub
- func (h *Hub) Add(Uc *UserConn)
- func (h *Hub) ListUsers() (ret []byte)
- func (h *Hub) Remove(Uc *UserConn)
- func (h *Hub) RemoveUser(Username string)
- func (h *Hub) SendMsg(User string, Type string, State string, Resp string)
- func (h *Hub) SendMsgU(User string, Type string, Infohash string, State string, Resp string)
- type MutInt
- type Mutbool
- type Resp
- type TorConfig
- type Torrent1
- type Torrent2
- type UserConn
- type UserConnMsg
Constants ¶
const Version string = "v0.1.2"
Variables ¶
var ( Engine Eng Info = log.New(os.Stderr, "[INFO] ", log.LstdFlags) // Info Logger Warn = log.New(os.Stderr, "[WARN] ", log.LstdFlags) // Logger for Warnings Err = log.New(os.Stderr, "[ERR ] ", log.LstdFlags) // Error Logger Flagconfig = struct { ListenAddress string UnixSocket string TLSKeyPath string TLSCertPath string }{} Dirconfig = struct { DirPath string ConfigDir string CacheDir string DataDir string TrntDir string }{} Configmu sync.Mutex )
var MachInfo machInfo = loadMachInfo()
var MachStats machStats
Functions ¶
func AbandonTorrent ¶
AbandonTorrent unlinks Torrent from User
func AddTrackerstoTorrent ¶
AddTrackerstoTorrent Adds Tracker to Torrent
func AddfromSpec ¶
func AddfromSpec(User string, spec *torrent.TorrentSpec, dontstart bool, nofsdb bool)
AddfromSpec Adds Torrent by Torrent Spec
func DeleteFilePath ¶
DeleteFilePath deletes the file or Folder
func DeleteTorrent ¶
DeleteTorrent in addition to Removing Torrent from Client also Deletes it from Storage
func EmptyMetaCache ¶
func EmptyMetaCache()
func GetMetaCache ¶
func GetMetaCache(ih metainfo.Hash) (spec *torrent.TorrentSpec, reterr error)
func GetTorrentFiles ¶
func GetTorrentInfo ¶
func GetTorrentInfoStat ¶
func GetTorrentKnownSwarm ¶
func GetTorrentMetainfo ¶
func GetTorrentNumpieces ¶
func GetTorrentPeerConns ¶
func GetTorrentStats ¶
func GetTorrents ¶
func Initialize ¶
func Initialize()
func MetafromHex ¶
MetafromHex returns metainfo.Hash from given infohash string
func RemMetaCache ¶
func RemTrackersSpec ¶
func RemTrackersSpec(spec *torrent.TorrentSpec)
RemTrackersSpec removes trackers from torrent.Spec
func RemoveTorrent ¶
RemoveTorrent Removes Torrent from Torrent Client
func SpecfromB64String ¶
func SpecfromB64String(trnt string) (spec *torrent.TorrentSpec, reterr error)
SpecfromB64String Returns Torrent Spec from Base64 Encoded Torrent File
func SpecfromBytes ¶
func SpecfromBytes(trnt []byte) (spec *torrent.TorrentSpec, reterr error)
SpecfromBytes Returns Torrent Spec from Bytes
func SpecfromPath ¶
func SpecfromPath(path string) (spec *torrent.TorrentSpec, reterr error)
SpecfromPath Returns Torrent Spec from File Path
func SpecfromURL ¶
func SpecfromURL(torrentURL string) (spec *torrent.TorrentSpec, reterr error)
SpecfromURL Returns Torrent Spec from HTTP URL
func StartTorrent ¶
StartTorrent Starts Torrent given infohash
func StopTorrent ¶
StopTorrent Stops Torrent given infohash
func StreamFile ¶
func StreamFile(w http.ResponseWriter, r *http.Request)
func TorrentRoutine ¶
func TorrentRoutine()
TorrentRoutine Stops Torrent on Reaching Global SeedRatio
func TorrentServe ¶
func TorrentServe(w http.ResponseWriter, r *http.Request)
Types ¶
type ConnectionMsg ¶
type DiskUsageStat ¶
type EngConfig ¶
type EngConfig struct { DisableLocalCache bool `json:"disableonlinecache"` // Disables Local Torrent Storage OnlineCacheURL string `json:"onlinecacheurl"` // Default is https://itorrents.org/torrent/%s.torrent , Setting Empty Disables OnlineCache TrackerRefresh int64 `json:"trackerrefreshinterval"` // In Minutes TrackerListURLs []string `json:"trackerlisturls"` // Default List is []string{"https://ngosang.github.io/trackerslist/trackers_best.txt"} DisAllowTrackersUser bool `json:"disallowtrackersforuser"` // If set to true , Remove all Trackers that is Added by User to magnet/torrent file. Also disallow adding trackers to torrent DisAllowTrackersCache bool `json:"disallowtrackersforcache"` // If set to true , Remove all Trackers from Torrent File fetched from Online/Local Cache GlobalSeedRatio float64 `json:"globalseedratio"` // Stops Torrent on Reaching Provided SeedRatio SRRefresh int64 `json:"seedratiocheckinterval"` // In Minutes DontRemoveCacheInfo bool `json:"dontremovecacheinfo"` // When Torrent is Deleted from Storage, it's cache file(.torrent) from Local Cache is not Deleted LockbyDefault bool `json:"lockbydefault"` // If set to true , locks every torrent on Add ListenCompletion bool `json:"listencompletion"` HookPostURL string `json:"hookposturl"` NotifyOnComplete bool `json:"notifyoncomplete"` }
EngConfig is Engine Configuration Structure which doesn't require restart of Torrent Client
func (*EngConfig) GetListenC ¶ added in v0.0.6
func (*EngConfig) WriteConfig ¶
type FsFileInfo ¶
type TorConfig ¶
type TorConfig struct { ListenHost *string ListenPort *int NoDefaultPortForwarding *bool UpnpID *string DisableTrackers *bool DisablePEX *bool NoDHT *bool PeriodicallyAnnounceTorrentsToDht *bool NoUpload *bool DisableAggressiveUpload *bool Seed *bool UploadLimiterLimit *float64 UploadLimiterBurst *int DownloadLimiterLimit *float64 DownloadLimiterBurst *int MaxUnverifiedBytes *int64 PeerID *string DisableUTP *bool DisableTCP *bool HeaderObfuscationPolicy *string CryptoProvides *uint32 IPBlocklist *bool DisableIPv6 *bool DisableIPv4 *bool DisableIPv4Peers *bool Debug *bool Logger *bool HTTPUserAgent *string ExtendedHandshakeClientVersion *string Bep20 *string NominalDialTimeout *int64 MinDialTimeout *int64 EstablishedConnsPerTorrent *int HalfOpenConnsPerTorrent *int TotalHalfOpenConns *int TorrentPeersHighWater *int TorrentPeersLowWater *int HandshakesTimeout *int64 PublicIP4 *string PublicIP6 *string DisableAcceptRateLimiting *bool DropDuplicatePeerIds *bool DropMutuallyCompletePeers *bool AcceptPeerConnections *bool DisableWebtorrent *bool DisableWebseeds *bool }
func (*TorConfig) ToTorrentConfig ¶
func (t *TorConfig) ToTorrentConfig() (tc *torrent.ClientConfig)
type Torrent1 ¶
type Torrent1 struct { Infohash string `json:"infohash"` Name string `json:"name,omitempty"` BytesCompleted int64 `json:"bytescompleted,omitempty"` BytesMissing int64 `json:"bytesmissing,omitempty"` Length int64 `json:"length,omitempty"` State string `json:"state"` Seeding bool `json:"seeding,omitempty"` }
type UserConn ¶
type UserConn struct { Sendmu sync.Mutex Username string IsAdmin bool Time time.Time Conn *websocket.Conn Stream sync.Mutex Streamers MutInt }
UserConn
func NewUserConn ¶
func (*UserConn) StopStream ¶
func (uc *UserConn) StopStream()