Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DeleteById() function #97

Open
alegrey91 opened this issue Aug 15, 2022 · 1 comment
Open

Add DeleteById() function #97

alegrey91 opened this issue Aug 15, 2022 · 1 comment

Comments

@alegrey91
Copy link
Contributor

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants