We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
hi , I tried insert rule,but I do not what format should be inserted? go-iptables only get but not insert rules?
system version:centos7 golang version:1.15.3
func main() { ips, err := iptables.New() if err != nil { panic(err) } stas, err := ips.StructuredStats("filter", "IN_public_allow") if err != nil { panic(err) } fmt.Printf("%#v\n\n ", stas) stasstr, err := ips.Stats("filter", "IN_public_allow") for _, v := range stasstr { if err := ips.Append("filter", "INPUT", v...); err != nil { panic(err) } } stasstr, err = ips.Stats("filter", "IN_public_allow") if err != nil { panic(err) } fmt.Printf("%#v\n\n ", stasstr) }
I I tried insert rule,but I do not what format should be inserted?but I tried used Results obtained by go-iptables,but or not insert.
[root@node01 ~]# ./iptables-api []iptables.Stat{iptables.Stat{Packets:0x2, Bytes:0xa8, Target:"ACCEPT", Protocol:"tcp", Opt:"--", Input:"*", Output:"*", Source:(*net.IPNet)(0xc000058870), Destination:(*net.IPNet)(0xc0000588a0), Options:"tcp dpt:22 ctstate NEW,UNTRACKED"}, iptables.Stat{Packets:0x0, Bytes:0x0, Target:"ACCEPT", Protocol:"tcp", Opt:"--", Input:"*", Output:"*", Source:(*net.IPNet)(0xc0000588d0), Destination:(*net.IPNet)(0xc000058900), Options:"tcp dpt:1088 ctstate NEW,UNTRACKED"}} panic: running [/usr/sbin/iptables -t filter -A INPUT 2 168 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 ctstate NEW,UNTRACKED --wait]: exit status 2: Bad argument `2' Try `iptables -h' or 'iptables --help' for more information. goroutine 1 [running]: main.main() /mnt/d/go_work/src/netlink/main.go:58 +0x488
go-iptables generated format cannot be inserted , it's not iptables cli format? I should how to insert rules with go-iptables?
The text was updated successfully, but these errors were encountered:
use root user to run your process.
Sorry, something went wrong.
No branches or pull requests
hi ,
I tried insert rule,but I do not what format should be inserted?
go-iptables only get but not insert rules?
version
system version:centos7
golang version:1.15.3
code
phenomenon
I I tried insert rule,but I do not what format should be inserted?but I tried used Results obtained by go-iptables,but or not insert.
go-iptables generated format cannot be inserted , it's not iptables cli format? I should how to insert rules with go-iptables?
The text was updated successfully, but these errors were encountered: