mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
fix dht
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
package torr
|
||||
|
||||
import (
|
||||
"github.com/anacrolix/dht"
|
||||
"github.com/anacrolix/torrent"
|
||||
)
|
||||
|
||||
type BTState struct {
|
||||
LocalPort int
|
||||
PeerID string
|
||||
BannedIPs int
|
||||
DHTs []*dht.Server
|
||||
DHTs []torrent.DhtServer
|
||||
|
||||
Torrents []*Torrent
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import (
|
||||
|
||||
"server/utils"
|
||||
|
||||
dht2 "github.com/anacrolix/dht"
|
||||
|
||||
"github.com/anacrolix/torrent/metainfo"
|
||||
"github.com/labstack/echo"
|
||||
"github.com/labstack/gommon/bytes"
|
||||
@@ -39,10 +41,12 @@ func statePage(c echo.Context) error {
|
||||
for _, dht := range state.DHTs {
|
||||
msg += fmt.Sprintf("%s DHT server at %s:<br>\n", dht.Addr().Network(), dht.Addr().String())
|
||||
dhtStats := dht.Stats()
|
||||
msg += fmt.Sprintf("\t # Nodes: %d (%d good, %d banned)<br>\n", dhtStats.Nodes, dhtStats.GoodNodes, dhtStats.BadNodes)
|
||||
if ds, ok := dhtStats.(dht2.ServerStats); ok {
|
||||
msg += fmt.Sprintf("\t # Nodes: %d (%d good, %d banned)<br>\n", ds.Nodes, ds.GoodNodes, ds.BadNodes)
|
||||
msg += fmt.Sprintf("\t Server ID: %x<br>\n", dht.ID())
|
||||
msg += fmt.Sprintf("\t Announces: %d<br>\n", dhtStats.SuccessfulOutboundAnnouncePeerQueries)
|
||||
msg += fmt.Sprintf("\t Outstanding transactions: %d<br>\n", dhtStats.OutstandingTransactions)
|
||||
msg += fmt.Sprintf("\t Announces: %d<br>\n", ds.SuccessfulOutboundAnnouncePeerQueries)
|
||||
msg += fmt.Sprintf("\t Outstanding transactions: %d<br>\n", ds.OutstandingTransactions)
|
||||
}
|
||||
}
|
||||
|
||||
sort.Slice(state.Torrents, func(i, j int) bool {
|
||||
|
||||
Reference in New Issue
Block a user