diff --git a/client_test.go b/client_test.go index 1b07f9c5..7a760d17 100644 --- a/client_test.go +++ b/client_test.go @@ -46,6 +46,12 @@ func TestClientDefault(t *testing.T) { 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 8b679c15..615e7a24 100644 --- a/config.go +++ b/config.go @@ -161,6 +161,9 @@ func (cfg *Config) setDefaults() { if cfg.DhtStartingNodes == nil { cfg.DhtStartingNodes = dht.GlobalBootstrapAddrs } + if cfg.ListenHost == nil { + cfg.ListenHost = func(string) string { return "" } + } } type EncryptionPolicy struct {