What is the problem your feature solves, or the need it fulfills?
I want to anonymize client IP addresses, so that IP address 1.2.3.4 shows up as 1.2.3.0 in the logs for example. I can adjust the log output code of course, but ideally the client IP address would be adjusted at Session level so that whatever code might decide to store or log an IP address will always get the anonymized one.
Describe the solution you'd like
As Session::client_addr goes to Session::digest internally, that’s what will need to be changed. This can be done via a Session::digest_mut method granting mutable access to the digest.
Describe alternatives you've considered
I already have a Session wrapper, and I could use it to override Session::client_addr return value (in fact, that’s what I am going to implement now). However, some code might still unintentionally access the unwrapped Session instance or get the IP address via Session::digest which is much harder to override.
What is the problem your feature solves, or the need it fulfills?
I want to anonymize client IP addresses, so that IP address
1.2.3.4
shows up as1.2.3.0
in the logs for example. I can adjust the log output code of course, but ideally the client IP address would be adjusted atSession
level so that whatever code might decide to store or log an IP address will always get the anonymized one.Describe the solution you'd like
As
Session::client_addr
goes toSession::digest
internally, that’s what will need to be changed. This can be done via aSession::digest_mut
method granting mutable access to the digest.Describe alternatives you've considered
I already have a
Session
wrapper, and I could use it to overrideSession::client_addr
return value (in fact, that’s what I am going to implement now). However, some code might still unintentionally access the unwrappedSession
instance or get the IP address viaSession::digest
which is much harder to override.