mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
revert to old engine
This commit is contained in:
@@ -1,19 +1,21 @@
|
||||
module server
|
||||
|
||||
replace (
|
||||
github.com/anacrolix/dht v1.0.1 => github.com/YouROK/dht v0.0.0-20210323193211-11c03221cb67
|
||||
github.com/anacrolix/torrent v1.2.6 => github.com/yourok/torrent v0.0.0-20210427182412-1ef78c0fb02c
|
||||
)
|
||||
|
||||
go 1.16
|
||||
|
||||
replace github.com/anacrolix/dht/v2 v2.9.1 => github.com/anacrolix/dht/v2 v2.10.0
|
||||
|
||||
require (
|
||||
github.com/alexflint/go-arg v1.3.0
|
||||
github.com/anacrolix/dht/v2 v2.10.0 // indirect
|
||||
github.com/anacrolix/missinggo v1.3.0
|
||||
github.com/anacrolix/torrent v1.29.1
|
||||
github.com/anacrolix/missinggo v1.1.0
|
||||
github.com/anacrolix/torrent v1.2.6
|
||||
github.com/gin-contrib/cors v1.3.1
|
||||
github.com/gin-contrib/location v0.0.2
|
||||
github.com/gin-gonic/gin v1.7.1
|
||||
github.com/gin-gonic/gin v1.6.3
|
||||
github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pkg/errors v0.8.1
|
||||
go.etcd.io/bbolt v1.3.5
|
||||
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
|
||||
)
|
||||
|
||||
874
server/go.sum
874
server/go.sum
File diff suppressed because it is too large
Load Diff
@@ -28,8 +28,6 @@ type BTSets struct {
|
||||
EnableDebug bool // print logs
|
||||
|
||||
// BT Config
|
||||
AcceptPeerCon bool
|
||||
AnnTorrentsToDht bool
|
||||
EnableIPv6 bool
|
||||
DisableTCP bool
|
||||
DisableUTP bool
|
||||
@@ -40,9 +38,9 @@ type BTSets struct {
|
||||
DownloadRateLimit int // in kb, 0 - inf
|
||||
UploadRateLimit int // in kb, 0 - inf
|
||||
ConnectionsLimit int
|
||||
//DhtConnectionLimit int // 0 - inf
|
||||
DhtConnectionLimit int // 0 - inf
|
||||
PeersListenPort int
|
||||
//Strategy int // 0 - RequestStrategyDuplicateRequestTimeout, 1 - RequestStrategyFuzzing, 2 - RequestStrategyFastest
|
||||
Strategy int // 0 - RequestStrategyDuplicateRequestTimeout, 1 - RequestStrategyFuzzing, 2 - RequestStrategyFastest
|
||||
}
|
||||
|
||||
func (v *BTSets) String() string {
|
||||
@@ -121,14 +119,12 @@ func loadBTSets() {
|
||||
|
||||
func SetDefault() {
|
||||
sets := new(BTSets)
|
||||
sets.AcceptPeerCon = true
|
||||
sets.AnnTorrentsToDht = true
|
||||
sets.EnableDebug = false
|
||||
sets.DisableUTP = true
|
||||
sets.CacheSize = 96 * 1024 * 1024 // 96 MB
|
||||
sets.PreloadCache = 0
|
||||
sets.ConnectionsLimit = 23
|
||||
//sets.DhtConnectionLimit = 500
|
||||
sets.DhtConnectionLimit = 500
|
||||
sets.RetrackersMode = 1
|
||||
sets.TorrentDisconnectTimeout = 30
|
||||
sets.ReaderReadAHead = 95 // 95% preload
|
||||
|
||||
@@ -63,8 +63,6 @@ func (bt *BTServer) configure() {
|
||||
peerID := "-qB4320-"
|
||||
cliVers := userAgent //"uTorrent/2210(25302)"
|
||||
|
||||
bt.config.AcceptPeerConnections = settings.BTsets.AcceptPeerCon
|
||||
bt.config.PeriodicallyAnnounceTorrentsToDht = settings.BTsets.AnnTorrentsToDht
|
||||
bt.config.Debug = settings.BTsets.EnableDebug
|
||||
bt.config.DisableIPv6 = settings.BTsets.EnableIPv6 == false
|
||||
bt.config.DisableTCP = settings.BTsets.DisableTCP
|
||||
@@ -81,11 +79,13 @@ func (bt *BTServer) configure() {
|
||||
bt.config.EstablishedConnsPerTorrent = settings.BTsets.ConnectionsLimit
|
||||
|
||||
// Encryption/Obfuscation
|
||||
bt.config.HeaderObfuscationPolicy = torrent.HeaderObfuscationPolicy{
|
||||
RequirePreferred: settings.BTsets.ForceEncrypt,
|
||||
Preferred: true,
|
||||
bt.config.EncryptionPolicy = torrent.EncryptionPolicy{
|
||||
ForceEncryption: settings.BTsets.ForceEncrypt,
|
||||
}
|
||||
|
||||
if settings.BTsets.DhtConnectionLimit > 0 {
|
||||
bt.config.ConnTracker.SetMaxEntries(settings.BTsets.DhtConnectionLimit)
|
||||
}
|
||||
if settings.BTsets.DownloadRateLimit > 0 {
|
||||
bt.config.DownloadRateLimiter = utils.Limit(settings.BTsets.DownloadRateLimit * 1024)
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/anacrolix/torrent"
|
||||
|
||||
"server/log"
|
||||
"server/settings"
|
||||
)
|
||||
@@ -82,4 +84,6 @@ func (p *DiskPiece) Release() {
|
||||
p.piece.Complete = false
|
||||
|
||||
os.Remove(p.name)
|
||||
|
||||
p.piece.cache.torrent.Piece(p.piece.Id).SetPriority(torrent.PiecePriorityNone)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import (
|
||||
"io"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/anacrolix/torrent"
|
||||
)
|
||||
|
||||
type MemPiece struct {
|
||||
@@ -67,4 +69,6 @@ func (p *MemPiece) Release() {
|
||||
}
|
||||
p.piece.Size = 0
|
||||
p.piece.Complete = false
|
||||
|
||||
p.piece.cache.torrent.Piece(p.piece.Id).SetPriority(torrent.PiecePriorityNone)
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package torrstor
|
||||
|
||||
import (
|
||||
"github.com/anacrolix/torrent"
|
||||
"github.com/anacrolix/torrent/storage"
|
||||
|
||||
"server/settings"
|
||||
)
|
||||
|
||||
@@ -75,7 +73,4 @@ func (p *Piece) Release() {
|
||||
} else {
|
||||
p.dPiece.Release()
|
||||
}
|
||||
|
||||
p.cache.torrent.Piece(p.Id).SetPriority(torrent.PiecePriorityNone)
|
||||
p.cache.torrent.Piece(p.Id).UpdateCompletion()
|
||||
}
|
||||
|
||||
@@ -30,11 +30,7 @@ func (s *Storage) OpenTorrent(info *metainfo.Info, infoHash metainfo.Hash) (stor
|
||||
ch := NewCache(s.capacity, s)
|
||||
ch.Init(info, infoHash)
|
||||
s.caches[infoHash] = ch
|
||||
//return ch, nil
|
||||
return storage2.TorrentImpl{
|
||||
Piece: ch.Piece,
|
||||
Close: ch.Close,
|
||||
}, nil
|
||||
return ch, nil
|
||||
}
|
||||
|
||||
func (s *Storage) CloseHash(hash metainfo.Hash) {
|
||||
|
||||
@@ -24,7 +24,8 @@ func ParseFile(file multipart.File) (*torrent.TorrentSpec, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
mag := minfo.Magnet(nil, &info)
|
||||
mag := minfo.Magnet(info.Name, minfo.HashInfoBytes())
|
||||
// mag := minfo.Magnet(nil, &info)
|
||||
return &torrent.TorrentSpec{
|
||||
InfoBytes: minfo.InfoBytes,
|
||||
Trackers: [][]string{mag.Trackers},
|
||||
@@ -105,7 +106,8 @@ func fromHttp(link string) (*torrent.TorrentSpec, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mag := minfo.Magnet(nil, &info)
|
||||
mag := minfo.Magnet(info.Name, minfo.HashInfoBytes())
|
||||
// mag := minfo.Magnet(nil, &info)
|
||||
|
||||
return &torrent.TorrentSpec{
|
||||
InfoBytes: minfo.InfoBytes,
|
||||
@@ -128,7 +130,8 @@ func fromFile(path string) (*torrent.TorrentSpec, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
mag := minfo.Magnet(nil, &info)
|
||||
mag := minfo.Magnet(info.Name, minfo.HashInfoBytes())
|
||||
// mag := minfo.Magnet(nil, &info)
|
||||
return &torrent.TorrentSpec{
|
||||
InfoBytes: minfo.InfoBytes,
|
||||
Trackers: [][]string{mag.Trackers},
|
||||
|
||||
@@ -28,7 +28,8 @@ func getTorrents(c *gin.Context) {
|
||||
mi := metainfo.MetaInfo{
|
||||
AnnounceList: ts.Trackers,
|
||||
}
|
||||
mag := mi.Magnet(&ts.InfoHash, &metainfo.Info{Name: ts.DisplayName})
|
||||
mag := mi.Magnet(ts.DisplayName, ts.InfoHash)
|
||||
// mag := mi.Magnet(&ts.InfoHash, &metainfo.Info{Name: ts.DisplayName})
|
||||
http += "<p><a href='" + mag.String() + "'>magnet:?xt=urn:btih:" + mag.InfoHash.HexString() + "</a></p>"
|
||||
}
|
||||
http += "</div>"
|
||||
|
||||
Reference in New Issue
Block a user