-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overhaul stats events: merge HTTP core events with a different IP version #1373
Labels
Code Cleanup / Refactoring
Tidying and Making Neat
Comments
3 tasks
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Mar 17, 2025
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Mar 17, 2025
…in HTTP tracker Instead of only the IP. The port will be abailable in evetns so we can build metrics also using the client's port.
In the end, the code looks like the following: pub enum Event {
TcpAnnounce { connection: ConnectionContext },
TcpScrape { connection: ConnectionContext },
}
pub struct ConnectionContext {
client: ClientConnectionContext,
server: ServerConnectionContext,
}
pub struct ClientConnectionContext {
ip_addr: IpAddr,
port: Option<u16>,
}
pub struct ServerConnectionContext {
socket_addr: SocketAddr,
} because the client's port might not be available. It requires to set the router in a way that you can get the connection info. It's available if you use the This is the layer in the axum router to get the connection info: .layer(SecureClientIpSource::ConnectInfo.into_extension()) |
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Mar 17, 2025
…in HTTP tracker Instead of only the IP. The port will be abailable in evetns so we can build metrics also using the client's port.
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Mar 17, 2025
…in HTTP tracker Instead of only the IP. The port will be abailable in evetns so we can build metrics also using the client's port.
josecelano
added a commit
that referenced
this issue
Mar 17, 2025
…ferent IP version 1f30f8e ci: update git hooks scripts (Jose Celano) 3969c67 refactor: [1373] include client's port in stats events when provided (Jose Celano) b8a3d44 refactor: [#1373] capture socket address from connection info in HTTP tracker (Jose Celano) 2de6c14 refactor: [#1373] merge HTTP stats events with different IP version (Jose Celano) 6de2dd9 refactor: [#1371] add connection context to HTTP core events (Jose Celano) Pull request description: Change HTTP core tracker events (`bittorrent_http_tracker_core::statistics::event::Event`) from this: ```rust pub enum Event { Tcp4Announce, Tcp4Scrape, Tcp6Announce, Tcp6Scrape, } ``` To this: ```rust pub enum Event { TcpAnnounce { connection: ConnectionContext }, TcpScrape { connection: ConnectionContext }, } pub struct ConnectionContext { client: ClientConnectionContext, server: ServerConnectionContext, } pub struct ClientConnectionContext { ip_addr: IpAddr, port: Option<u16>, } pub struct ServerConnectionContext { socket_addr: SocketAddr, } ``` ### Sub-tasks - [x] Add `ConnectionContext` to events. - [x] Merge events with the same request type (`announce` and `scrape`). - [x] Add client port to `ConnectionContext`. `ClientIpSources` type and the `packages/axum-http-tracker-server/src/v1/extractors/client_ip_sources.rs` Axum extractor have to be changed to include also the port. ACKs for top commit: josecelano: ACK 1f30f8e Tree-SHA512: a9fe256de2baf493a23ad61c2d80073e9b6c1dde578632dbed73532d19d4730f01563c1df172fbf353b9b12bf9dcea3ec1a16109fced4995c929f0daae330067
josecelano
added a commit
to josecelano/torrust-tracker
that referenced
this issue
Mar 17, 2025
…nts with different IP version
josecelano
added a commit
that referenced
this issue
Mar 17, 2025
…erent IP version 8603f8b refactor: [#1380] refactor: [#1373] merge UDP stats events with different IP version (Jose Celano) 2be682e refactor: [#1380] refactor: [#1371] add connection context to UDP core events (Jose Celano) Pull request description: Change events from this: `bittorrent_udp_tracker_core::statistics::event::Event`: ```rust pub enum Event { Udp4Connect, Udp4Announce, Udp4Scrape, Udp6Connect, Udp6Announce, Udp6Scrape, } ``` To this: ```rust pub enum Event { UdpConnect { context: ConnectionContext }, UdpAnnounce { context: ConnectionContext }, UdpScrape { context: ConnectionContext }, } pub struct ConnectionContext { client_socket_addr: SocketAddr, server_socket_addr: SocketAddr, } ``` This have also be done for [HTTP core events](#1374). ### Sub-tasks - [x] Add `ConnectionContext` to events. - [x] Merge events with the same request type (`connect`, `announce` and `scrape`). ACKs for top commit: josecelano: ACK 8603f8b Tree-SHA512: dde61535ec1f6c768ae2ad4d911e4ecece9be94c2546fd7b06a0d8d45d122caa6fcbf370cfa5de61a0d10424927cef17f7faf0a351252ab28ccb17e38058269e
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change events from this:
bittorrent_http_tracker_core::statistics::event::Event
:To this:
The text was updated successfully, but these errors were encountered: