2020-02-20 10:57:24 +08:00
|
|
|
package torrent
|
|
|
|
|
|
|
|
import (
|
2021-02-22 11:30:09 +08:00
|
|
|
"testing"
|
2020-02-20 10:57:24 +08:00
|
|
|
)
|
|
|
|
|
2021-02-22 11:30:09 +08:00
|
|
|
func TestingConfig(t testing.TB) *ClientConfig {
|
2020-02-20 10:57:24 +08:00
|
|
|
cfg := NewDefaultClientConfig()
|
|
|
|
cfg.ListenHost = LoopbackListenHost
|
|
|
|
cfg.NoDHT = true
|
2021-02-22 11:30:09 +08:00
|
|
|
cfg.DataDir = t.TempDir()
|
2020-02-20 10:57:24 +08:00
|
|
|
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
|
|
|
|
}
|