mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
adaptation to updated engine
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"server/settings"
|
||||
"server/torr/storage/memcache"
|
||||
@@ -79,10 +80,10 @@ func (bt *BTServer) configure() {
|
||||
bt.config.NoDefaultPortForwarding = settings.Get().DisableUPNP
|
||||
bt.config.NoDHT = settings.Get().DisableDHT
|
||||
bt.config.NoUpload = settings.Get().DisableUpload
|
||||
bt.config.EncryptionPolicy = torrent.EncryptionPolicy{
|
||||
DisableEncryption: settings.Get().Encryption == 1,
|
||||
ForceEncryption: settings.Get().Encryption == 2,
|
||||
}
|
||||
//bt.config.EncryptionPolicy = torrent.EncryptionPolicy{
|
||||
// DisableEncryption: settings.Get().Encryption == 1,
|
||||
// ForceEncryption: settings.Get().Encryption == 2,
|
||||
//}
|
||||
bt.config.IPBlocklist = blocklist
|
||||
bt.config.DefaultStorage = bt.storage
|
||||
bt.config.Bep20 = peerID
|
||||
@@ -90,6 +91,13 @@ func (bt *BTServer) configure() {
|
||||
bt.config.HTTPUserAgent = userAgent
|
||||
bt.config.ExtendedHandshakeClientVersion = cliVers
|
||||
bt.config.EstablishedConnsPerTorrent = settings.Get().ConnectionsLimit
|
||||
if settings.Get().PeerStrategy == 1 { //Fastest
|
||||
bt.config.DefaultRequestStrategy = torrent.RequestStrategyFastest()
|
||||
} else if settings.Get().PeerStrategy == 2 { //Fuzzing
|
||||
bt.config.DefaultRequestStrategy = torrent.RequestStrategyFuzzing()
|
||||
} else {
|
||||
bt.config.DefaultRequestStrategy = torrent.RequestStrategyDuplicateRequestTimeout(time.Second * 5)
|
||||
}
|
||||
if settings.Get().DhtConnectionLimit > 0 {
|
||||
bt.config.ConnTracker.SetMaxEntries(settings.Get().DhtConnectionLimit)
|
||||
}
|
||||
@@ -161,6 +169,7 @@ func (bt *BTServer) BTState() *BTState {
|
||||
btState.LocalPort = bt.client.LocalPort()
|
||||
btState.PeerID = fmt.Sprintf("%x", bt.client.PeerID())
|
||||
btState.BannedIPs = len(bt.client.BadPeerIPs())
|
||||
|
||||
for _, dht := range bt.client.DhtServers() {
|
||||
btState.DHTs = append(btState.DHTs, dht)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user