(ipnet *net.IPNet, ports []int, allow bool)
| 46 | } |
| 47 | |
| 48 | func NewRule(ipnet *net.IPNet, ports []int, allow bool) (Rule, error) { |
| 49 | rule := Rule{ |
| 50 | ipNet: ipnet, |
| 51 | ports: ports, |
| 52 | allow: allow, |
| 53 | } |
| 54 | return rule, rule.Validate() |
| 55 | } |
| 56 | |
| 57 | func (r *Rule) Validate() error { |
| 58 | if r.ipNet == nil { |