7 "github.com/anacrolix/log"
9 pp "github.com/anacrolix/torrent/peer_protocol"
12 func TestingConfig(t testing.TB) *ClientConfig {
13 cfg := NewDefaultClientConfig()
14 cfg.ListenHost = LoopbackListenHost
16 cfg.DataDir = t.TempDir()
17 cfg.DisableTrackers = true
18 cfg.NoDefaultPortForwarding = true
19 cfg.DisableAcceptRateLimiting = true
21 cfg.KeepAliveTimeout = time.Millisecond
22 cfg.MinPeerExtensions.SetBit(pp.ExtensionBitFast, true)
23 cfg.Logger = log.Default.WithContextText(t.Name())
24 // 2 would suffice for the greeting test, but 5 is needed for a few other tests. This should be
25 // something slightly higher than the usual chunk size, so it gets tickled in some tests.
26 cfg.MaxAllocPeerRequestDataPerConn = 5
28 //cfg.Logger = cfg.Logger.WithText(func(m log.Msg) string {
30 // m.Values(func(i interface{}) bool {
31 // t += fmt.Sprintf("\n%[1]T: %[1]v", i)