Class: System::OpenvpnStatusLogReader

Inherits:
Object
  • Object
show all
Defined in:
lib/system/openvpn_status_log_reader.rb

Constant Summary collapse

LOGFILE_PATH =
'/etc/openvpn/openvpn-status.log'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOpenvpnStatusLogReader

Returns a new instance of OpenvpnStatusLogReader.



14
15
16
# File 'lib/system/openvpn_status_log_reader.rb', line 14

def initialize
  read_logfile
end

Instance Attribute Details

#log_contentObject

Returns the value of attribute log_content.



5
6
7
# File 'lib/system/openvpn_status_log_reader.rb', line 5

def log_content
  @log_content
end

Class Method Details

.vpn_ip(common_name) ⇒ Object



8
9
10
11
# File 'lib/system/openvpn_status_log_reader.rb', line 8

def vpn_ip(common_name)
  reader = new
  reader.vpn_ip_for common_name
end

Instance Method Details

#vpn_ip_for(common_name) ⇒ Object



18
19
20
21
# File 'lib/system/openvpn_status_log_reader.rb', line 18

def vpn_ip_for(common_name)
  status = System::OpenvpnStatusLogParser.new(log_content).status
  status.clients_list[common_name]
end