rangeclient 0.0.16 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/bin/er +11 -6
- data/bin/range-compress +1 -2
- data/bin/range_diff +1 -2
- data/bin/range_split +2 -2
- data/lib/rangeclient.rb +12 -6
- metadata +3 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a792c858319fda71de0b824b3a7783657c643d538d0ac66df22af819f92de6f0
|
4
|
+
data.tar.gz: a54cfff00491cfa3c7a9c5592e063cd03aefde6723aea7af026462e7f4eeb250
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0763352a40f4254a055d5576e4151e06ff7dfef37b5ca71bac84a3a5dc3abb0bc6db40c4fe30cabd4fa65567227a549f68d2b0dc97367d69a53e6573c4d70715
|
7
|
+
data.tar.gz: f21f1b175c991b31639a09784ce19278934585827d4eb4d345cd769fed89b0b5c2f1b6ec7d07b4219a8bf75d48a104ae0b38bac76618ae906bdde5e19d2da2a0
|
data/bin/er
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
#!/usr/bin/ruby
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'rubygems'
|
4
3
|
require 'rangeclient'
|
5
4
|
|
6
5
|
require 'optparse'
|
@@ -10,13 +9,13 @@ options = {
|
|
10
9
|
}
|
11
10
|
optparse = OptionParser.new do |opts|
|
12
11
|
opts.on('-e', '--expand', 'Print one element per line') do |arg|
|
13
|
-
options[:expand] = arg
|
12
|
+
options[:expand] = arg
|
14
13
|
end
|
15
14
|
opts.on('-c', '--count', 'Print the count of range elements, not the range itself') do |arg|
|
16
|
-
options[:count] = arg
|
15
|
+
options[:count] = arg
|
17
16
|
end
|
18
17
|
opts.on('-s', '--sort', 'Sort expanded output') do |arg|
|
19
|
-
options[:sorted] = arg
|
18
|
+
options[:sorted] = arg
|
20
19
|
end
|
21
20
|
opts.on('-v', '--vip range:80', 'Which host or host:port to query') do |arg|
|
22
21
|
host, port = arg.split(':', 2)
|
@@ -24,7 +23,13 @@ optparse = OptionParser.new do |opts|
|
|
24
23
|
options[:port] = port unless port.nil?
|
25
24
|
end
|
26
25
|
opts.on('-p', '--port 80', 'Port to use when connecting') do |arg|
|
27
|
-
options[:port] = arg
|
26
|
+
options[:port] = arg
|
27
|
+
end
|
28
|
+
opts.on('--[no-]ssl', 'Enable SSL') do |ssl|
|
29
|
+
options[:ssl] = ssl
|
30
|
+
end
|
31
|
+
opts.on('--ca-file FILE', 'PEM-formatted CA certificates to validate against when SSL is enabled') do |cafile|
|
32
|
+
options[:ca_file] = cafile
|
28
33
|
end
|
29
34
|
opts.on('-t', '--timeout TIMEOUT', "Wait this long for a response") do |arg|
|
30
35
|
options[:timeout] = arg.to_i
|
data/bin/range-compress
CHANGED
data/bin/range_diff
CHANGED
data/bin/range_split
CHANGED
data/lib/rangeclient.rb
CHANGED
@@ -7,7 +7,7 @@ require 'uri'
|
|
7
7
|
class Range::Client
|
8
8
|
attr_accessor :host, :port, :timeout, :rangeexception
|
9
9
|
|
10
|
-
class QueryException <
|
10
|
+
class QueryException < StandardError
|
11
11
|
end
|
12
12
|
|
13
13
|
# used to split hostnames into component parts for compression
|
@@ -29,15 +29,21 @@ class Range::Client
|
|
29
29
|
@ssl = ENV['RANGE_SSL'] =~ (/(1|true)/i)
|
30
30
|
@ssl = options[:ssl] if options.member?(:ssl)
|
31
31
|
|
32
|
+
@ca_file = ENV['RANGE_CA_FILE'] if ENV.has_key?('RANGE_CA_FILE')
|
33
|
+
@ca_file = options[:ca_file] if options.member?(:ca_file)
|
34
|
+
|
32
35
|
@timeout = 60
|
33
36
|
@timeout = options[:timeout] if options.member?(:timeout)
|
34
37
|
end
|
35
38
|
|
36
39
|
def expand(arg)
|
37
|
-
escaped_arg = URI.
|
40
|
+
escaped_arg = URI.encode_www_form_component arg
|
38
41
|
http = Net::HTTP.new(@host, @port)
|
39
42
|
http.read_timeout = @timeout
|
40
|
-
|
43
|
+
if @ssl
|
44
|
+
http.use_ssl = true
|
45
|
+
http.ca_file = @ca_file
|
46
|
+
end
|
41
47
|
req = Net::HTTP::Get.new('/range/list?' + escaped_arg)
|
42
48
|
resp = http.request(req)
|
43
49
|
raise QueryException.new(resp.body) unless resp.is_a?(Net::HTTPSuccess)
|
@@ -85,7 +91,7 @@ class Range::Client
|
|
85
91
|
if r=~ /,/
|
86
92
|
r = "{#{r}}"
|
87
93
|
end
|
88
|
-
result << "#{r}.#{domain}"
|
94
|
+
result << "#{r}.#{domain}"
|
89
95
|
end
|
90
96
|
return result.join ","
|
91
97
|
end
|
@@ -135,7 +141,7 @@ class Range::Client
|
|
135
141
|
count += 1
|
136
142
|
next
|
137
143
|
end
|
138
|
-
|
144
|
+
|
139
145
|
if prev_n
|
140
146
|
if count > 0
|
141
147
|
result << _get_group(prev_prefix, prev_digits, count, prev_suffix)
|
@@ -181,7 +187,7 @@ class Range::Client
|
|
181
187
|
prefix = "" if prefix.nil?
|
182
188
|
group = sprintf("%s%0*d..%s",
|
183
189
|
prefix,
|
184
|
-
digits.to_s.length,
|
190
|
+
digits.to_s.length,
|
185
191
|
digits.to_i, # sometimes has leading zeroes
|
186
192
|
_ignore_common_prefix(digits, (digits.to_i + count).to_s)
|
187
193
|
)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rangeclient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Miller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Use with range from https://github.com/square/libcrange
|
14
14
|
email:
|
@@ -49,10 +49,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: 1.3.6
|
51
51
|
requirements: []
|
52
|
-
|
53
|
-
rubygems_version: 2.4.4
|
52
|
+
rubygems_version: 3.3.5
|
54
53
|
signing_key:
|
55
54
|
specification_version: 4
|
56
55
|
summary: Simple range client for ruby.
|
57
56
|
test_files: []
|
58
|
-
has_rdoc:
|