etunnel 1.4.0 → 1.5.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/lib/etunnel.rb +24 -18
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7cbb73c138a785e1bef521843b126b01a221e1d5bfd16768e094c3d3bd47ecc5
|
|
4
|
+
data.tar.gz: 8b24bfd2f4990c9811d88f40acfa3d667139eabf0bc5408cb3075161507602f1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 72a12096991cc3c3169972c57c16a1a24a94c3983f2a78dc69dd355b20a758ce405dd64fb7485d22b7965c88144154b48bccbf77cb299208cfdadc4d0ff8754c
|
|
7
|
+
data.tar.gz: 1c1e7fa8615295aa4401b4902809ed4104269e0755a8d1d06d0066a4ba219c62d824ca6ad399b777a6d959f74a8439d8c675ecfdf9ce644804dae313d1acc24a
|
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
|
-
|
|
21
|
-
|
|
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
|
-
|
|
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
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
end
|
|
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
|
+
version: 1.5.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-
|
|
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:
|
|
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
|