+ querylog,stats: anonymize client ip: /16

This commit is contained in:
Simon Zolin 2020-06-03 19:08:11 +03:00
parent 72f253f62b
commit 1b5fb97a02
2 changed files with 2 additions and 2 deletions

View File

@ -16,7 +16,7 @@ func (l *queryLog) getClientIP(clientIP string) string {
ip := net.ParseIP(clientIP)
if ip != nil {
ip4 := ip.To4()
const AnonymizeClientIP4Mask = 24
const AnonymizeClientIP4Mask = 16
const AnonymizeClientIP6Mask = 112
if ip4 != nil {
clientIP = ip4.Mask(net.CIDRMask(AnonymizeClientIP4Mask, 32)).String()

View File

@ -449,7 +449,7 @@ func (s *statsCtx) getClientIP(clientIP string) string {
ip := net.ParseIP(clientIP)
if ip != nil {
ip4 := ip.To4()
const AnonymizeClientIP4Mask = 24
const AnonymizeClientIP4Mask = 16
const AnonymizeClientIP6Mask = 112
if ip4 != nil {
clientIP = ip4.Mask(net.CIDRMask(AnonymizeClientIP4Mask, 32)).String()