-
Notifications
You must be signed in to change notification settings - Fork 51
Tracker Checker: Support different types of tracker addresses #675
Description
Parent issue: #669
Currently, you can run the Tracker Checker with this input:
TORRUST_CHECKER_CONFIG='{
"udp_trackers": ["144.126.245.19:6969"],
"http_trackers": ["https://tracker.torrust-demo.com"],
"health_checks": ["https://tracker.torrust-demo.com/health_check"]
}' cargo run --bin tracker_checkerAnd with some restrictions.
- URLs for UDP trackers must be a socket address:
144.126.245.19:6969without the scheme. - URLs for HTTP trackers must be:
http://domain:porthttps://domain:port- You cannot include the
/or the/announceat the end.
- URLs for health checks have no restrictions. It has to be a valid URL (GET endpoint).
We should be more flexible and allow these input formats:
UDP URL
Valid:
11.22.33.4411.22.33.44:696911.22.33.44:6969/udp://11.22.33.44:6969udp://11.22.33.44:6969/
Also valid but the Tracker Checker makes scrape request too:
11.22.33.44:6969/announceudp://11.22.33.44:6969/announce
HTTP URL
Invalid:
tracker.torrust-demotracker.torrust-demo:6969tracker.torrust-demo:6969/-
tracker.torrust-demo:6969/announce
NOTICE: The scheme must be specified. HTTP tracker can be running on HTTP to HTTPs.
Valid:
http://tracker.torrust-demo:6969http://tracker.torrust-demo:6969/https://tracker.torrust-demo:6969https://tracker.torrust-demo:6969/
Also valid but the Tracker Checker makes scrape request too:
http://tracker.torrust-demo:6969/announcehttps://tracker.torrust-demo:6969/announce
NOTES
We allow the suffix announce because it's very common to get tracker lists with that suffix.
See #650
We should normalize the URL and internally store the canonical one (full URL without path):
http://[domain|ip][:port]https://[domain|ip][:port]udp://[domain|ip][:port]
Notice that it might be necessary to resolve the domain to an IP with DNS for the UDP tracker in order to make the request because the UdpClient does not accept a URL:
#[allow(clippy::module_name_repetitions)]
#[derive(Debug)]
pub struct UdpClient {
/// The socket to connect to
pub socket: Arc<UdpSocket>,
/// Timeout for sending and receiving packets
pub timeout: Duration,
}
It only accepts a socket address. Example:
use std::net::ToSocketAddrs;
fn main() -> std::io::Result<()> {
let addresses = "example.com:80".to_socket_addrs()?;
for addr in addresses {
println!("{}", addr);
}
Ok(())
}Finally, we should support URLs for UDP trackers because they could have dynamic IPs.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status