tstor/torrent/client.go
2021-04-04 19:24:58 +02:00

20 lines
523 B
Go

package torrent
import (
"github.com/anacrolix/log"
"github.com/anacrolix/torrent"
"github.com/anacrolix/torrent/storage"
"github.com/distribyted/distribyted/config"
)
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
torrentCfg.DisableIPv6 = cfg.DisableIPv6
return torrent.NewClient(torrentCfg)
}