ip_anonymizer 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -2
- data/LICENSE.txt +1 -1
- data/README.md +8 -8
- data/lib/ip_anonymizer/version.rb +1 -1
- data/lib/ip_anonymizer.rb +2 -0
- metadata +11 -74
- data/.gitignore +0 -9
- data/.travis.yml +0 -11
- data/Gemfile +0 -6
- data/Rakefile +0 -19
- data/ip_anonymizer.gemspec +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f454e201a3d9c2f4289e2b0c6e367bffbed093f74dbcc6feeb1325ca39aa7a84
|
4
|
+
data.tar.gz: 312f1dcaf7e753febe323c9aed56b5847d1c1bfba84a2231fa79b73e34d8ec5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e5ad0bba1c72b3753e4b9218af6139df2cc0833cb3334e7b508740771ae6d3e3201773674ee2442d242807bf943cd46d93e75ce85271fb8a13fb7e499245ea0
|
7
|
+
data.tar.gz: e800b290819f4854464d21bd73451a2a5c39ea5598155267323c34a59552f3efb1139eb4881b2a2e952f08b4435c07e2113ababf85061da9e399d9d89365fa38
|
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -6,14 +6,14 @@ Works with IPv4 and IPv6
|
|
6
6
|
|
7
7
|
Designed to help with [GDPR](https://en.wikipedia.org/wiki/General_Data_Protection_Regulation) compliance
|
8
8
|
|
9
|
-
[![Build Status](https://
|
9
|
+
[![Build Status](https://github.com/ankane/ip_anonymizer/workflows/build/badge.svg?branch=master)](https://github.com/ankane/ip_anonymizer/actions)
|
10
10
|
|
11
11
|
## Getting Started
|
12
12
|
|
13
13
|
Add these lines to your application’s Gemfile:
|
14
14
|
|
15
15
|
```ruby
|
16
|
-
gem
|
16
|
+
gem "ip_anonymizer"
|
17
17
|
```
|
18
18
|
|
19
19
|
There are two strategies for anonymizing IPs.
|
@@ -47,12 +47,12 @@ IpAnonymizer.hash_ip("2001:4860:4860:0:0:0:0:8844", key: "secret")
|
|
47
47
|
# => "f6e4:a4fe:32dc:2f39:3e47:84cc:e85e:865c"
|
48
48
|
```
|
49
49
|
|
50
|
-
An advantage of this approach is different IPs will have different hashes.
|
50
|
+
An advantage of this approach is different IPs will have different hashes (with the exception of collisions).
|
51
51
|
|
52
|
-
Make sure the key is kept secret and at least 30 random characters. Otherwise, a rainbow table can be constructed.
|
52
|
+
Make sure the key is kept secret and at least 30 random characters. Otherwise, a rainbow table can be constructed. You can generate a good key with:
|
53
53
|
|
54
|
-
```
|
55
|
-
|
54
|
+
```ruby
|
55
|
+
SecureRandom.hex(32)
|
56
56
|
```
|
57
57
|
|
58
58
|
## Rails
|
@@ -88,11 +88,11 @@ Everyone is encouraged to help improve this project. Here are a few ways you can
|
|
88
88
|
- Write, clarify, or fix documentation
|
89
89
|
- Suggest or add new features
|
90
90
|
|
91
|
-
To get started with development
|
91
|
+
To get started with development:
|
92
92
|
|
93
93
|
```sh
|
94
94
|
git clone https://github.com/ankane/ip_anonymizer.git
|
95
95
|
cd ip_anonymizer
|
96
96
|
bundle install
|
97
|
-
rake test
|
97
|
+
bundle exec rake test
|
98
98
|
```
|
data/lib/ip_anonymizer.rb
CHANGED
metadata
CHANGED
@@ -1,86 +1,24 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ip_anonymizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
|
-
autorequire:
|
9
|
-
bindir:
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
|
14
|
-
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: minitest
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
description:
|
70
|
-
email:
|
71
|
-
- andrew@chartkick.com
|
11
|
+
date: 2022-10-10 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email: andrew@ankane.org
|
72
15
|
executables: []
|
73
16
|
extensions: []
|
74
17
|
extra_rdoc_files: []
|
75
18
|
files:
|
76
|
-
- ".gitignore"
|
77
|
-
- ".travis.yml"
|
78
19
|
- CHANGELOG.md
|
79
|
-
- Gemfile
|
80
20
|
- LICENSE.txt
|
81
21
|
- README.md
|
82
|
-
- Rakefile
|
83
|
-
- ip_anonymizer.gemspec
|
84
22
|
- lib/ip_anonymizer.rb
|
85
23
|
- lib/ip_anonymizer/hash_ip.rb
|
86
24
|
- lib/ip_anonymizer/mask_ip.rb
|
@@ -89,7 +27,7 @@ homepage: https://github.com/ankane/ip_anonymizer
|
|
89
27
|
licenses:
|
90
28
|
- MIT
|
91
29
|
metadata: {}
|
92
|
-
post_install_message:
|
30
|
+
post_install_message:
|
93
31
|
rdoc_options: []
|
94
32
|
require_paths:
|
95
33
|
- lib
|
@@ -97,16 +35,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
35
|
requirements:
|
98
36
|
- - ">="
|
99
37
|
- !ruby/object:Gem::Version
|
100
|
-
version: 2.
|
38
|
+
version: '2.7'
|
101
39
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
40
|
requirements:
|
103
41
|
- - ">="
|
104
42
|
- !ruby/object:Gem::Version
|
105
43
|
version: '0'
|
106
44
|
requirements: []
|
107
|
-
|
108
|
-
|
109
|
-
signing_key:
|
45
|
+
rubygems_version: 3.3.7
|
46
|
+
signing_key:
|
110
47
|
specification_version: 4
|
111
48
|
summary: IP address anonymizer for Ruby and Rails
|
112
49
|
test_files: []
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rake/testtask"
|
3
|
-
require "benchmark/ips"
|
4
|
-
|
5
|
-
Rake::TestTask.new(:test) do |t|
|
6
|
-
t.libs << "test"
|
7
|
-
t.libs << "lib"
|
8
|
-
t.test_files = FileList["test/**/*_test.rb"]
|
9
|
-
end
|
10
|
-
|
11
|
-
task default: :test
|
12
|
-
|
13
|
-
task :benchmark do
|
14
|
-
require "ip_anonymizer"
|
15
|
-
Benchmark.ips do |x|
|
16
|
-
x.report("mask_ip") { IpAnonymizer.mask_ip("8.8.4.4") }
|
17
|
-
x.report("hash_ip") { IpAnonymizer.hash_ip("8.8.4.4", key: "secret") }
|
18
|
-
end
|
19
|
-
end
|
data/ip_anonymizer.gemspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require "ip_anonymizer/version"
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "ip_anonymizer"
|
8
|
-
spec.version = IpAnonymizer::VERSION
|
9
|
-
spec.authors = ["Andrew Kane"]
|
10
|
-
spec.email = ["andrew@chartkick.com"]
|
11
|
-
|
12
|
-
spec.summary = "IP address anonymizer for Ruby and Rails"
|
13
|
-
spec.homepage = "https://github.com/ankane/ip_anonymizer"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
-
f.match(%r{^(test|spec|features)/})
|
18
|
-
end
|
19
|
-
spec.bindir = "exe"
|
20
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
-
spec.require_paths = ["lib"]
|
22
|
-
|
23
|
-
spec.required_ruby_version = ">= 2.2.0"
|
24
|
-
|
25
|
-
spec.add_development_dependency "benchmark-ips"
|
26
|
-
spec.add_development_dependency "bundler"
|
27
|
-
spec.add_development_dependency "minitest"
|
28
|
-
spec.add_development_dependency "rake"
|
29
|
-
end
|