iptables-helper/pkg/utils/iptables/iptables.go
2023-11-02 20:19:38 +08:00

60 lines
1.4 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"`
// -m [match] 用于匹配扩展模块 example: tcp udp icmp
Match string `json:"match"`
// --sport example: 22 80
SrcPort string `json:"srcPort"`
// --dport example: 80
DstPort string `json:"dstPort"`
}