Module: Puffy::Formatters::Netfilter

Defined in:
lib/puffy/formatters/netfilter.rb

Overview

:nodoc:

Defined Under Namespace

Classes: Rule, Ruleset

Class Method Summary collapse

Class Method Details

.iptables_action(rule_or_action, ret: false) ⇒ String

Returns the target to jump to

Returns:

  • (String)


9
10
11
12
13
14
15
16
# File 'lib/puffy/formatters/netfilter.rb', line 9

def self.iptables_action(rule_or_action, ret: false)
  case rule_or_action
  when :pass      then 'ACCEPT'
  when :log       then 'LOG'
  when :block     then ret ? 'RETURN' : 'DROP'
  when Puffy::Rule then iptables_action(rule_or_action.action, ret: rule_or_action.return)
  end
end