creating...

This commit is contained in:
YouROK
2020-11-09 16:45:06 +03:00
parent 0b09da2490
commit 1d4acc1406
12 changed files with 710 additions and 55 deletions

View File

@@ -99,6 +99,21 @@ func (bt *BTServer) configure() {
log.Println("Configure client:", settings.BTsets)
}
func (bt *BTServer) GetTorrent(hash torrent.InfoHash) *Torrent {
if torr, ok := bt.torrents[hash]; ok {
return torr
}
return nil
}
func (bt *BTServer) ListTorrents() []*Torrent {
var list []*Torrent
for _, t := range bt.torrents {
list = append(list, t)
}
return list
}
func (bt *BTServer) RemoveTorrent(hash torrent.InfoHash) {
if torr, ok := bt.torrents[hash]; ok {
torr.Close()