etunnel 1.6.8 → 1.6.12

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/etunnel.rb +8 -4
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7038b340c5731a62ba3f241b54201d982ba09fe9da34c38285cb419cb39cf65
4
- data.tar.gz: 58bd384e529a3a9b2abcc44d3b3fc2914a10d1b8f827cac0fc3e594ae1754e44
3
+ metadata.gz: 163a93ebcc0351fbeddeaae26a8bf30fe8ce678a5e43b11e5be06504126c4942
4
+ data.tar.gz: 9f30d7e903103959c34c35078a19f791a6e798bf240fe2f01612d3544c905939
5
5
  SHA512:
6
- metadata.gz: d1b6181c1edbefd657110c4e23497e403f4a53629a9fda2384fd1945cb52eb6d9906c6efcf21fd072c6d44883c63cfc8906484a0b0cb579bbecf182a28429c8c
7
- data.tar.gz: 0c32aca0517d3cf5c365053a52c4a41309a82e33e5373dc41b1fd15f6cb6c91cca560c3b5a53dd2714a782ae72d6c7b1e856e4e6535ef4a3fe726375f62ceb39
6
+ metadata.gz: c7787ed15245dd3123b2f0b1da3b494c4db90f133444f90dd7805e7ff24998f8b20c93d143fdd3f98b28979d0035957e61582f8ba1ccbf7727251bfe4199d3e4
7
+ data.tar.gz: d8d101a8c89071124e0a39ecb1ac2a4e8bce21b6b4ae83956b6492c7a338baf23004ab866f1268b27e9d3a6623e8be4f5df1d5a1e62c775b35fc2326b1dff05d
data/lib/etunnel.rb CHANGED
@@ -276,15 +276,14 @@ def Etunnel.main(argv = ARGV)
276
276
  nap.call(delay)
277
277
  end
278
278
  end
279
- Etunnel.main if $PROGRAM_NAME == __FILE__
280
279
 
281
- # --- CLI loopback login (RFC 8252 style; server /auth/cli/* endpoints) ---
280
+ # --- CLI loopback login (RFC 8252 style; server /auth/cli/* endpoints) ---
282
281
  # creds = Etunnel.login('https://t.etun.uk') # opens the browser
283
282
  # # -> { 'api_token' => ..., 'subdomains' => [...], 'plan' => ..., 'expires_at' => 0 }
284
283
  # Binds a random 127.0.0.1 port, waits for the one-time code on /callback
285
284
  # (10-minute budget), exchanges it. Persist the result and pass api_token
286
285
  # as token: on future Etunnel.connect calls.
287
- def self.login(server, open_browser: nil, timeout: 600)
286
+ def Etunnel.login(server, open_browser: nil, timeout: 600)
288
287
  require 'socket'
289
288
  require 'net/http'
290
289
  require 'json'
@@ -320,7 +319,9 @@ Etunnel.main if $PROGRAM_NAME == __FILE__
320
319
  end
321
320
  $stderr.puts "etunnel: authorize in your browser: #{start['auth_url']}" unless opened
322
321
 
323
- code = th.value(timeout)
322
+ th.join(timeout)
323
+ raise 'etunnel: login timed out' if th.alive?
324
+ code = th.value
324
325
  server_sock.close
325
326
  raise 'etunnel: login: callback without code' if code.empty?
326
327
 
@@ -329,3 +330,6 @@ Etunnel.main if $PROGRAM_NAME == __FILE__
329
330
  raise 'etunnel: login: no api_token in exchange response' if creds['api_token'].to_s.empty?
330
331
  creds
331
332
  end
333
+
334
+ Etunnel.main if $PROGRAM_NAME == __FILE__
335
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: etunnel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.8
4
+ version: 1.6.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - etunnel authors
@@ -51,11 +51,11 @@ files:
51
51
  - README.md
52
52
  - bin/etunnel
53
53
  - lib/etunnel.rb
54
- homepage: https://github.com/ggcode/etunnel
54
+ homepage: https://github.com/topcheer/etunnel
55
55
  licenses:
56
56
  - MIT
57
57
  metadata:
58
- source_code_uri: https://github.com/ggcode/etunnel
58
+ source_code_uri: https://github.com/topcheer/etunnel
59
59
  post_install_message:
60
60
  rdoc_options: []
61
61
  require_paths: