sparoid 1.1.0 → 1.2.0
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 +4 -4
- data/.github/workflows/main.yml +8 -4
- data/CHANGELOG.md +4 -0
- data/CODEOWNERS +1 -0
- data/lib/sparoid/version.rb +1 -1
- data/lib/sparoid.rb +16 -6
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c24825e92fdb072067eb45465af26badb031dae413445c2acb4ec979bfe4afaf
|
4
|
+
data.tar.gz: e77fe5c9f7ad1c014534a51420bd9d1144f8f5fadbbcc1f28fcc8d4c0d52cf2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ded4f653d9e8526b3dc4cfe6391deb2df878dd004f7e5c7c694514f251efc865e992f6a0779fa50be7cfeeb88d92b82a982f3de98a89e020e8062b7fcd8b77a
|
7
|
+
data.tar.gz: eb545dc80266d74df92a228b09266f33edf0a9612715196d82282a6bb506ece3bf62cb361a0523516a5e7d1af9e989c1ee606e3212d7471c0b8f9daea318571e
|
data/.github/workflows/main.yml
CHANGED
@@ -1,18 +1,22 @@
|
|
1
1
|
name: Ruby
|
2
2
|
|
3
|
-
on:
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
pull_request:
|
4
8
|
|
5
9
|
jobs:
|
6
10
|
build:
|
7
11
|
strategy:
|
8
12
|
fail-fast: false
|
9
13
|
matrix:
|
10
|
-
ruby: [ 2.7,
|
14
|
+
ruby: [ 2.7, 3.1, 3.2, 3.3, ruby-head ]
|
11
15
|
runs-on: ubuntu-latest
|
12
16
|
steps:
|
13
|
-
- uses: actions/checkout@
|
17
|
+
- uses: actions/checkout@v4
|
14
18
|
- uses: ruby/setup-ruby@v1
|
15
19
|
with:
|
16
20
|
ruby-version: ${{ matrix.ruby }}
|
17
|
-
|
21
|
+
bundler-cache: true
|
18
22
|
- run: bundle exec rake
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## [1.2.0] - 2024-07-24
|
2
|
+
|
3
|
+
- Lookup public IP using http://checkip.amazonaws.com, as it's more reliable for IPv6 connections than the DNS method
|
4
|
+
|
1
5
|
## [1.1.0] - 2023-03-03
|
2
6
|
|
3
7
|
- Allow override of public ip, open for someone else by passing `:open_for_ip` to `Sparoid.auth(..., open_for_ip:)` (#11)
|
data/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @84codes/server
|
data/lib/sparoid/version.rb
CHANGED
data/lib/sparoid.rb
CHANGED
@@ -149,9 +149,21 @@ module Sparoid # rubocop:disable Metrics/ModuleLength
|
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
152
|
-
def public_ip
|
153
|
-
|
154
|
-
|
152
|
+
def public_ip(host = "checkip.amazonaws.com", port = 80) # rubocop:disable Metrics/MethodLength
|
153
|
+
Socket.tcp(host, port, connect_timeout: 3) do |sock|
|
154
|
+
sock.sync = true
|
155
|
+
sock.print "GET / HTTP/1.1\r\nHost: #{host}\r\nConnection: close\r\n\r\n"
|
156
|
+
status = sock.readline(chomp: true)
|
157
|
+
raise(ResolvError, "#{host}:#{port} response: #{status}") unless status.start_with? "HTTP/1.1 200 "
|
158
|
+
|
159
|
+
content_length = 0
|
160
|
+
until (header = sock.readline(chomp: true)).empty?
|
161
|
+
if (m = header.match(/^Content-Length: (\d+)/))
|
162
|
+
content_length = m[1].to_i
|
163
|
+
end
|
164
|
+
end
|
165
|
+
ip = sock.read(content_length).chomp
|
166
|
+
Resolv::IPv4.create ip
|
155
167
|
end
|
156
168
|
end
|
157
169
|
|
@@ -172,9 +184,7 @@ module Sparoid # rubocop:disable Metrics/ModuleLength
|
|
172
184
|
class Instance
|
173
185
|
include Sparoid
|
174
186
|
|
175
|
-
|
176
|
-
|
177
|
-
def public_ip
|
187
|
+
def public_ip(*args)
|
178
188
|
@public_ip ||= super
|
179
189
|
end
|
180
190
|
|
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.
|
4
|
+
version: 1.2.0
|
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:
|
11
|
+
date: 2024-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -36,6 +36,7 @@ files:
|
|
36
36
|
- ".gitignore"
|
37
37
|
- ".rubocop.yml"
|
38
38
|
- CHANGELOG.md
|
39
|
+
- CODEOWNERS
|
39
40
|
- Gemfile
|
40
41
|
- LICENSE.txt
|
41
42
|
- README.md
|
@@ -70,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
71
|
- !ruby/object:Gem::Version
|
71
72
|
version: '0'
|
72
73
|
requirements: []
|
73
|
-
rubygems_version: 3.
|
74
|
+
rubygems_version: 3.5.11
|
74
75
|
signing_key:
|
75
76
|
specification_version: 4
|
76
77
|
summary: Single Packet Authorisation client
|