tstor/torrent/client.go

21 lines
523 B
Go
Raw Normal View History

package torrent
import (
"github.com/anacrolix/log"
"github.com/anacrolix/torrent"
"github.com/anacrolix/torrent/storage"
2021-04-04 17:24:58 +00:00
"github.com/distribyted/distribyted/config"
)
2021-04-04 17:24:58 +00:00
func NewClient(st storage.ClientImpl, cfg *config.TorrentGlobal) (*torrent.Client, error) {
// TODO download and upload limits
torrentCfg := torrent.NewDefaultClientConfig()
torrentCfg.Logger = log.Discard
torrentCfg.Seed = true
torrentCfg.DefaultStorage = st
2021-04-04 17:24:58 +00:00
torrentCfg.DisableIPv6 = cfg.DisableIPv6
2021-04-04 17:24:58 +00:00
return torrent.NewClient(torrentCfg)
}