etunnel 1.4.0 → 1.6.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -0
  3. data/lib/etunnel.rb +24 -18
  4. metadata +5 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e568f78c67dff90b456f942acb314a7684ef065267c492dd141c0659f7dd5cd0
4
- data.tar.gz: 6c9402e9a878c97f356caa617ebc59fcab900972001a14384259b0647c49d8a8
3
+ metadata.gz: 2cd86ae02b1c6102d8c4a645fb0a02222241c3645d25bdaa6ac6210c5441cc0c
4
+ data.tar.gz: 2b0a936c7ddcf37103a6180afac8a03867a95b3cbd77683c6776f0e800a872a7
5
5
  SHA512:
6
- metadata.gz: e5d9d732bfe624b88a02ae4c6a5637a9b1dbc0fe56ba69ee21f84524c8e90ea8f133452e165d113e6bd67ed8f045209dc73fa233a96e0d7812c802101f94a669
7
- data.tar.gz: c3703b6b39a3a378675f9d205822697d3d79d6a91b6eb14fb0c1bbe141d2627a28353e6fcb28b77a0f0da71801350141a2defeeec9e5334fda539890e04fb4f2
6
+ metadata.gz: ff6acf55f80ac16d0680d007184db91bbce128d6f65756f20b437dac7a7b28cba3b0d9b6bf77b693bdce31fda7126893cf3475a38880d956961649e2b6cbffe8
7
+ data.tar.gz: 4cf71ab315e9a04e683fa8de397a741c194c3b6e62199f03aabea5eb9199fbc73d4806f7250cefe1dd6592dc1c68ae72eb3803ef32e73f6384122e58450f29a6
data/README.md CHANGED
@@ -56,3 +56,9 @@ puts t.url
56
56
  MIT — see [LICENSE](../../LICENSE). Buffer-based protocol client: request and
57
57
  response bodies are buffered per stream (fine for webhooks/dashboards/demos;
58
58
  use the [Go SDK](../../sdk) for streaming and WebSocket pass-through).
59
+
60
+ ## Service terms
61
+
62
+ Use of the etunnel relay service (default `wss://t.etun.uk/tunnel`) is governed
63
+ by its [Terms of Service](https://t.etun.uk/terms) and
64
+ [Privacy Policy](https://t.etun.uk/privacy).
data/lib/etunnel.rb CHANGED
@@ -16,9 +16,9 @@ require 'net/http'
16
16
  begin
17
17
  require 'eventmachine'
18
18
  require 'faye/websocket'
19
- rescue LoadError
20
- warn 'etunnel: gem install faye-websocket'
21
- exit 1
19
+ rescue LoadError => e
20
+ # Library code must not kill the host process; surface the failure instead.
21
+ raise LoadError, "etunnel: gem install faye-websocket (#{e.message})"
22
22
  end
23
23
 
24
24
  # faye-websocket needs a running EventMachine reactor.
@@ -109,7 +109,14 @@ module Etunnel
109
109
  when 0x01 then st[:body] << data
110
110
  when 0x02
111
111
  streams.delete(sid)
112
- serve(ws, st[:req], st[:body], sid, local)
112
+ # One worker thread per request (same shape as the perl SDK): a slow
113
+ # local app must not block this reader loop, or server pings go
114
+ # unanswered while a request is in flight and the tunnel gets kicked.
115
+ Thread.new do
116
+ serve(ws, st[:req], st[:body], sid, local)
117
+ rescue StandardError => e
118
+ warn "etunnel: request worker failed: #{e}"
119
+ end
113
120
  when 0x03 then streams.delete(sid)
114
121
  end
115
122
  end
@@ -176,21 +183,20 @@ module Etunnel
176
183
  path = req['path'] || '/'
177
184
  headers = (req['headers'] || {}).reject { |k, _| HOP.include?(k.downcase) }
178
185
 
179
- out = Thread.new do
180
- begin
181
- http = Net::HTTP.new(host, port.to_i)
182
- http.open_timeout = 10
183
- klass = Net::HTTP.const_get(method.capitalize)
184
- r = klass.new(path, headers.to_h { |k, v| [k, Array(v).first] })
185
- r.body = body unless method == 'GET' || method == 'HEAD'
186
- resp = http.request(r)
187
- [resp.code.to_i, resp.each_header.reject { |k, _| HOP.include?(k) }.to_h, resp.body || '']
188
- rescue StandardError => e
189
- [502, { 'Content-Type' => 'text/html; charset=utf-8' }, local_error_page(e)]
190
- end
191
- end.value
186
+ # Runs on its own worker thread (see the reader loop); no inner
187
+ # Thread.new{}.value needed - that would just re-block the caller.
188
+ status, headers, payload = begin
189
+ http = Net::HTTP.new(host, port.to_i)
190
+ http.open_timeout = 10
191
+ klass = Net::HTTP.const_get(method.capitalize)
192
+ r = klass.new(path, headers.to_h { |k, v| [k, Array(v).first] })
193
+ r.body = body unless method == 'GET' || method == 'HEAD'
194
+ resp = http.request(r)
195
+ [resp.code.to_i, resp.each_header.reject { |k, _| HOP.include?(k) }.to_h, resp.body || '']
196
+ rescue StandardError => e
197
+ [502, { 'Content-Type' => 'text/html; charset=utf-8' }, local_error_page(e)]
198
+ end
192
199
 
193
- status, headers, payload = out
194
200
  ws.send(JSON.generate({ type: 'res', streamId: sid, status: status,
195
201
  headers: headers.to_h { |k, v| [k, [v]] } }))
196
202
  payload = payload.b
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: etunnel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - etunnel authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-10 00:00:00.000000000 Z
11
+ date: 2026-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faye-websocket
@@ -38,7 +38,9 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '13.0'
41
- description: "#{LONG} "
41
+ description: 'Expose local services to the internet in one line of code: instant public
42
+ HTTPS URLs with automatic TLS, through NAT and firewalls, no signup. Buffer-based
43
+ protocol client using faye-websocket.'
42
44
  email:
43
45
  executables:
44
46
  - etunnel