cloudflare-ips 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/lib/cloudflare/ips/railtie.rb +12 -0
- data/lib/cloudflare/ips/version.rb +7 -0
- data/lib/cloudflare/ips.rb +38 -0
- metadata +4 -4
- data/lib/cloudflare_ips/railtie.rb +0 -10
- data/lib/cloudflare_ips/version.rb +0 -5
- data/lib/cloudflare_ips.rb +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f87b9d99a2bc8a676d66ea2ccb7671bcc64c9596d7a8c6d448c106c26bd71dd7
|
4
|
+
data.tar.gz: fe3087655a70da8e703144a7d12166be038e46aa54084cd70d3205ed1a8b35da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bea44615e4bf1614c5963e263a48dba5c2d6f8af6768fb00ece8775b6a496fb442df66a698656c6dddeb8da6303a8ed8b96fe3d990c365edb0a1d006c0738ebc
|
7
|
+
data.tar.gz: 31a83b9a50893eaa3567b861e7b3cf33582f1a8493f21d65c70efb2168766549628d2c09c9e556d49f15486a88aed89b87ff6457eb01ea6f2aa37376084158b0
|
data/README.md
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
#
|
1
|
+
# Cloudflare IPs
|
2
2
|
|
3
|
-
[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ksylvest/
|
4
|
-
[![RubyGems](https://img.shields.io/gem/v/
|
5
|
-
[![GitHub](https://img.shields.io/badge/github-repo-blue.svg)](https://github.com/ksylvest/
|
6
|
-
[![Yard](https://img.shields.io/badge/docs-site-blue.svg)](https://
|
7
|
-
[![CircleCI](https://img.shields.io/circleci/build/github/ksylvest/
|
3
|
+
[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ksylvest/cloudflare-ips/blob/main/LICENSE)
|
4
|
+
[![RubyGems](https://img.shields.io/gem/v/cloudflare-ips)](https://rubygems.org/gems/cloudflare-ips)
|
5
|
+
[![GitHub](https://img.shields.io/badge/github-repo-blue.svg)](https://github.com/ksylvest/cloudflare-ips)
|
6
|
+
[![Yard](https://img.shields.io/badge/docs-site-blue.svg)](https://cloudflare-ips.ksylvest.com)
|
7
|
+
[![CircleCI](https://img.shields.io/circleci/build/github/ksylvest/cloudflare-ips)](https://circleci.com/gh/ksylvest/cloudflare-ips)
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
11
|
```ruby
|
12
12
|
group :production do
|
13
|
-
gem "
|
13
|
+
gem "cloudflare-ips"
|
14
14
|
end
|
15
15
|
```
|
16
16
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cloudflare
|
4
|
+
module IPs
|
5
|
+
# Configure trusted_proxies with Cloudflare IPv4 and IPv6 addresses.
|
6
|
+
class Railtie < ::Rails::Railtie
|
7
|
+
initializer 'cloudflare-ips.configure_rails_initialization' do |app|
|
8
|
+
app.config.action_dispatch.trusted_proxies = ActionDispatch::RemoteIp::TRUSTED_PROXIES + IPS_V4 + IPS_V6
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cloudflare/ips/version'
|
4
|
+
require 'cloudflare/ips/railtie'
|
5
|
+
|
6
|
+
module Cloudflare
|
7
|
+
module IPs
|
8
|
+
# https://www.cloudflare.com/ips-v4/
|
9
|
+
IPS_V4 = %w[
|
10
|
+
173.245.48.0/20
|
11
|
+
103.21.244.0/22
|
12
|
+
103.22.200.0/22
|
13
|
+
103.31.4.0/22
|
14
|
+
141.101.64.0/18
|
15
|
+
108.162.192.0/18
|
16
|
+
190.93.240.0/20
|
17
|
+
188.114.96.0/20
|
18
|
+
197.234.240.0/22
|
19
|
+
198.41.128.0/17
|
20
|
+
162.158.0.0/15
|
21
|
+
104.16.0.0/13
|
22
|
+
104.24.0.0/14
|
23
|
+
172.64.0.0/13
|
24
|
+
131.0.72.0/22
|
25
|
+
].map { |proxy| IPAddr.new(proxy) }
|
26
|
+
|
27
|
+
# https://www.cloudflare.com/ips-v6/
|
28
|
+
IPS_V6 = %w[
|
29
|
+
2400:cb00::/32
|
30
|
+
2606:4700::/32
|
31
|
+
2803:f800::/32
|
32
|
+
2405:b500::/32
|
33
|
+
2405:8100::/32
|
34
|
+
2a06:98c0::/29
|
35
|
+
2c0f:f248::/32
|
36
|
+
].map { |proxy| IPAddr.new(proxy) }
|
37
|
+
end
|
38
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudflare-ips
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Sylvestre
|
@@ -34,9 +34,9 @@ files:
|
|
34
34
|
- LICENSE
|
35
35
|
- README.md
|
36
36
|
- Rakefile
|
37
|
-
- lib/
|
38
|
-
- lib/
|
39
|
-
- lib/
|
37
|
+
- lib/cloudflare/ips.rb
|
38
|
+
- lib/cloudflare/ips/railtie.rb
|
39
|
+
- lib/cloudflare/ips/version.rb
|
40
40
|
homepage: https://github.com/ksylvest/cloudflare_ips
|
41
41
|
licenses:
|
42
42
|
- MIT
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module CloudflareIPs
|
4
|
-
# Configure trusted_proxies with Cloudflare IPv4 and IPv6 addresses.
|
5
|
-
class Railtie < ::Rails::Railtie
|
6
|
-
initializer 'cloudflare_ips.configure_rails_initialization' do |app|
|
7
|
-
app.config.action_dispatch.trusted_proxies += CloudflareIPs::IPS_V4 + CloudflareIPs::IPS_V6
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
data/lib/cloudflare_ips.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'cloudflare_ips/version'
|
4
|
-
require 'cloudflare_ips/railtie'
|
5
|
-
|
6
|
-
module CloudflareIPs
|
7
|
-
# https://www.cloudflare.com/ips-v4/
|
8
|
-
IPS_V4 = %w[
|
9
|
-
173.245.48.0/20
|
10
|
-
103.21.244.0/22
|
11
|
-
103.22.200.0/22
|
12
|
-
103.31.4.0/22
|
13
|
-
141.101.64.0/18
|
14
|
-
108.162.192.0/18
|
15
|
-
190.93.240.0/20
|
16
|
-
188.114.96.0/20
|
17
|
-
197.234.240.0/22
|
18
|
-
198.41.128.0/17
|
19
|
-
162.158.0.0/15
|
20
|
-
104.16.0.0/13
|
21
|
-
104.24.0.0/14
|
22
|
-
172.64.0.0/13
|
23
|
-
131.0.72.0/22
|
24
|
-
].map { |proxy| IPAddr.new(proxy) }
|
25
|
-
|
26
|
-
# https://www.cloudflare.com/ips-v6/
|
27
|
-
IPS_V6 = %w[
|
28
|
-
2400:cb00::/32
|
29
|
-
2606:4700::/32
|
30
|
-
2803:f800::/32
|
31
|
-
2405:b500::/32
|
32
|
-
2405:8100::/32
|
33
|
-
2a06:98c0::/29
|
34
|
-
2c0f:f248::/32
|
35
|
-
].map { |proxy| IPAddr.new(proxy) }
|
36
|
-
end
|