sparoid 1.0.15 → 1.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/sparoid/version.rb +1 -1
- data/lib/sparoid.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11677eb6c66244eed7b68e11a2d543db02020701b990a3fdec1c6e230df7f883
|
4
|
+
data.tar.gz: 3a3c8c05b72ae568bf7edb0ff95e37fa60cb9173380283e626f07455d24e9064
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc14a72d7d060bad1b0bb813987a66c9464e89cb8e8dcd58cff28a91130560d91e3a5d5c49182be4465f0a8d3499f7d87e564a78b1abcf2576c4aa0bc3610550
|
7
|
+
data.tar.gz: b9dffb39f58ae71e43a54aa1417c0a1f69e25f398c6354497243b01a2f5604c26023624dffc33c3b55b7f8065c29789ef34f252298feb3f883d44ac5cc58f19a
|
data/CHANGELOG.md
CHANGED
data/lib/sparoid/version.rb
CHANGED
data/lib/sparoid.rb
CHANGED
@@ -13,9 +13,12 @@ module Sparoid
|
|
13
13
|
|
14
14
|
# Send an authorization packet
|
15
15
|
def auth(key, hmac_key, host, port)
|
16
|
+
ips = Resolv.getaddresses(host)
|
17
|
+
raise(Error, "Sparoid failed to resolv #{host}") if ips.empty?
|
18
|
+
|
16
19
|
msg = message(cached_public_ip)
|
17
20
|
data = prefix_hmac(hmac_key, encrypt(key, msg))
|
18
|
-
sendmsg(
|
21
|
+
sendmsg(ips, port, data)
|
19
22
|
|
20
23
|
# wait some time for the server to actually open the port
|
21
24
|
# if we don't wait the next SYN package will be dropped
|
@@ -41,18 +44,15 @@ module Sparoid
|
|
41
44
|
|
42
45
|
private
|
43
46
|
|
44
|
-
def sendmsg(
|
45
|
-
ok = false
|
47
|
+
def sendmsg(ips, port, data)
|
46
48
|
UDPSocket.open do |socket|
|
47
|
-
|
48
|
-
ok = true
|
49
|
+
ips.each do |ip|
|
49
50
|
socket.connect ip, port
|
50
51
|
socket.sendmsg data, 0
|
51
52
|
rescue StandardError => e
|
52
53
|
warn "Sparoid error: #{e.message}"
|
53
54
|
end
|
54
55
|
end
|
55
|
-
raise Error, "Sparoid failed to resolv #{host}" unless ok
|
56
56
|
end
|
57
57
|
|
58
58
|
def encrypt(key, data)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sparoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carl Hörberg
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|