Repository navigation
Description
We use the service socket addresses in many places (logs, events, etc.). However we are only using the server URL in few places like logging. When you start the tracker you can see something like:
2025-03-26T10:35:01.306728Z INFO run_with_graceful_shutdown{cookie_lifetime=120s}: UDP TRACKER: Started on: udp://0.0.0.0:6868
2025-03-26T10:35:01.306818Z INFO run_with_graceful_shutdown{cookie_lifetime=120s}: UDP TRACKER: Started on: udp://0.0.0.0:6969
2025-03-26T10:35:01.307005Z INFO start: HTTP TRACKER: Started on: http://0.0.0.0:7070
2025-03-26T10:35:01.307072Z INFO start: HTTP TRACKER: Started on: http://0.0.0.0:7171
2025-03-26T10:35:01.307247Z INFO start: API: Started on http://0.0.0.0:1212
2025-03-26T10:35:01.307368Z INFO start:start_job: HEALTH CHECK API: Started on: http://127.0.0.1:1313
We want to add the service URL in two new places:
We need to add the service URL whenever we are passing the service socket address. We need to store this:
udp://127.0.0.1:6969http://127.0.0.1:7070/announcehttps://127.0.0.1:7171/announcehttp://127.0.0.1:1212http://127.0.0.1:1313
Instead of just this:
127.0.0.1:6969127.0.0.1:7070127.0.0.1:7171127.0.0.1:1212127.0.0.1:1313
We have to options:
Option 1
Replace the SocketAddr by Url
Pros:
- More generic.
- It will support more services running in new protocols.
- We can use the URL directly when needed.
Cons:
- We have to clone the
SocketAddrfrom the Url when we only need that. However we are probably already doing that.
In the Tracker client we are already using a ServiceUrl which is a Url:
use reqwest::Url as ServiceUrl;
pub struct Configuration {
pub udp_trackers: Vec<ServiceUrl>,
pub http_trackers: Vec<ServiceUrl>,
pub health_checks: Vec<ServiceUrl>,
}Option 2
Just add the scheme argument together with SockerAddr
Cons:
- More params in the function signatures.
I will implement option 1.
@nuts-rice, I think this is what is needed to finish the implementation of issue #1409. I'm working on this issue now.
cc @da2ce7
IMPORTANT
The tracker can run behind a reverse proxy so, the service public and internal URLs can be different. For example, in the tracker demo:
- Public service URL: https://tracker.torrust-demo.com/announce (SSL)
- Container service URL: http://tracker:7070/announce (NO SSL, how the Index reach the tracker).
- Internal service URL: http://0.0.0.0:7070/announce (NO SSL)
What I'm going to add in this issue is the last one: the internal service URL. It's the URL that the application can know.
For the public service URL, we would need to add it to the configuration.
The internal service URL could also be public is the tracker is not running behing a proxy.
I'm going to use the name internal_service_url.
Activity
josecelano commentedon Mar 26, 2025
I've changed my mind regarding the name
internal_service_url. I will uselisten_urlbecause the URL is not a URL a client would use to connect to the server. It's represents the server's listening address (protocol + binding), which is useful for debugging/config visibility but not for client connections.I mean the URL
http://0.0.0.0:7070is only used to know that the server is using HTTP on port 7070, but you don't know the IPs.I will include the
listen_urlin the issue #1409 and continue working on this issue make thelisten_urlvalue available also for metrics.[-]Add server URL together to server socket address[/-][+]Make server listen URL available where server socket address is also available[/+]josecelano commentedon Jul 15, 2026
Spec update (2026-07-15)
This issue has been incorporated into EPIC #1978 — Configuration Overhaul (schema v3.0.0) as subissue #5 of 9.
Spec:
docs/issues/open/1415-1978-use-service-binding-instead-of-socket-addr.mdScope change
The original description proposed adding an
internal_service_url(with URL path segments like/announce) and building full URLs likehttp://0.0.0.0:7070/announce. After further analysis, the scope has been narrowed:What this issue now does: Replace bare
SocketAddrwith the existingServiceBindingtype fromtorrust-net-primitiveswherever service identity is used (logs, health check, metrics, events).ServiceBindingalready carries both the protocol scheme and the socket address.What it does NOT do:
/announce) — hardcoded per protocol, not useful for identityServiceBindingcarries the configured address as-istorrust-net-primitivesexternal crate —ServiceBindingis used as-isThe public-facing URL (
https://tracker.torrust-demo.com/announce) is handled by a separate issue #1417 (public_urlconfig field).Relation to #1417
This issue adds protocol context to the internal service binding. Issue #1417 adds the public URL to the configuration. They are complementary and independent.
EPIC position: Independent — no config changes, no overlap. Can run in parallel with #1453, #1490, #889.
docs(configuration): address Copilot PR review comments
docs(configuration): address Copilot PR review comments
Merge #1982: docs(configuration): add Configuration Overhaul EPIC spe…
Merge torrust#2025: Add protocol-aware service bindings to server logs
Merge #2058: chore(issues): archive eight completed issue specs