net-ssh-gateway 2.0.0 → 2.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 39b8b75dd853dc9f4d6b29f0556caa737eb69526
4
- data.tar.gz: c6b43818b0317d41c4848a0d83452c059139af1d
2
+ SHA256:
3
+ metadata.gz: b52c1a6ecaa591eba26739887c4ef31b77727c98de4af3ac5cda37b0e6f33439
4
+ data.tar.gz: 8f7652d64044d6f72a7b9da75b5d82009b3c77e2cf87a5aa0a4b566fc67128e2
5
5
  SHA512:
6
- metadata.gz: 709256f5adefc2f7991e62e64c21cdd7d948fb754976a087ea2e9e24a7530377f6e1198e47a643b922a4ac225ce98dbefd0afa9bc83c7407815c68bfb1fa3934
7
- data.tar.gz: 44195cc2db4b668e58f38458afdb4f226420ad20e3bf18683627a70610bec441b6be88399fb95a035bb08be13960f2b1308e18b2cc36f19ab68dc6977fa2d7cc
6
+ metadata.gz: 3ff299b298d0b2e880442bb4442a2a089bc36ef54c41e3e741edd82f741a098de56063e0cb83824ff4071289d344cb59997a6d15553cf3f7f54ea9c656687b8d
7
+ data.tar.gz: 4f91d2bccb6ac8b13ab23ad2a610ef647029d686e999afff3799050abd16f2cfa0fdf9aa7d0b134813622e971549ad41b878605292f9c6dce9d4f2ab7f6f1f25
checksums.yaml.gz.sig CHANGED
Binary file
@@ -0,0 +1,24 @@
1
+ name: CI
2
+ on:
3
+ pull_request:
4
+ push: { branches: master }
5
+ permissions:
6
+ contents: read
7
+ jobs:
8
+ test:
9
+ # setup-ruby has no builds of Ruby 3.1 and older for ubuntu-latest (26.04).
10
+ runs-on: ubuntu-24.04
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ ruby-version: ['2.6', '2.7', '3.0', '3.1', '3.2', '3.3', '3.4', '4.0', 'ruby-head', 'jruby']
15
+ continue-on-error: ${{ contains(fromJSON('["ruby-head", "jruby"]'), matrix.ruby-version) }}
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - name: Set up Ruby ${{ matrix.ruby-version }}
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby-version }}
22
+ bundler-cache: true
23
+ - name: Run Tests
24
+ run: bundle exec rake test
data/.gitignore CHANGED
@@ -1,11 +1,3 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.swp
11
- .DS_Store
1
+ pkg
2
+ .bundle/
3
+ Gemfile.lock
data/CHANGES.txt CHANGED
@@ -1,4 +1,8 @@
1
+ === 2.0.1 / 11 Nov 2026
1
2
 
3
+ * `open` with a `local_port` of 0 returns and yields the port the OS picked, so several gateways can run without port clashes. Based on #6 by @thechile [mfazekas]
4
+ * `require 'net/ssh/gateway'` now defines `Net::SSH::Gateway::VERSION` [mfazekas]
5
+ * Run the tests on GitHub Actions for Ruby 2.6 to 4.0 [mfazekas]
2
6
 
3
7
  === 2.0.0 / 26 Jan 2017
4
8
 
data/README.md CHANGED
@@ -23,6 +23,7 @@ Net::SSH::Gateway is a library for programmatically tunnelling connections to se
23
23
 
24
24
  In a nutshell:
25
25
 
26
+ ```ruby
26
27
  require 'net/ssh/gateway'
27
28
 
28
29
  gateway = Net::SSH::Gateway.new('host', 'user')
@@ -40,6 +41,7 @@ In a nutshell:
40
41
  # As of 1.1.0, you can also specify the wait time for the
41
42
  # gateway thread with the :loop_wait option.
42
43
  gateway = Net::SSH::Gateway.new('host', 'user', :loop_wait => 0.001)
44
+ ```
43
45
 
44
46
  See Net::SSH::Gateway for more documentation.
45
47
 
data/Rakefile CHANGED
@@ -7,3 +7,45 @@ Rake::TestTask.new do |t|
7
7
  end
8
8
 
9
9
  task :default => :test
