From 97cb41a5c9a44dcdef50e7bf82011adb4b4bcb77 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Fri, 18 Aug 2017 11:14:28 +1000 Subject: [PATCH] Provide default starting nodes to DHT if default torrent client config is used https://github.com/anacrolix/torrent/issues/178 --- client.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/client.go b/client.go index e66e519c..44a43619 100644 --- a/client.go +++ b/client.go @@ -225,7 +225,17 @@ func listen(tcp, utp bool, networkSuffix, addr string) (tcpL net.Listener, utpSo // Creates a new client. func NewClient(cfg *Config) (cl *Client, err error) { if cfg == nil { - cfg = &Config{} + cfg = &Config{ + DHTConfig: dht.ServerConfig{ + StartingNodes: func() []dht.Addr { + addrs, err := dht.GlobalBootstrapAddrs() + if err != nil { + log.Printf("error getting dht bootstrap addrs for default torrent client config: %s", err) + } + return addrs + }(), + }, + } } defer func() { -- 2.48.1