openvpn-status-web 3.0.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/openvpn-status-web/main.html.erb +50 -18
- data/lib/openvpn-status-web/parser/modern_stateless.rb +23 -8
- data/lib/openvpn-status-web/parser/v1.rb +2 -0
- data/lib/openvpn-status-web/status.rb +2 -0
- data/lib/openvpn-status-web/version.rb +1 -1
- data/lib/openvpn-status-web.rb +1 -1
- metadata +53 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed1ab5c8bba8d386ca3f0e0f510a08983736a3824bec903d58022febe0fd4192
|
4
|
+
data.tar.gz: 6f8499f9bea2da379cb9b6fd9505cdc285c227d93b3ea0edb099753e5cd4023f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f0d1ca61055f892765b66a59fb75e5675c63dceccc0c1a473aaebfa23b7aed8c1e24ee6fd05bf4e285fea7158977b1ce2902e0ff6c771131bbd9ccee1021aa8
|
7
|
+
data.tar.gz: df069649086305a98fa28e935504a18cb37ca561b94090ab169d67db9340cacfe1dca1b6c2ef79870af8603837a9ab3a5c2f0902f361fcfb2d2697592a50ced8
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# openvpn-status-web
|
2
2
|
|
3
|
-
|
3
|
+
![ci](https://github.com/cmur2/openvpn-status-web/workflows/ci/badge.svg) [![Depfu](https://badges.depfu.com/badges/c264e2f70f2a19c43f880ddcb4a12ba8/overview.svg)](https://depfu.com/github/cmur2/openvpn-status-web?project_id=6194)
|
4
4
|
|
5
5
|
## Description
|
6
6
|
|
@@ -50,20 +50,36 @@ thead {
|
|
50
50
|
<div>
|
51
51
|
<table>
|
52
52
|
<thead>
|
53
|
-
|
54
|
-
|
55
|
-
<td class="
|
56
|
-
|
57
|
-
<td class="last">
|
53
|
+
<% status.client_list_headers.each_with_index do |header,i| %>
|
54
|
+
<% if i == 0 %>
|
55
|
+
<td class="first">
|
56
|
+
<% elsif i == status.client_list_headers.size-1 %>
|
57
|
+
<td class="last">
|
58
|
+
<% else %>
|
59
|
+
<td class="middle">
|
60
|
+
<% end %>
|
61
|
+
<%= header %></td>
|
62
|
+
<% end %>
|
58
63
|
</thead>
|
59
64
|
<tbody>
|
60
65
|
<% status.client_list.each do |client| %>
|
61
66
|
<tr>
|
62
|
-
|
63
|
-
|
64
|
-
<td class="
|
65
|
-
|
66
|
-
<td class="last"
|
67
|
+
<% status.client_list_headers.each_with_index do |header,i| %>
|
68
|
+
<% if i == 0 %>
|
69
|
+
<td class="first">
|
70
|
+
<% elsif i == status.client_list_headers.size-1 %>
|
71
|
+
<td class="last">
|
72
|
+
<% else %>
|
73
|
+
<td class="middle">
|
74
|
+
<% end %>
|
75
|
+
<% if header =~ /(Received|Sent)/ %>
|
76
|
+
<%= client[i].as_bytes %></td>
|
77
|
+
<% elsif client[i].is_a? DateTime %>
|
78
|
+
<%= client[i].strftime('%-d.%-m.%Y %H:%M:%S') %></td>
|
79
|
+
<% else %>
|
80
|
+
<%= client[i] %></td>
|
81
|
+
<% end %>
|
82
|
+
<% end %>
|
67
83
|
</tr>
|
68
84
|
<% end %>
|
69
85
|
</tbody>
|
@@ -74,18 +90,34 @@ thead {
|
|
74
90
|
<div>
|
75
91
|
<table>
|
76
92
|
<thead>
|
77
|
-
|
78
|
-
|
79
|
-
<td class="
|
80
|
-
|
93
|
+
<% status.routing_table_headers.each_with_index do |header,i| %>
|
94
|
+
<% if i == 0 %>
|
95
|
+
<td class="first">
|
96
|
+
<% elsif i == status.routing_table_headers.size-1 %>
|
97
|
+
<td class="last">
|
98
|
+
<% else %>
|
99
|
+
<td class="middle">
|
100
|
+
<% end %>
|
101
|
+
<%= header %></td>
|
102
|
+
<% end %>
|
81
103
|
</thead>
|
82
104
|
<tbody>
|
83
105
|
<% status.routing_table.each do |route| %>
|
84
106
|
<tr>
|
85
|
-
|
86
|
-
|
87
|
-
<td class="
|
88
|
-
|
107
|
+
<% status.routing_table_headers.each_with_index do |header,i| %>
|
108
|
+
<% if i == 0 %>
|
109
|
+
<td class="first">
|
110
|
+
<% elsif i == status.routing_table_headers.size-1 %>
|
111
|
+
<td class="last">
|
112
|
+
<% else %>
|
113
|
+
<td class="middle">
|
114
|
+
<% end %>
|
115
|
+
<% if route[i].is_a? DateTime %>
|
116
|
+
<%= route[i].strftime('%-d.%-m.%Y %H:%M:%S') %></td>
|
117
|
+
<% else %>
|
118
|
+
<%= route[i] %></td>
|
119
|
+
<% end %>
|
120
|
+
<% end %>
|
89
121
|
</tr>
|
90
122
|
<% end %>
|
91
123
|
</tbody>
|
@@ -5,29 +5,38 @@ 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.
|
15
|
-
status.
|
16
|
+
status.client_list_headers = parts[2..-1] if parts[0] == 'HEADER' && parts[1] == 'CLIENT_LIST'
|
17
|
+
status.client_list << parse_client(parts[1..-1], status.client_list_headers) if parts[0] == 'CLIENT_LIST'
|
18
|
+
status.routing_table_headers = parts[2..-1] if parts[0] == 'HEADER' && parts[1] == 'ROUTING_TABLE'
|
19
|
+
status.routing_table << parse_route(parts[1..-1], status.routing_table_headers) if parts[0] == 'ROUTING_TABLE'
|
16
20
|
status.global_stats << parse_global(parts[1..2]) if parts[0] == 'GLOBAL_STATS'
|
17
21
|
end
|
18
22
|
|
19
23
|
status
|
20
24
|
end
|
21
25
|
|
22
|
-
private_class_method def self.parse_client(client)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
+
private_class_method def self.parse_client(client, headers)
|
27
|
+
headers.each_with_index do |header, i|
|
28
|
+
client[i] = parse_date(client[i]) if header.end_with?('Since')
|
29
|
+
client[i] = client[i].to_i if header.start_with?('Bytes')
|
30
|
+
end
|
31
|
+
|
26
32
|
client
|
27
33
|
end
|
28
34
|
|
29
|
-
private_class_method def self.parse_route(route)
|
30
|
-
|
35
|
+
private_class_method def self.parse_route(route, headers)
|
36
|
+
headers.each_with_index do |header, i|
|
37
|
+
route[i] = parse_date(route[i]) if header.end_with?('Last Ref')
|
38
|
+
end
|
39
|
+
|
31
40
|
route
|
32
41
|
end
|
33
42
|
|
@@ -35,6 +44,12 @@ module OpenVPNStatusWeb
|
|
35
44
|
global[1] = global[1].to_i
|
36
45
|
global
|
37
46
|
end
|
47
|
+
|
48
|
+
private_class_method def self.parse_date(date_string)
|
49
|
+
DateTime.strptime(date_string, '%a %b %d %k:%M:%S %Y')
|
50
|
+
rescue ArgumentError
|
51
|
+
DateTime.strptime(date_string, '%Y-%m-%d %k:%M:%S')
|
52
|
+
end
|
38
53
|
end
|
39
54
|
end
|
40
55
|
end
|
@@ -26,7 +26,9 @@ module OpenVPNStatusWeb
|
|
26
26
|
end
|
27
27
|
|
28
28
|
status = Status.new
|
29
|
+
status.client_list_headers = ['Common Name', 'Real Address', 'Data Received', 'Data Sent', 'Connected Since']
|
29
30
|
status.client_list = client_list[2..-1].map { |client| parse_client(client) }
|
31
|
+
status.routing_table_headers = ['Virtual Address', 'Common Name', 'Real Address', 'Last Ref']
|
30
32
|
status.routing_table = routing_table[1..-1].map { |route| parse_route(route) }
|
31
33
|
status.global_stats = global_stats.map { |global| parse_global(global) }
|
32
34
|
status
|
data/lib/openvpn-status-web.rb
CHANGED
@@ -107,7 +107,7 @@ module OpenVPNStatusWeb
|
|
107
107
|
if config['logfile']
|
108
108
|
OpenVPNStatusWeb.logger = Logger.new(config['logfile'])
|
109
109
|
else
|
110
|
-
OpenVPNStatusWeb.logger = Logger.new(
|
110
|
+
OpenVPNStatusWeb.logger = Logger.new($stdout)
|
111
111
|
end
|
112
112
|
|
113
113
|
OpenVPNStatusWeb.logger.progname = 'openvpn-status-web'
|
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.
|
4
|
+
version: 3.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Nicolai
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metriks
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: webrick
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.6.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.6.1
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: better_errors
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +100,14 @@ dependencies:
|
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
103
|
+
version: 0.9.0
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
110
|
+
version: 0.9.0
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rack-test
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,28 +156,56 @@ dependencies:
|
|
142
156
|
requirements:
|
143
157
|
- - "~>"
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
159
|
+
version: 1.24.0
|
146
160
|
type: :development
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
164
|
- - "~>"
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
166
|
+
version: 1.24.0
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rubocop-rake
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 0.6.0
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 0.6.0
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: rubocop-rspec
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 2.7.0
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 2.7.0
|
153
195
|
- !ruby/object:Gem::Dependency
|
154
196
|
name: solargraph
|
155
197
|
requirement: !ruby/object:Gem::Requirement
|
156
198
|
requirements:
|
157
|
-
- - "
|
199
|
+
- - "~>"
|
158
200
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
201
|
+
version: 0.44.0
|
160
202
|
type: :development
|
161
203
|
prerelease: false
|
162
204
|
version_requirements: !ruby/object:Gem::Requirement
|
163
205
|
requirements:
|
164
|
-
- - "
|
206
|
+
- - "~>"
|
165
207
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
208
|
+
version: 0.44.0
|
167
209
|
description: Small Rack (Ruby) application serving OpenVPN status file.
|
168
210
|
email:
|
169
211
|
executables:
|
@@ -206,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
248
|
- !ruby/object:Gem::Version
|
207
249
|
version: '0'
|
208
250
|
requirements: []
|
209
|
-
rubygems_version: 3.
|
251
|
+
rubygems_version: 3.2.32
|
210
252
|
signing_key:
|
211
253
|
specification_version: 4
|
212
254
|
summary: openvpn-status-web
|