From: Matt Joiner Date: Fri, 18 Aug 2017 01:14:28 +0000 (+1000) Subject: Provide default starting nodes to DHT if default torrent client config is used X-Git-Tag: v1.0.0~440 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=97cb41a5c9a44dcdef50e7bf82011adb4b4bcb77;p=btrtrc.git Provide default starting nodes to DHT if default torrent client config is used https://github.com/anacrolix/torrent/issues/178 --- 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() {