Quellcode durchsuchen

Merge pull request #2 from eyakubovich/master

added NewChain method
Eugene Yakubovich vor 10 Jahren
Ursprung
Commit
80a020bab1
1 geänderte Dateien mit 5 neuen und 1 gelöschten Zeilen
  1. 5 1
      iptables/iptables.go

+ 5 - 1
iptables/iptables.go

@@ -132,10 +132,14 @@ func (ipt *IPTables) List(table, chain string) ([]string, error) {
 	return rules, nil
 }
 
+func (ipt *IPTables) NewChain(table, chain string) error {
+	return ipt.run("-t", table, "-N", chain)
+}
+
 // ClearChain flushed (deletes all rules) in the specifed table/chain.
 // If the chain does not exist, new one will be created
 func (ipt *IPTables) ClearChain(table, chain string) error {
-	err := ipt.run("-t", table, "-N", chain)
+	err := ipt.NewChain(table, chain)
 
 	switch {
 	case err == nil: