1
0
mirror of https://github.com/cmur2/openvpn-status-web.git synced 2025-06-29 10:30:23 +02:00

Add support for multiple status-versions

This commit is contained in:
cn
2013-05-03 20:09:46 +02:00
parent ed42fc9f30
commit 33013c56f3
2 changed files with 37 additions and 5 deletions

View File

@ -0,0 +1,25 @@
module OpenVPNStatusWeb
module Parser
class V2
def parse_status_log(text)
client_list = []
routing_table = []
global_stats = []
text.lines.each do |line|
parts = line.strip.split(',')
client_list << parts[1..5] if parts[0] == "CLIENT_LIST"
routing_table << parts[1..4] if parts[0] == "ROUTING_TABLE"
global_stats << parts[1..2] if parts[0] == "GLOBAL_STATS"
end
status = Status.new
status.client_list = client_list
status.routing_table = routing_table
status.global_stats = global_stats
status
end
end
end
end