Skip to content

Add DeleteById() function #97

Description

@alegrey91

I would introduce a new function:

func DeleteById(table string, chain string, id int) error {
    ...
}

This allow you to delete a specific rule by passing its number identifier.
The number is retrievable using the following (example) command:

$ sudo iptables -t nat -L PREROUTING -n --line-number
Chain PREROUTING (policy ACCEPT)
num  target     prot opt source               destination         
1    DNAT       tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:1242 to:127.0.0.1:29
2    DNAT       tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:1242 to:127.0.0.1:22
3    DNAT       tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:1242 to:127.0.0.1:25

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions