You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Overhaul stats: Increase IPv4 stats for IPv6 IPs with the prefix ::ffff: #1375
When you bind the server socket address to IPv6 IP addresses ([::]:6969 in the bind_address config option), the tracker can handle requests from IPv4 and IPv6 clients. IPv4 clients' addresses are converted to IPv6 IPs.
However, the metrics are increased for IPv6. I think we can add a config option to change the behaviour and increase IPv4-related metrics when the IPv6 address has the ::ffff: prefix.
I would make it the default behaviour, but that's a breaking change. So the new config option should be disabled.
changed the title [-]Overhaul stats events: increase IPv4 stats for IPv6 IPs with the prefix `::ffff:`[/-][+]Overhaul stats: increase IPv4 stats for IPv6 IPs with the prefix `::ffff:`[/+]on Mar 12, 2025
changed the title [-]Overhaul stats: increase IPv4 stats for IPv6 IPs with the prefix `::ffff:`[/-][+]Overhaul stats: Increase IPv4 stats for IPv6 IPs with the prefix `::ffff:`[/+]on Mar 18, 2025
Hi @devnakx, I've been discussing this feature today with @da2ce7 and he had a better proposal. Instead of using a config option to move the metrics from IPv6 to IPv4 we could add new sub-metrics for IPv6.
Pros
We explicitly put this information in the exposed metrics. So consumers know where they metrics came from even if they don't know the tracker configuration.
Cons
We have to duplicate all metrics for addresses with this prefix. In practice it will be like having a new "IP version".
On the other hand, I do not know if we should give more metrics than the basic raw metrics. This seems to be a sub-product of the current metrics. Without changing anything you can process all the evens, parse the clients' IPs and get the metrics for the IPv-4mapped IPv6 IPs (this will be possible once I finish the refactor to allow third-party packages to subscribe to events).
Where should be put the limit? Other people could potentially ask for metrics for a a subnet or something like that. I think the difference here is that if we don't do it metrics would be like "fake"· This prefix is a standard way to do it and I guess we will not have many more cases like this. So I will implement it and I will update the related issue accordingly.
Activity
[-]Overhaul stats events: increase IPv4 stats for IPv6 IPs with the prefix `::ffff:`[/-][+]Overhaul stats: increase IPv4 stats for IPv6 IPs with the prefix `::ffff:`[/+][-]Overhaul stats: increase IPv4 stats for IPv6 IPs with the prefix `::ffff:`[/-][+]Overhaul stats: Increase IPv4 stats for IPv6 IPs with the prefix `::ffff:`[/+]josecelano commentedon Mar 20, 2025
Hi @devnakx, I've been discussing this feature today with @da2ce7 and he had a better proposal. Instead of using a config option to move the metrics from IPv6 to IPv4 we could add new sub-metrics for IPv6.
Pros
Cons
On the other hand, I do not know if we should give more metrics than the basic raw metrics. This seems to be a sub-product of the current metrics. Without changing anything you can process all the evens, parse the clients' IPs and get the metrics for the IPv-4mapped IPv6 IPs (this will be possible once I finish the refactor to allow third-party packages to subscribe to events).
Where should be put the limit? Other people could potentially ask for metrics for a a subnet or something like that. I think the difference here is that if we don't do it metrics would be like "fake"· This prefix is a standard way to do it and I guess we will not have many more cases like this. So I will implement it and I will update the related issue accordingly.
josecelano commentedon Apr 22, 2025
I've used an AI model to get a list of the different ways to represent an IPv4 address in IPv6 (not confirmed):
192.0.2.33::ffff:<IPv4>::ffff:192.0.2.33or::ffff:c000:221::<IPv4>::192.0.2.33or::c000:2212002:<IPv4 in hex>::/482002:c000:0221::/482001::/32prefix + embedded obfuscated IPv42001:0000:<server>:<flags>:<obfuscated><prefix>:0:5efe:<IPv4>fe80::5efe:192.0.2.33orfe80::5efe:c000:221For now, we will implement only the
IPv4-Mapped IPv6format.With the new extendable labeled metrics this can be implemented just by adding a new label to existing metrics. For example:
Where values for the new label are:
v4,v6,v4_mapped_v6.cc @da2ce7
josecelano commentedon Jun 4, 2025
I think I'm going to use the label.
server_binding_address_typeplain,v4_mapped_v6To avoid mixing IP version (4 or 6) with mapping or what the address represents.
We can add more options in the future.
cc @da2ce7
feat: [torrust#1375] add new metric label server_binding_address_type
Merge #1558: Add new metric label `server_binding_address_type`
docs(issues): record tcp4/tcp6 counter decisions and docs-first plan
docs(issues): restate the mapped-address precedent in the tcp4/tcp6 d…
Merge #2621: docs(issues): draft tcp4/tcp6 counter semantics spec