mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-20 05:56:10 +05:00
add block ip
This commit is contained in:
@@ -3,7 +3,6 @@ package torr
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"path/filepath"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"server/settings"
|
"server/settings"
|
||||||
@@ -11,10 +10,10 @@ import (
|
|||||||
"server/torr/storage/state"
|
"server/torr/storage/state"
|
||||||
"server/utils"
|
"server/utils"
|
||||||
|
|
||||||
"github.com/anacrolix/torrent"
|
|
||||||
"github.com/anacrolix/torrent/iplist"
|
|
||||||
"github.com/anacrolix/torrent/metainfo"
|
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
|
"github.com/anacrolix/torrent"
|
||||||
|
"github.com/anacrolix/torrent/metainfo"
|
||||||
)
|
)
|
||||||
|
|
||||||
type BTServer struct {
|
type BTServer struct {
|
||||||
@@ -53,7 +52,7 @@ func (bt *BTServer) Disconnect() {
|
|||||||
if bt.client != nil {
|
if bt.client != nil {
|
||||||
bt.client.Close()
|
bt.client.Close()
|
||||||
bt.client = nil
|
bt.client = nil
|
||||||
utils.FreeOSMemGC(0)
|
utils.FreeOSMemGC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +64,8 @@ func (bt *BTServer) Reconnect() error {
|
|||||||
func (bt *BTServer) configure() {
|
func (bt *BTServer) configure() {
|
||||||
bt.storage = memcache.NewStorage(settings.Get().CacheSize)
|
bt.storage = memcache.NewStorage(settings.Get().CacheSize)
|
||||||
|
|
||||||
blocklist, _ := iplist.MMapPackedFile(filepath.Join(settings.Path, "blocklist"))
|
//blocklist, _ := iplist.MMapPackedFile(filepath.Join(settings.Path, "blocklist"))
|
||||||
|
blocklist, _ := utils.ReadBlockedIP()
|
||||||
|
|
||||||
userAgent := "uTorrent/3.5.5"
|
userAgent := "uTorrent/3.5.5"
|
||||||
peerID := "-UT3550-"
|
peerID := "-UT3550-"
|
||||||
|
|||||||
Reference in New Issue
Block a user