完善解析
This commit is contained in:
parent
ccec58bfb9
commit
2a107c474b
@ -48,4 +48,12 @@ type Rule struct {
|
||||
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"`
|
||||
}
|
||||
|
@ -80,6 +80,10 @@ func Parse(rules string) {
|
||||
|
||||
jump := flagSet.StringP("jump", "j", "", "")
|
||||
gotoChain := flagSet.StringP("goto", "g", "", "")
|
||||
match := flagSet.StringP("match", "m", "", "")
|
||||
|
||||
srcPort := flagSet.String("sport", "", "")
|
||||
dstPort := flagSet.String("dport", "", "")
|
||||
|
||||
_ = flagSet.Parse(args)
|
||||
r := Rule{
|
||||
@ -100,6 +104,9 @@ func Parse(rules string) {
|
||||
ExcludeProtocol: *excludeProtocol,
|
||||
Jump: Chain(*jump),
|
||||
Goto: Chain(*gotoChain),
|
||||
Match: *match,
|
||||
SrcPort: *srcPort,
|
||||
DstPort: *dstPort,
|
||||
}
|
||||
ruleList = append(ruleList, r)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user