2
0
mirror of synced 2025-02-23 22:28:11 +00:00
torrent/testing.go
Matt Joiner 0d4858ba29 Extract the transfer tests
We need them external the torrent package so we can test the API for adding dialers and listeners.
2020-02-20 13:57:24 +11:00

29 lines
635 B
Go

package torrent
import (
"github.com/anacrolix/torrent/internal/tmproot"
)
var TestingTempDir tmproot.Dir
func TestingConfig() *ClientConfig {
cfg := NewDefaultClientConfig()
cfg.ListenHost = LoopbackListenHost
cfg.NoDHT = true
cfg.DataDir = TestingTempDir.NewSub()
cfg.DisableTrackers = true
cfg.NoDefaultPortForwarding = true
cfg.DisableAcceptRateLimiting = true
cfg.ListenPort = 0
//cfg.Debug = true
//cfg.Logger = cfg.Logger.WithText(func(m log.Msg) string {
// t := m.Text()
// m.Values(func(i interface{}) bool {
// t += fmt.Sprintf("\n%[1]T: %[1]v", i)
// return true
// })
// return t
//})
return cfg
}