openvpn-status-web 3.2.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e284e2bfa9af607cc1dcf480aea291452236f17d46f651f1f4a46cbd3366815
4
- data.tar.gz: 44f59ccf0600b94e28d4be6562aea461543246509e146e60d19f9eaa9b78cdb3
3
+ metadata.gz: 43df4db93196fada6047a63bfa0862c769f0bdff920526b9e3bb7d2b79afb64a
4
+ data.tar.gz: b27c4d5ae1e0f708c46aa57696f5e1ce2ac8fc62a7890642dc19e888d237f277
5
5
  SHA512:
6
- metadata.gz: c2ecd99b9315c7762718f6a4c09e57eb7bd462bc567749df1b4f49098c8edb9f1d51bcd44baa80ebf4a2251902ddc0fb642a2b8168710ee8456301f86247c2a7
7
- data.tar.gz: 53769708ca5dddde0a667a20fde4a8453fc4e93bc4a0670872826f8848665e9b8272cdc2039ee67e05787de4d909ca7c8e0732137e37310601301abed4746383
6
+ metadata.gz: 4dac1602a2f5426fa5a7cbb38bf422da51ba32f37a53fed82e949144b9d06c22e0bfe6b2fb8831bf03f14502547b2ef3caef4d8bde359a9dde3202eaf377d778
7
+ data.tar.gz: b769a52aa4b5c835b3e0c01038f73285dca49d2ee6ad48362720d9a6393b7626a38b8733e55c5ee80e8051c203102c8f76e897968c971e90e944bdca3ab6815c
@@ -5,16 +5,18 @@ module OpenVPNStatusWeb
5
5
  class ModernStateless
6
6
  def self.parse_status_log(text, sep)
7
7
  status = Status.new
8
+ status.client_list_headers = []
8
9
  status.client_list = []
10
+ status.routing_table_headers = []
9
11
  status.routing_table = []
10
12
  status.global_stats = []
11
13
 
12
14
  text.lines.each do |line|
13
15
  parts = line.strip.split(sep)
14
- status.client_list_headers = parts[2..-1] if parts[0] == 'HEADER' && parts[1] == 'CLIENT_LIST'
15
- status.client_list << parse_client(parts[1..-1], status.client_list_headers) if parts[0] == 'CLIENT_LIST'
16
- status.routing_table_headers = parts[2..-1] if parts[0] == 'HEADER' && parts[1] == 'ROUTING_TABLE'
17
- status.routing_table << parse_route(parts[1..-1], status.routing_table_headers) if parts[0] == 'ROUTING_TABLE'
16
+ status.client_list_headers = parts[2..] if parts[0] == 'HEADER' && parts[1] == 'CLIENT_LIST'
17
+ status.client_list << parse_client(parts[1..], status.client_list_headers) if parts[0] == 'CLIENT_LIST'
18
+ status.routing_table_headers = parts[2..] if parts[0] == 'HEADER' && parts[1] == 'ROUTING_TABLE'
19
+ status.routing_table << parse_route(parts[1..], status.routing_table_headers) if parts[0] == 'ROUTING_TABLE'
18
20
  status.global_stats << parse_global(parts[1..2]) if parts[0] == 'GLOBAL_STATS'
19
21
  end
20
22
 
@@ -27,9 +27,9 @@ module OpenVPNStatusWeb
27
27
 
28
28
  status = Status.new
29
29
  status.client_list_headers = ['Common Name', 'Real Address', 'Data Received', 'Data Sent', 'Connected Since']
30
- status.client_list = client_list[2..-1].map { |client| parse_client(client) }
30
+ status.client_list = client_list[2..].map { |client| parse_client(client) }
31
31
  status.routing_table_headers = ['Virtual Address', 'Common Name', 'Real Address', 'Last Ref']
32
- status.routing_table = routing_table[1..-1].map { |route| parse_route(route) }
32
+ status.routing_table = routing_table[1..].map { |route| parse_route(route) }
33
33
  status.global_stats = global_stats.map { |global| parse_global(global) }
34
34
  status
35
35
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenVPNStatusWeb
4
- VERSION = '3.2.0'
4
+ VERSION = '3.3.0'
5
5
  end
@@ -7,9 +7,10 @@ require 'logger'
7
7
  require 'ipaddr'
