* Allow to configure firewall rules from the GUI (WIP) New features: - Configure and list system firewall rules from the GUI (nftables). - Configure chains' policies. - Add simple rules to allow incoming ports. - Add simple rules to exclude apps (ports) from being intercepted. This feature is only available for nftables. iptables is still supported, you can add rules to the configuration file and they'll be loaded, but you can't configure them from the GUI. More information: #592
33 lines
583 B
Go
33 lines
583 B
Go
package exprs
|
|
|
|
import (
|
|
"github.com/google/nftables/expr"
|
|
)
|
|
|
|
// NewOperator translates a string comparator operator to nftables operator
|
|
func NewOperator(operator string) expr.CmpOp {
|
|
switch operator {
|
|
case "!=":
|
|
return expr.CmpOpNeq
|
|
case ">":
|
|
return expr.CmpOpGt
|
|
case ">=":
|
|
return expr.CmpOpGte
|
|
case "<":
|
|
return expr.CmpOpLt
|
|
case "<=":
|
|
return expr.CmpOpLte
|
|
}
|
|
|
|
return expr.CmpOpEq
|
|
}
|
|
|
|
// NewExprOperator returns a new comparator operator
|
|
func NewExprOperator(op expr.CmpOp) *[]expr.Any {
|
|
return &[]expr.Any{
|
|
&expr.Cmp{
|
|
Register: 1,
|
|
Op: op,
|
|
},
|
|
}
|
|
}
|