lib/iptablez/chains/chains.rb in iptablez-1.0.2.pre vs lib/iptablez/chains/chains.rb in iptablez-1.0.3.pre
- old
+ new
@@ -167,11 +167,47 @@
return r unless block_given?
elsif name && names[0]
raise "Cannot use both a single name and multiple names together."
end
end
+
+ def self.stats
+ Commands::Stats
+ end
+
+ def self.packets
+ Commands::Stats::Packets
+ end
+ def self.bytes
+ Commands::Stats::Bytes
+ end
+
+ def self.list
+ Commands::List
+ end
+
+ def self.new_chain
+ Commands::NewChain
+ end
+
+ def self.delete_chain
+ Commands::DeleteChain
+ end
+
+ def self.flush_chain
+ Commands::FlushChain
+ end
+
+ def self.rename_chain
+ Commands::RenameChain
+ end
+
+ def self.append_chain
+ Commands::AppendChain
+ end
+
def self.create(name: false, names: [], error: false, continue: !error)
if name
Commands::NewChain.chain(name: name, continue: continue) do |result|
yield result if block_given?
end
@@ -203,11 +239,11 @@
Commands::FlushChain.chains(names: names, continue: continue) do |result|
yield result if block_given?
end
end
end
-
+
def self.rename(from: false, to: false, pairs: {}, error: false, continue: !error)
if from && to
Commands::RenameChain.chain(from: from, to: to, continue: continue) do |result|
yield result if block_given?
end
@@ -218,10 +254,17 @@
Commands::RenameChain.chains(pairs: pairs, continue: continue) do |result|
yield result if block_given?
end
end
end
-
+
+ def self.append(name: false, names: [], error: false, continue: !error, **args)
+ if name
+ Commands::AppendChain.chain(name: name, continue: continue, **args)
+ elsif !names.empty?
+ Commands::AppendChain.chains(names: names, continue: continue, **args)
+ end
+ end
end
end