}
cl.event.L = &cl.mu
- err = cl.setEnvBlocklist()
- if err != nil {
- return
+ if !cfg.NoDefaultBlocklist {
+ err = cl.setEnvBlocklist()
+ if err != nil {
+ return
+ }
}
if err = cl.initBannedTorrents(); err != nil {
)
func TestClientDefault(t *testing.T) {
- cl, err := NewClient(nil)
+ cl, err := NewClient(&Config{
+ NoDefaultBlocklist: true,
+ })
if err != nil {
t.Fatal(err)
}
)
type Config struct {
- DataDir string
- ListenAddr string
- DisableTrackers bool
- DownloadStrategy DownloadStrategy
- NoDHT bool
- DHTConfig *dht.ServerConfig
- NoUpload bool
- PeerID string
- DisableUTP bool
- DisableTCP bool
+ DataDir string
+ ListenAddr string
+ DisableTrackers bool
+ DownloadStrategy DownloadStrategy
+ NoDHT bool
+ DHTConfig *dht.ServerConfig
+ NoUpload bool
+ PeerID string
+ DisableUTP bool
+ DisableTCP bool
+ NoDefaultBlocklist bool
}
"strconv"
"strings"
"testing"
- "time"
"bitbucket.org/anacrolix/go.torrent"
"bitbucket.org/anacrolix/go.torrent/testutil"
DataDir: filepath.Join(layout.BaseDir, "incomplete"),
DisableTrackers: true,
NoDHT: true,
+
+ NoDefaultBlocklist: true,
})
defer client.Stop()
log.Printf("%+v", *layout.Metainfo)
go func() {
ioutil.ReadFile(filepath.Join(layout.MountDir, layout.Metainfo.Info.Name))
}()
- time.Sleep(time.Second)
+ // time.Sleep(time.Second)
fs.Destroy()
- time.Sleep(time.Second)
+ // time.Sleep(time.Second)
err = fuse.Unmount(layout.MountDir)
if err != nil {
log.Print(err)
DisableTrackers: true,
NoDHT: true,
ListenAddr: ":0",
+
+ NoDefaultBlocklist: true,
})
if err != nil {
t.Fatalf("error creating seeder client: %s", err)
NoDHT: true,
ListenAddr: ":0",
+ NoDefaultBlocklist: true,
+
// This can be used to check if clients can connect to other clients
// with the same ID.
}
func TestUDPTracker(t *testing.T) {
+ if testing.Short() {
+ t.SkipNow()
+ }
tr, err := tracker.New("udp://tracker.openbittorrent.com:80/announce")
if err != nil {
t.Skip(err)
// TODO: Create a fake UDP tracker to make these requests to.
func TestAnnounceRandomInfoHash(t *testing.T) {
+ if testing.Short() {
+ t.SkipNow()
+ }
wg := sync.WaitGroup{}
for _, url := range []string{
"udp://tracker.openbittorrent.com:80/announce",