client_test.go | 6 ++++++ config.go | 3 +++ diff --git a/client_test.go b/client_test.go index 1b07f9c5abe69b02944ae27ed95f4043e14a02f1..7a760d17462529ecefd5b5c39054b6e836dc608b 100644 --- a/client_test.go +++ b/client_test.go @@ -46,6 +46,12 @@ require.NoError(t, err) cl.Close() } +func TestClientNilConfig(t *testing.T) { + cl, err := NewClient(nil) + require.NoError(t, err) + cl.Close() +} + func TestBoltPieceCompletionClosedWhenClientClosed(t *testing.T) { cfg := TestingConfig() pc, err := storage.NewBoltPieceCompletion(cfg.DataDir) diff --git a/config.go b/config.go index 8b679c15c20a0709e2c665378d2c4d3662518a22..615e7a2465a39e6acf46dbf8c750d1d2564e01ea 100644 --- a/config.go +++ b/config.go @@ -161,6 +161,9 @@ } if cfg.DhtStartingNodes == nil { cfg.DhtStartingNodes = dht.GlobalBootstrapAddrs } + if cfg.ListenHost == nil { + cfg.ListenHost = func(string) string { return "" } + } } type EncryptionPolicy struct {