Sha256: 4680fc7360468d70f764d681b11393c68df467c47653abf789efcf4b7094f356
Contents?: true
Size: 598 Bytes
Versions: 43
Compression:
Stored size: 598 Bytes
Contents
module Rollbar module Util module IPObfuscator require 'ipaddr' require 'digest' def self.obfuscate_ip(ip_string) return ip_string unless Rollbar.configuration.user_ip_obfuscator_secret secret = Rollbar.configuration.user_ip_obfuscator_secret ip_int32 = IPAddr.new(ip_string, Socket::AF_INET).to_i secret_int32 = Digest::MD5.hexdigest(secret)[0..7].to_i(16) obfuscated_ip_int32 = ip_int32 ^ secret_int32 % (2 << 31) IPAddr.new(obfuscated_ip_int32, Socket::AF_INET).to_s rescue nil end end end end
Version data entries
43 entries across 43 versions & 1 rubygems
Version | Path |
---|---|
rollbar-2.6.2 | lib/rollbar/util/ip_obfuscator.rb |
rollbar-2.6.1 | lib/rollbar/util/ip_obfuscator.rb |
rollbar-2.6.0 | lib/rollbar/util/ip_obfuscator.rb |