Skip to content

A full-featured download manager.

fix: dht config optimization

Dr_rOot110c83bcb80c
diff --git a/extra/darwin/engine/aria2.conf b/extra/darwin/engine/aria2.conf
index cb2ec0a5..464d2c0e 100755
--- a/extra/darwin/engine/aria2.conf
+++ b/extra/darwin/engine/aria2.conf
@@ -73,15 +73,19 @@ rpc-listen-all=true
# 当下载的是一个种子(以.torrent结尾)时, 自动开始BT任务, 默认:true
#follow-torrent=true
# BT监听端口, 当端口被屏蔽时使用, 默认:6881-6999
-listen-port=51413
+listen-port=50101-50109
# 单个种子最大连接数, 默认:55
#bt-max-peers=55
# 打开DHT功能, PT需要禁用, 默认:true
-# enable-dht=false
+enable-dht=true
# 打开IPv6 DHT功能, PT需要禁用
-#enable-dht6=false
+enable-dht6=true
# DHT网络监听端口, 默认:6881-6999
-#dht-listen-port=6881-6999
+dht-listen-port=50101-50109
+# Set host and port as an entry point to IPv4 DHT network.
+dht-entry-point=dht.transmissionbt.com:6881
+# Set host and port as an entry point to IPv6 DHT network.
+dht-entry-point6=dht.transmissionbt.com:6881
# 本地节点查找, PT需要禁用, 默认:false
bt-enable-lpd=true
# 种子交换, PT需要禁用, 默认:true
diff --git a/extra/linux/engine/aria2.conf b/extra/linux/engine/aria2.conf
index 13963b39..bc6640bc 100755
--- a/extra/linux/engine/aria2.conf
+++ b/extra/linux/engine/aria2.conf
@@ -73,15 +73,19 @@ rpc-listen-all=true
# 当下载的是一个种子(以.torrent结尾)时, 自动开始BT任务, 默认:true
#follow-torrent=true
# BT监听端口, 当端口被屏蔽时使用, 默认:6881-6999
-listen-port=51413
+listen-port=50101-50109
# 单个种子最大连接数, 默认:55
#bt-max-peers=55
# 打开DHT功能, PT需要禁用, 默认:true
-# enable-dht=false
+enable-dht=true
# 打开IPv6 DHT功能, PT需要禁用
-#enable-dht6=false
+enable-dht6=true
# DHT网络监听端口, 默认:6881-6999
-#dht-listen-port=6881-6999
+dht-listen-port=50101-50109
+# Set host and port as an entry point to IPv4 DHT network.
+dht-entry-point=dht.transmissionbt.com:6881
+# Set host and port as an entry point to IPv6 DHT network.
+dht-entry-point6=dht.transmissionbt.com:6881
# 本地节点查找, PT需要禁用, 默认:false
bt-enable-lpd=true
# 种子交换, PT需要禁用, 默认:true
diff --git a/extra/win32/engine/aria2.conf b/extra/win32/engine/aria2.conf
index 334926d9..b0eb615d 100755
--- a/extra/win32/engine/aria2.conf
+++ b/extra/win32/engine/aria2.conf
@@ -73,15 +73,19 @@ rpc-listen-all=true
# 当下载的是一个种子(以.torrent结尾)时, 自动开始BT任务, 默认:true
#follow-torrent=true
# BT监听端口, 当端口被屏蔽时使用, 默认:6881-6999
-listen-port=51413
+listen-port=50101-50109
# 单个种子最大连接数, 默认:55
#bt-max-peers=55
# 打开DHT功能, PT需要禁用, 默认:true
-# enable-dht=false
+enable-dht=true
# 打开IPv6 DHT功能, PT需要禁用
-#enable-dht6=false
+enable-dht6=true
# DHT网络监听端口, 默认:6881-6999
-#dht-listen-port=6881-6999
+dht-listen-port=50101-50109
+# Set host and port as an entry point to IPv4 DHT network.
+dht-entry-point=dht.transmissionbt.com:6881
+# Set host and port as an entry point to IPv6 DHT network.
+dht-entry-point6=dht.transmissionbt.com:6881
# 本地节点查找, PT需要禁用, 默认:false
bt-enable-lpd=true
# 种子交换, PT需要禁用, 默认:true
diff --git a/src/main/core/ConfigManager.js b/src/main/core/ConfigManager.js
index 13df03c3..24dc780e 100644
--- a/src/main/core/ConfigManager.js
+++ b/src/main/core/ConfigManager.js
@@ -2,6 +2,7 @@ import { app } from 'electron'
import is from 'electron-is'
import Store from 'electron-store'
import {
+ getDhtPath,
getLogPath,
getSessionPath,
getUserDownloadsPath
@@ -21,7 +22,7 @@ export default class ConfigManager {
}
/**
- * some aria2 conf
+ * Some aria2 conf
* https://aria2.github.io/manual/en/html/aria2c.html
*/
initSystemConfig () {
@@ -32,6 +33,8 @@ export default class ConfigManager {
'allow-overwrite': true,
'auto-file-renaming': true,
'continue': true,
+ 'dht-file-path': getDhtPath(4),
+ 'dht-file-path6': getDhtPath(6),
'dir': getUserDownloadsPath(),
'max-concurrent-downloads': 5,
'max-connection-per-server': is.macOS() ? 64 : 16,
diff --git a/src/main/utils/index.js b/src/main/utils/index.js
index 29bed0ce..88f850a4 100644
--- a/src/main/utils/index.js
+++ b/src/main/utils/index.js
@@ -9,6 +9,11 @@ export function getLogPath () {
return logger.transports.file.file
}
+export function getDhtPath (protocol) {
+ const name = protocol === 6 ? 'dht6.dat' : 'dht.dat'
+ return resolve(app.getPath('userData'), `./${name}`)
+}
+
export function getSessionPath () {
return resolve(app.getPath('userData'), './download.session')
}