|
@@ -53,7 +53,7 @@ func New() (*IPTables, error) {
|
|
|
}
|
|
|
|
|
|
// Exists checks if given rulespec in specified table/chain exists
|
|
|
-func (ipt *IPTables) Exists(table, chain string, rulespec...string) (bool, error) {
|
|
|
+func (ipt *IPTables) Exists(table, chain string, rulespec ...string) (bool, error) {
|
|
|
checkPresent, err := getIptablesHasCheckCommand()
|
|
|
if err != nil {
|
|
|
log.Printf("Error checking iptables version, assuming version at least 1.4.11: %v", err)
|
|
@@ -114,8 +114,8 @@ func (ipt *IPTables) Delete(table, chain string, rulespec ...string) error {
|
|
|
func (ipt *IPTables) List(table, chain string) ([]string, error) {
|
|
|
var stdout, stderr bytes.Buffer
|
|
|
cmd := exec.Cmd{
|
|
|
- Path: ipt.path,
|
|
|
- Args: []string{ipt.path, "-t", table, "-S", chain},
|
|
|
+ Path: ipt.path,
|
|
|
+ Args: []string{ipt.path, "-t", table, "-S", chain},
|
|
|
Stdout: &stdout,
|
|
|
Stderr: &stderr,
|
|
|
}
|
|
@@ -158,11 +158,11 @@ func (ipt *IPTables) DeleteChain(table, chain string) error {
|
|
|
return ipt.run("-t", table, "-X", chain)
|
|
|
}
|
|
|
|
|
|
-func (ipt *IPTables) run(args... string) error {
|
|
|
+func (ipt *IPTables) run(args ...string) error {
|
|
|
var stderr bytes.Buffer
|
|
|
cmd := exec.Cmd{
|
|
|
- Path: ipt.path,
|
|
|
- Args: append([]string{ipt.path}, args...),
|
|
|
+ Path: ipt.path,
|
|
|
+ Args: append([]string{ipt.path}, args...),
|
|
|
Stderr: &stderr,
|
|
|
}
|
|
|
|