10
+
11
+ namespace :cert do
12
+ desc "Update public cert from private - only run if public is expired"
13
+ task :update_public_when_expired do
14
+ require 'openssl'
15
+ require 'time'
16
+ raw = File.read "net-ssh-public_cert.pem"
17
+ certificate = OpenSSL::X509::Certificate.new raw
18
+ raise Exception, "Not yet expired: #{certificate.not_after}" unless certificate.not_after < Time.now
19
+ sh "gem cert --build netssh@solutious.com --days 365*5 --private-key /mnt/gem/net-ssh-private_key.pem"
20
+ sh "mv gem-public_cert.pem net-ssh-public_cert.pem"
21
+ sh "gem cert --add net-ssh-public_cert.pem"
22
+ end
23
+ end
24
+
25
+ VERSION_FILE = "lib/net/ssh/gateway/version.rb"
26
+
27
+ # Sets the version in VERSION_FILE and turns the "=== Unreleased" section of CHANGES.txt into its release entry.
28
+ def change_version
29
+ source = File.read(VERSION_FILE)
30
+ current = source[/VERSION = "(\d+\.\d+\.\d+)"/, 1] or raise "No VERSION in #{VERSION_FILE}"
31
+ new_version = yield(*current.split(".").map(&:to_i)).join(".")
32
+
33
+ changes = File.read("CHANGES.txt")
34
+ raise "CHANGES.txt has no '=== Unreleased' section" unless changes.start_with?("=== Unreleased\n")
35
+
36
+ File.write(VERSION_FILE, source.sub(%("#{current}"), %("#{new_version}")))
37
+ File.write("CHANGES.txt", changes.sub("=== Unreleased", "=== #{new_version} / #{Time.now.utc.strftime('%d %b %Y')}"))
38
+ puts "#{current} => #{new_version}"
39
+ end
40
+
41
+ namespace :vbump do
42
+ desc "Patch release"
43
+ task :final do
44
+ change_version { |major, minor, tiny| [major, minor, tiny + 1] }
45
+ end
46
+
47
+ desc "Minor release"
48
+ task :minor do
49
+ change_version { |major, minor, _tiny| [major, minor + 1, 0] }
50
+ end
51
+ end
@@ -1,7 +1,7 @@
1
1
  module Net
2
2
  module SSH
3
3
  class Gateway
4
- VERSION = "2.0.0"
4
+ VERSION = "2.0.1"
5
5
  end
6
6
  end
7
7
  end
@@ -1,6 +1,7 @@
1
1
  require 'thread'
2
2
  require 'net/ssh'
3
3
  require 'net/ssh/version'
4
+ require 'net/ssh/gateway/version'
4
5
 
5
6
  # A Gateway is an object that allows you to tunnel network connections through
6
7
  # a publicly visible host to a host hidden behind it. This is particularly
@@ -100,13 +101,16 @@ class Net::SSH::Gateway
100
101
  # gateway.close(port)
101
102
  #
102
103
  # If +local_port+ is not specified, the next available port will be used.
104
+ # A +local_port+ of 0 lets the OS pick a free port, which avoids clashes
105
+ # between several gateways in one process; the port it picked is returned
106
+ # (or yielded).
103
107
  def open(host, port, local_port=nil)
104
108
  ensure_open!
105
109
 
106
110
  actual_local_port = local_port || next_port
107
111
 
108
112
  @session_mutex.synchronize do
109
- @session.forward.local(actual_local_port, host, port)
113
+ actual_local_port = @session.forward.local(actual_local_port, host, port)
110
114
  end
111
115
 
112
116
  if block_given?
@@ -22,10 +22,9 @@ Gem::Specification.new do |spec|
22
22
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
- spec.add_development_dependency "bundler", "~> 1.10"
26
- spec.add_development_dependency "rake", "~> 10.0"
27
- spec.add_development_dependency "minitest", "~> 5.8.4"
28
- spec.add_development_dependency "mocha", ">= 1.2.1"
25
+ spec.add_development_dependency "rake", ">= 12.0"
26
+ spec.add_development_dependency "minitest", ">= 5.10"
27
+ spec.add_development_dependency "mocha", ">= 1.4"
29
28
 
30
29
  spec.add_runtime_dependency "net-ssh", ">= 4.0.0"
31
30
  end
@@ -1,7 +1,7 @@
1
1
  -----BEGIN CERTIFICATE-----
2
- MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBBMQ8wDQYDVQQDDAZuZXRz
2
+ MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMQ8wDQYDVQQDDAZuZXRz
3
3
  c2gxGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZFgNj
4
- b20wHhcNMTYxMjE1MTgwNTIyWhcNMTcxMjE1MTgwNTIyWjBBMQ8wDQYDVQQDDAZu
4
+ b20wH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sgnlvJ+zqNL7jPjGmsh0KOHJ
17
+ 0dzPYnTeGcfyrp1AXNN3Z2jWlEInrnqvo376vOmejjTtmDVVlhPjITHQqLSXzRaQ
18
+ e3M8fbJ+nupobti6jpXCYvH86KtpaxF66mwaynfdjzxQAVycV/ilKtL+sHH8zxlg
19
+ vNiMFH5yLu/tlav4xh+HlYscWVdFQIvd7f/Uxa+Vip1Pi16wmhnrE15z/vDX921v
20
+ hukBRIoCEAuUgNVBh+L/C8aETzbf/77WU3Si/w==
21
21
  -----END CERTIFICATE-----
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,20 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-ssh-gateway
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamis Buck
8
8
  - Delano Mandelbaum
9
9
  - Miklós Fazekas
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain:
13
13
  - |
14
14
  -----BEGIN CERTIFICATE-----
15
- MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBBMQ8wDQYDVQQDDAZuZXRz
15
+ MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMQ8wDQYDVQQDDAZuZXRz
16
16
  c2gxGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZFgNj
17
- b20wHhcNMTYxMjE1MTgwNTIyWhcNMTcxMjE1MTgwNTIyWjBBMQ8wDQYDVQQDDAZu
17
+ b20wHhcNMjYwNTE2MTYyMDUzWhcNMjcwNTE2MTYyMDUzWjBBMQ8wDQYDVQQDDAZu
18
18
  ZXRzc2gxGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZ
19
19
  FgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGJ4TbZ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8aETzbf/77WU3Si/w==
34
34
  -----END CERTIFICATE-----
35
- date: 2017-01-26 00:00:00.000000000 Z
35
+ date: 2026-11-11 00:00:00.000000000 Z
36
36
  dependencies:
37
- - !ruby/object:Gem::Dependency
38
- name: bundler
39
- requirement: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - "~>"
42
- - !ruby/object:Gem::Version
43
- version: '1.10'
44
- type: :development
45
- prerelease: false
46
- version_requirements: !ruby/object:Gem::Requirement
47
- requirements:
48
- - - "~>"
49
- - !ruby/object:Gem::Version
50
- version: '1.10'
51
37
  - !ruby/object:Gem::Dependency
52
38
  name: rake
53
39
  requirement: !ruby/object:Gem::Requirement
54
40
  requirements:
55
- - - "~>"
41
+ - - ">="
56
42
  - !ruby/object:Gem::Version
57
- version: '10.0'
43
+ version: '12.0'
58
44
  type: :development
59
45
  prerelease: false
60
46
  version_requirements: !ruby/object:Gem::Requirement
61
47
  requirements:
62
- - - "~>"
48
+ - - ">="
63
49
  - !ruby/object:Gem::Version
64
- version: '10.0'
50
+ version: '12.0'
65
51
  - !ruby/object:Gem::Dependency
66
52
  name: minitest
67
53
  requirement: !ruby/object:Gem::Requirement
68
54
  requirements:
69
- - - "~>"
55
+ - - ">="
70
56
  - !ruby/object:Gem::Version
71
- version: 5.8.4
57
+ version: '5.10'
72
58
  type: :development
73
59
  prerelease: false
74
60
  version_requirements: !ruby/object:Gem::Requirement
75
61
  requirements:
76
- - - "~>"
62
+ - - ">="
77
63
  - !ruby/object:Gem::Version
78
- version: 5.8.4
64
+ version: '5.10'
79
65
  - !ruby/object:Gem::Dependency
80
66
  name: mocha
81
67
  requirement: !ruby/object:Gem::Requirement
82
68
  requirements:
83
69
  - - ">="
84
70
  - !ruby/object:Gem::Version
85
- version: 1.2.1
71
+ version: '1.4'
86
72
  type: :development
87
73
  prerelease: false
88
74
  version_requirements: !ruby/object:Gem::Requirement
89
75
  requirements:
90
76
  - - ">="
91
77
  - !ruby/object:Gem::Version
92
- version: 1.2.1
78
+ version: '1.4'
93
79
  - !ruby/object:Gem::Dependency
94
80
  name: net-ssh
95
81
  requirement: !ruby/object:Gem::Requirement
@@ -111,9 +97,8 @@ executables: []
111
97
  extensions: []
112
98
  extra_rdoc_files: []
113
99
  files:
100
+ - ".github/workflows/ci.yml"
114
101
  - ".gitignore"
115
- - ".ruby-version"
116
- - ".travis.yml"
117
102
  - CHANGES.txt
118
103
  - Gemfile
119
104
  - LICENSE.txt
@@ -127,7 +112,7 @@ homepage: https://github.com/net-ssh/net-ssh-gateway
127
112
  licenses:
128
113
  - MIT
129
114
  metadata: {}
130
- post_install_message:
115
+ post_install_message:
131
116
  rdoc_options: []
132
117
  require_paths:
133
118
  - lib
@@ -142,9 +127,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
127
  - !ruby/object:Gem::Version
143
128
  version: '0'
144
129
  requirements: []
145
- rubyforge_project:
146
- rubygems_version: 2.4.5
147
- signing_key:
130
+ rubygems_version: 3.3.3
131
+ signing_key:
148
132
  specification_version: 4
149
133
  summary: A simple library to assist in establishing tunneled Net::SSH connections
150
134
  test_files: []
metadata.gz.sig CHANGED
Binary file
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.2.0
data/.travis.yml DELETED
@@ -1,4 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.2
4
- before_install: gem install bundler -v 1.10.6