52 lines
1.2 KiB
Go
52 lines
1.2 KiB
Go
package iptables
|
|
|
|
var (
|
|
ACCEPT Action = "ACCEPT"
|
|
DROP Action = "DROP"
|
|
)
|
|
|
|
type Action string
|
|
type PolicyTarget string
|
|
|
|
type Table string
|
|
|
|
type Policy struct {
|
|
Name Chain `json:"name"`
|
|
Target PolicyTarget `json:"target"`
|
|
}
|
|
|
|
type Chain string
|
|
|
|
type Rule struct {
|
|
Chain Chain `json:"chain"`
|
|
// -j [target Chain]
|
|
Jump Chain `json:"jump"`
|
|
// -g [chain Chain]
|
|
Goto Chain `json:"goto"`
|
|
|
|
// -i [interface]
|
|
InputInterface string `json:"inputInterface"`
|
|
// ! -i [interface]
|
|
ExcludeInputInterface string `json:"excludeInputInterface"`
|
|
|
|
// -o [interface]
|
|
OutputInterface string `json:"outputInterface"`
|
|
// ! -o [interface]
|
|
ExcludeOutputInterface string `json:"excludeOutputInterface"`
|
|
|
|
// -s [source] example: 192.168.1.1, 192.168.1.0/24
|
|
Source string `json:"source"`
|
|
// ! -s [source] example: 192.168.1.1, 192.168.1.0/24
|
|
ExcludeSource string `json:"excludeSource"`
|
|
|
|
// -d [dest] example: 192.168.1.1, 192.168.1.0/24
|
|
Destination string `json:"destination"`
|
|
// ! -s [source] example: 192.168.1.1, 192.168.1.0/24
|
|
ExcludeDestination string `json:"excludeDestination"`
|
|
|
|
// -p [proto] example: all, tcp, udp, icmp
|
|
Protocol string `json:"protocol"`
|
|
// ! -p [proto] example: all, tcp, udp, icmp
|
|
ExcludeProtocol string `json:"excludeProtocol"`
|
|
}
|