Class: Panopticon::Daemon

Inherits:
Object
  • Object
show all
Defined in:
lib/panopticon/command/panopticond.rb

Constant Summary collapse

DEFAULT_CONFIG_PATH =
"/etc/panopticon.conf"
DEFAULT_API_PORT =
8080
DEFAULT_IFNAME =
"wlan0"
DEFAULT_CAPTURE_PATH =
"/cap"
DEFAULT_LOG_FILE =
"/var/log/panopticond.log"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arg = {}) ⇒ Daemon

Returns a new instance of Daemon.



30
31
32
33
34
35
36
# File 'lib/panopticon/command/panopticond.rb', line 30

def initialize arg={}
  @arg = arg

  @config_file = arg[:config_file]

  @arg = read_config(@config_file)
end

Class Method Details

.default_optionsObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/panopticon/command/panopticond.rb', line 13

def self.default_options
  {
    # config file (exclusive)
    :config_file => DEFAULT_CONFIG_PATH,

    # daemon parameters
    :port => DEFAULT_API_PORT,

    # capture parameters
    :ifname => DEFAULT_IFNAME,
    :capture_path => DEFAULT_CAPTURE_PATH,

    # log
    :log_file => DEFAULT_LOG_FILE,
  }
end

Instance Method Details

#read_config(path) ⇒ Object



42
43
44
45
# File 'lib/panopticon/command/panopticond.rb', line 42

def read_config path
  # notimp
  @arg
end

#runObject



38
39
40
# File 'lib/panopticon/command/panopticond.rb', line 38

def run
  Panopticon::APIServer.run!(@arg)
end