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_checker
And with some restrictions.
- URLs for UDP trackers must be a socket address:
144.126.245.19:6969 without the scheme.
- URLs for HTTP trackers must be:
http://domain:port
https://domain:port
- You cannot include the
/ or the /announce at 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.44
11.22.33.44:6969
11.22.33.44:6969/
udp://11.22.33.44:6969
udp://11.22.33.44:6969/
Also valid but the Tracker Checker makes scrape request too:
11.22.33.44:6969/announce
udp://11.22.33.44:6969/announce
HTTP URL
Invalid:
tracker.torrust-demo
tracker.torrust-demo:6969
tracker.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:6969
http://tracker.torrust-demo:6969/
https://tracker.torrust-demo:6969
https://tracker.torrust-demo:6969/
Also valid but the Tracker Checker makes scrape request too:
http://tracker.torrust-demo:6969/announce
https://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.
Parent issue: #669
Currently, you can run the Tracker Checker with this input:
And with some restrictions.
144.126.245.19:6969without the scheme.http://domain:porthttps://domain:port/or the/announceat the end.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
scraperequest too:11.22.33.44:6969/announceudp://11.22.33.44:6969/announceHTTP URL
Invalid:
tracker.torrust-demotracker.torrust-demo:6969tracker.torrust-demo:6969/tracker.torrust-demo:6969/announceValid:
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
scraperequest too:http://tracker.torrust-demo:6969/announcehttps://tracker.torrust-demo:6969/announceNOTES
We allow the suffix
announcebecause 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
UdpClientdoes not accept a URL:It only accepts a socket address. Example:
Finally, we should support URLs for UDP trackers because they could have dynamic IPs.