Class: Dcmgr::VNet::Tasks::AcceptIpFromFriends

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

Overview

Explicitely allows IP traffic between “friend” instances Friends are determined by an Isolator class

Instance Attribute Summary collapse

Attributes inherited from Dcmgr::VNet::Task

#rules

Instance Method Summary collapse

Constructor Details

#initialize(friend_ips) ⇒ AcceptIpFromFriends

Returns a new instance of AcceptIpFromFriends.



13
14
15
16
17
18
19
20
21
# File 'lib/dcmgr/vnet/tasks/accept_ip_from_friends.rb', line 13

def initialize(friend_ips)
  super()
  
  @friend_ips = friend_ips
  
  friend_ips.each { |friend_ip|
    self.rules << IptablesRule.new(:filter,:forward,nil,:incoming,"-s #{friend_ip} -j ACCEPT")
  }
end

Instance Attribute Details

#friend_ipsObject (readonly)

Returns the value of attribute friend_ips.



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

def friend_ips
  @friend_ips
end