8
8
  require 'yaml'
9
9
  require 'rack'
10
+ require 'rackup'
10
11
  require 'erb'
11
12
  require 'metriks'
12
- require 'better_errors' if ENV['RACK_ENV'] == 'development'
13
+ require 'better_errors' if ENV.fetch('RACK_ENV', nil) == 'development'
13
14
 
14
15
  require 'openvpn-status-web/status'
15
16
  require 'openvpn-status-web/parser/v1'
@@ -128,21 +129,21 @@ module OpenVPNStatusWeb
128
129
 
129
130
  # configure rack
130
131
  app = Daemon.new(config['vpns'])
131
- if ENV['RACK_ENV'] == 'development'
132
+ if ENV.fetch('RACK_ENV', nil) == 'development'
132
133
  app = BetterErrors::Middleware.new(app)
133
134
  BetterErrors.application_root = File.expand_path(__dir__)
134
135
  end
135
136
 
136
137
  Signal.trap('INT') do
137
138
  OpenVPNStatusWeb.logger.info 'Quitting...'
138
- Rack::Handler::WEBrick.shutdown
139
+ Rackup::Handler::WEBrick.shutdown
139
140
  end
140
141
  Signal.trap('TERM') do
141
142
  OpenVPNStatusWeb.logger.info 'Quitting...'
142
- Rack::Handler::WEBrick.shutdown
143
+ Rackup::Handler::WEBrick.shutdown
143
144
  end
144
145
 
145
- Rack::Handler::WEBrick.run app, Host: config['host'], Port: config['port']
146
+ Rackup::Handler::WEBrick.run app, Host: config['host'], Port: config['port']
146
147
  end
147
148
  end
148
149
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openvpn-status-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Nicolai
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-18 00:00:00.000000000 Z
11
+ date: 2022-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metriks
@@ -30,14 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: '3.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.0'
40
+ version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rackup
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: webrick
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +170,14 @@ dependencies:
156
170
  requirements:
157
171
  - - "~>"
158
172
  - !ruby/object:Gem::Version
159
- version: 1.24.0
173
+ version: 1.36.0
160
174
  type: :development
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
178
  - - "~>"
165
179
  - !ruby/object:Gem::Version
166
- version: 1.24.0
180
+ version: 1.36.0
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: rubocop-rake
169
183
  requirement: !ruby/object:Gem::Requirement
@@ -184,28 +198,28 @@ dependencies:
184
198
  requirements:
185
199
  - - "~>"
186
200
  - !ruby/object:Gem::Version
187
- version: 2.7.0
201
+ version: 2.13.1
188
202
  type: :development
189
203
  prerelease: false
190
204
  version_requirements: !ruby/object:Gem::Requirement
191
205
  requirements:
192
206
  - - "~>"
193
207
  - !ruby/object:Gem::Version
194
- version: 2.7.0
208
+ version: 2.13.1
195
209
  - !ruby/object:Gem::Dependency
196
210
  name: solargraph
197
211
  requirement: !ruby/object:Gem::Requirement
198
212
  requirements:
199
213
  - - "~>"
200
214
  - !ruby/object:Gem::Version
201
- version: 0.44.0
215
+ version: 0.46.0
202
216
  type: :development
203
217
  prerelease: false
204
218
  version_requirements: !ruby/object:Gem::Requirement
205
219
  requirements:
206
220
  - - "~>"
207
221
  - !ruby/object:Gem::Version
208
- version: 0.44.0
222
+ version: 0.46.0
209
223
  description: Small Rack (Ruby) application serving OpenVPN status file.
210
224
  email:
211
225
  executables:
@@ -241,14 +255,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
241
255
  requirements:
242
256
  - - ">="
243
257
  - !ruby/object:Gem::Version
244
- version: '2.5'
258
+ version: '2.7'
245
259
  required_rubygems_version: !ruby/object:Gem::Requirement
246
260
  requirements:
247
261
  - - ">="
248
262
  - !ruby/object:Gem::Version
249
263
  version: '0'
250
264
  requirements: []
251
- rubygems_version: 3.2.32
265
+ rubygems_version: 3.3.7
252
266
  signing_key:
253
267
  specification_version: 4
254
268
  summary: openvpn-status-web