Method: Iptables::Decoder#decode

Defined in:
lib/iptables.rb

#decode(text) ⇒ Hash

Decodes iptables-save input into a normalized hash

Parameters:

  • text (String)

    the raw output of iptables-save

Returns:

  • (Hash)

    returns a hash containing the parsed rules

Raises:



50
51
52
53
54
55
56
57
58
# File 'lib/iptables.rb', line 50

def decode(text)
  {
    :metadata => {
      :ruby_iptables_version => VERSION,
      :iptables_compatibility => opts[:iptables_compatibility],
    },
    :result => parse_iptables_save(text),
  }
end