resolve ip

This commit is contained in:
Mateusz Gruszczyński
2026-05-20 21:59:25 +02:00
parent f4d8611240
commit af20e55539
11 changed files with 364 additions and 159 deletions

View File

@@ -2,6 +2,7 @@ from __future__ import annotations
from ._shared import *
from ..services import torrent_creator
from ..services.reverse_dns import attach_reverse_dns
@bp.get("/torrents")
def torrents():
@@ -386,6 +387,10 @@ def torrent_peers(torrent_hash: str):
peers = rtorrent.torrent_peers(profile, torrent_hash)
for peer in peers:
peer.update(lookup_ip(peer.get("ip", "")))
prefs = preferences.get_preferences(profile_id=profile.get("id"))
if int(prefs.get("reverse_dns_enabled") or 0):
# Note: PTR hostnames are attached only when the user enables the lightweight cached resolver.
attach_reverse_dns(peers)
return ok({"peers": peers})