Class: Dcmgr::VNet::Tasks::StaticNatLog

Inherits:
Dcmgr::VNet::Task show all
Includes:
Netfilter
Defined in:
lib/dcmgr/vnet/tasks/static_nat.rb

Instance Attribute Summary collapse

Attributes inherited from Dcmgr::VNet::Task

#rules

Instance Method Summary collapse

Constructor Details

#initialize(inside_ip, outside_ip, snat_log_prefix = "", dnat_log_prefix = "") ⇒ StaticNatLog

Returns a new instance of StaticNatLog.



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/dcmgr/vnet/tasks/static_nat.rb', line 14

def initialize(inside_ip,outside_ip,snat_log_prefix = "",dnat_log_prefix = "")
  super()
  
  self.inside_ip = inside_ip
  self.outside_ip = outside_ip
  self.snat_log_prefix = snat_log_prefix
  self.dnat_log_prefix = dnat_log_prefix
  
  self.rules = []
  self.rules << IptablesRule.new(:nat,:prerouting,nil,:incoming,"-d #{self.outside_ip} -j LOG --log-prefix '#{self.dnat_log_prefix}'")
  self.rules << IptablesRule.new(:nat,:postrouting,nil,:outgoing,"-s #{self.inside_ip} -j LOG --log-prefix '#{self.snat_log_prefix}'")
end

Instance Attribute Details

#dnat_log_prefixObject

Returns the value of attribute dnat_log_prefix.



12
13
14
# File 'lib/dcmgr/vnet/tasks/static_nat.rb', line 12

def dnat_log_prefix
  @dnat_log_prefix
end

#inside_ipObject

Returns the value of attribute inside_ip.



9
10
11
# File 'lib/dcmgr/vnet/tasks/static_nat.rb', line 9

def inside_ip
  @inside_ip
end

#outside_ipObject

Returns the value of attribute outside_ip.



10
11
12
# File 'lib/dcmgr/vnet/tasks/static_nat.rb', line 10

def outside_ip
  @outside_ip
end

#snat_log_prefixObject

Returns the value of attribute snat_log_prefix.



11
12
13
# File 'lib/dcmgr/vnet/tasks/static_nat.rb', line 11

def snat_log_prefix
  @snat_log_prefix
end