add AcceptPeerCon and sync server options

This commit is contained in:
nikk gitanes
2021-07-19 05:21:19 +03:00
parent 97f8aa3cbc
commit d85ff5ede4
6 changed files with 16 additions and 21 deletions

View File

@@ -12,7 +12,7 @@ import (
type BTSets struct { type BTSets struct {
// Cache // Cache
CacheSize int64 // in byte, def 200 mb CacheSize int64 // in byte, def 96 MB
ReaderReadAHead int // in percent, 5%-100%, [...S__X__E...] [S-E] not clean ReaderReadAHead int // in percent, 5%-100%, [...S__X__E...] [S-E] not clean
PreloadCache int // in percent PreloadCache int // in percent
@@ -28,6 +28,7 @@ type BTSets struct {
EnableDebug bool // print logs EnableDebug bool // print logs
// BT Config // BT Config
AcceptPeerCon bool
EnableIPv6 bool EnableIPv6 bool
DisableTCP bool DisableTCP bool
DisableUTP bool DisableUTP bool
@@ -38,9 +39,9 @@ type BTSets struct {
DownloadRateLimit int // in kb, 0 - inf DownloadRateLimit int // in kb, 0 - inf
UploadRateLimit int // in kb, 0 - inf UploadRateLimit int // in kb, 0 - inf
ConnectionsLimit int ConnectionsLimit int
DhtConnectionLimit int // 0 - inf //DhtConnectionLimit int // 0 - inf
PeersListenPort int PeersListenPort int
Strategy int // 0 - RequestStrategyDuplicateRequestTimeout, 1 - RequestStrategyFuzzing, 2 - RequestStrategyFastest //Strategy int // 0 - RequestStrategyDuplicateRequestTimeout, 1 - RequestStrategyFuzzing, 2 - RequestStrategyFastest
} }
func (v *BTSets) String() string { func (v *BTSets) String() string {
@@ -119,12 +120,13 @@ func loadBTSets() {
func SetDefault() { func SetDefault() {
sets := new(BTSets) sets := new(BTSets)
sets.AcceptPeerCon = true
sets.EnableDebug = false sets.EnableDebug = false
sets.DisableUTP = true sets.DisableUTP = true
sets.CacheSize = 96 * 1024 * 1024 // 100mb sets.CacheSize = 96 * 1024 * 1024 // 96 MB
sets.PreloadCache = 0 sets.PreloadCache = 0
sets.ConnectionsLimit = 23 sets.ConnectionsLimit = 23
sets.DhtConnectionLimit = 500 //sets.DhtConnectionLimit = 500
sets.RetrackersMode = 1 sets.RetrackersMode = 1
sets.TorrentDisconnectTimeout = 30 sets.TorrentDisconnectTimeout = 30
sets.ReaderReadAHead = 95 // 95% preload sets.ReaderReadAHead = 95 // 95% preload

View File

@@ -63,6 +63,7 @@ func (bt *BTServer) configure() {
peerID := "-qB4320-" peerID := "-qB4320-"
cliVers := userAgent //"uTorrent/2210(25302)" cliVers := userAgent //"uTorrent/2210(25302)"
bt.config.AcceptPeerConnections = settings.BTsets.AcceptPeerCon
bt.config.Debug = settings.BTsets.EnableDebug bt.config.Debug = settings.BTsets.EnableDebug
bt.config.DisableIPv6 = settings.BTsets.EnableIPv6 == false bt.config.DisableIPv6 = settings.BTsets.EnableIPv6 == false
bt.config.DisableTCP = settings.BTsets.DisableTCP bt.config.DisableTCP = settings.BTsets.DisableTCP
@@ -84,10 +85,6 @@ func (bt *BTServer) configure() {
Preferred: true, Preferred: true,
} }
// TODO
// if settings.BTsets.DhtConnectionLimit > 0 {
// bt.config.ConnTracker.SetMaxEntries(settings.BTsets.DhtConnectionLimit)
// }
if settings.BTsets.DownloadRateLimit > 0 { if settings.BTsets.DownloadRateLimit > 0 {
bt.config.DownloadRateLimiter = utils.Limit(settings.BTsets.DownloadRateLimit * 1024) bt.config.DownloadRateLimiter = utils.Limit(settings.BTsets.DownloadRateLimit * 1024)
} }

View File

@@ -8,6 +8,7 @@ export default function SecondarySettingsComponent({ settings, inputForm }) {
const { t } = useTranslation() const { t } = useTranslation()
const { const {
AcceptPeerCon,
RetrackersMode, RetrackersMode,
TorrentDisconnectTimeout, TorrentDisconnectTimeout,
EnableIPv6, EnableIPv6,
@@ -21,7 +22,6 @@ export default function SecondarySettingsComponent({ settings, inputForm }) {
DownloadRateLimit, DownloadRateLimit,
UploadRateLimit, UploadRateLimit,
ConnectionsLimit, ConnectionsLimit,
DhtConnectionLimit,
PeersListenPort, PeersListenPort,
} = settings || {} } = settings || {}
@@ -85,15 +85,10 @@ export default function SecondarySettingsComponent({ settings, inputForm }) {
label={t('SettingsDialog.DHT')} label={t('SettingsDialog.DHT')}
labelPlacement='start' labelPlacement='start'
/> />
<TextField <FormControlLabel
onChange={inputForm} control={<Switch checked={AcceptPeerCon} onChange={inputForm} id='AcceptPeerCon' color='secondary' />}
margin='normal' label={t('SettingsDialog.AcceptPeerCon')}
id='DhtConnectionLimit' labelPlacement='start'
label={t('SettingsDialog.DhtConnectionLimit')}
value={DhtConnectionLimit}
type='number'
variant='outlined'
fullWidth
/> />
<br /> <br />
<TextField <TextField

View File

@@ -1,11 +1,11 @@
export default { export default {
AcceptPeerCon: true,
CacheSize: 96, CacheSize: 96,
ReaderReadAHead: 95, ReaderReadAHead: 95,
UseDisk: false, UseDisk: false,
UploadRateLimit: 0, UploadRateLimit: 0,
TorrentsSavePath: '', TorrentsSavePath: '',
ConnectionsLimit: 23, ConnectionsLimit: 23,
DhtConnectionLimit: 500,
DisableDHT: false, DisableDHT: false,
DisablePEX: false, DisablePEX: false,
DisableTCP: false, DisableTCP: false,
@@ -20,6 +20,5 @@ export default {
PreloadCache: 0, PreloadCache: 0,
RemoveCacheOnDrop: false, RemoveCacheOnDrop: false,
RetrackersMode: 1, RetrackersMode: 1,
Strategy: 0,
TorrentDisconnectTimeout: 30, TorrentDisconnectTimeout: 30,
} }

View File

@@ -84,6 +84,7 @@
"Seconds": "Seconds", "Seconds": "Seconds",
"SelectSeason": "Select Season", "SelectSeason": "Select Season",
"SettingsDialog": { "SettingsDialog": {
"AcceptPeerCon": "Accept Peer Connections",
"AddRetrackers": "Add retrackers", "AddRetrackers": "Add retrackers",
"AdditionalSettings": "Additional Settings", "AdditionalSettings": "Additional Settings",
"CacheBeforeReaderDesc": "from cache will be saved before currently played frame", "CacheBeforeReaderDesc": "from cache will be saved before currently played frame",

View File

@@ -84,6 +84,7 @@
"Seconds": "Секунды", "Seconds": "Секунды",
"SelectSeason": "Выбор сезона", "SelectSeason": "Выбор сезона",
"SettingsDialog": { "SettingsDialog": {
"AcceptPeerCon": "Принимать входящие соединения",
"AddRetrackers": "Добавлять", "AddRetrackers": "Добавлять",
"AdditionalSettings": "Дополнительные настройки", "AdditionalSettings": "Дополнительные настройки",
"CacheBeforeReaderDesc": "от кеша будет оставаться позади воспроизводимого кадра", "CacheBeforeReaderDesc": "от кеша будет оставаться позади воспроизводимого кадра",