etunnel 1.3.0 → 1.4.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 +45 -1
- 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: e568f78c67dff90b456f942acb314a7684ef065267c492dd141c0659f7dd5cd0
|
|
4
|
+
data.tar.gz: 6c9402e9a878c97f356caa617ebc59fcab900972001a14384259b0647c49d8a8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e5d9d732bfe624b88a02ae4c6a5637a9b1dbc0fe56ba69ee21f84524c8e90ea8f133452e165d113e6bd67ed8f045209dc73fa233a96e0d7812c802101f94a669
|
|
7
|
+
data.tar.gz: c3703b6b39a3a378675f9d205822697d3d79d6a91b6eb14fb0c1bbe141d2627a28353e6fcb28b77a0f0da71801350141a2defeeec9e5334fda539890e04fb4f2
|
data/lib/etunnel.rb
CHANGED
|
@@ -126,6 +126,50 @@ module Etunnel
|
|
|
126
126
|
tunnel
|
|
127
127
|
end
|
|
128
128
|
|
|
129
|
+
# Themed 502 page shown when the local app is down (same HTML as the other SDKs).
|
|
130
|
+
def self.local_error_page(error)
|
|
131
|
+
esc = error.to_s.gsub('&', '&').gsub('<', '<').gsub('>', '>')
|
|
132
|
+
<<~HTML
|
|
133
|
+
<!doctype html><html><head><meta charset="utf-8">
|
|
134
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
135
|
+
<title>502 - local app down</title>
|
|
136
|
+
<style>
|
|
137
|
+
:root{--bg:#0b0e14;--panel:#0d1117;--line:#21262d;--fg:#e6edf3;--dim:#8b949e;--green:#3fb950}
|
|
138
|
+
*{box-sizing:border-box;margin:0;padding:0}
|
|
139
|
+
body{font-family:ui-monospace,'SF Mono',Menlo,Consolas,monospace;background:var(--bg);color:var(--fg);
|
|
140
|
+
display:flex;min-height:100vh;align-items:center;justify-content:center;line-height:1.6}
|
|
141
|
+
main{max-width:600px;padding:2.5rem 1.5rem;width:100%}
|
|
142
|
+
.badge{display:inline-block;border:1px solid rgba(248,81,73,.4);color:#f85149;border-radius:99px;
|
|
143
|
+
padding:.2rem .8rem;font-size:.72rem;letter-spacing:.08em;text-transform:uppercase;margin-bottom:1.1rem}
|
|
144
|
+
h1{font-size:1.6rem;letter-spacing:-.01em;margin-bottom:.4rem}
|
|
145
|
+
h1 .g{color:var(--green)}
|
|
146
|
+
p{color:var(--dim);font-size:.9rem;margin-bottom:1.4rem}
|
|
147
|
+
.panel{background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:1.1rem 1.3rem;margin-bottom:1.1rem}
|
|
148
|
+
.panel .k{color:var(--dim);font-size:.72rem;text-transform:uppercase;letter-spacing:.08em;margin-bottom:.3rem}
|
|
149
|
+
.panel .v{font-size:.9rem;word-break:break-all}
|
|
150
|
+
.err{color:#f85149}
|
|
151
|
+
.tip{border-left:3px solid var(--green);padding:.8rem 1rem;margin-top:1.2rem;font-size:.82rem;color:var(--dim)}
|
|
152
|
+
.tip b{color:var(--fg)}
|
|
153
|
+
footer{margin-top:2rem;font-size:.75rem;color:var(--dim)}
|
|
154
|
+
footer a{color:#58a6ff;text-decoration:none}
|
|
155
|
+
.pulse{display:inline-block;width:.55em;height:.55em;border-radius:50%;background:var(--green);
|
|
156
|
+
margin-right:.5em;animation:p 1.2s ease-in-out infinite}
|
|
157
|
+
@keyframes p{0%,100%{opacity:1}50%{opacity:.25}}
|
|
158
|
+
@media(prefers-reduced-motion:reduce){.pulse{animation:none}}
|
|
159
|
+
</style></head><body><main>
|
|
160
|
+
<span class="badge">502 local app down</span>
|
|
161
|
+
<h1>tunnel up, <span class="g">local app</span> is not</h1>
|
|
162
|
+
<p>The tunnel connection is alive, but nothing answered when we knocked.</p>
|
|
163
|
+
<div class="panel">
|
|
164
|
+
<div class="k">error</div><div class="v err">#{esc}</div>
|
|
165
|
+
</div>
|
|
166
|
+
<div class="tip"><span class="pulse"></span><b>Fix:</b> start your local service and reload -
|
|
167
|
+
the tunnel stays connected and keeps retrying for you.</div>
|
|
168
|
+
<footer>powered by <a href="https://github.com/topcheer/etunnel">etunnel</a></footer>
|
|
169
|
+
</main></body></html>
|
|
170
|
+
HTML
|
|
171
|
+
end
|
|
172
|
+
|
|
129
173
|
def self.serve(ws, req, body, sid, local)
|
|
130
174
|
host, port = local.split(':')
|
|
131
175
|
method = req['method'] || 'GET'
|
|
@@ -142,7 +186,7 @@ module Etunnel
|
|
|
142
186
|
resp = http.request(r)
|
|
143
187
|
[resp.code.to_i, resp.each_header.reject { |k, _| HOP.include?(k) }.to_h, resp.body || '']
|
|
144
188
|
rescue StandardError => e
|
|
145
|
-
[502, { 'Content-Type' => 'text/
|
|
189
|
+
[502, { 'Content-Type' => 'text/html; charset=utf-8' }, local_error_page(e)]
|
|
146
190
|
end
|
|
147
191
|
end.value
|
|
148
192
|
|
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.4.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-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faye-websocket
|