func StaticNetRule(action Action, subnet string) (Rule, error) {
	_, parsedNet, err := net.ParseCIDR(subnet)
	if err != nil {
		return nil, err
	}
	return subnetRule{action: action, net: parsedNet}, nil
}
StaticNetRule returns static rule for provided subnet that will apply
"allow" to it.
package filter
import (
	"net"
	"gortc.io/turn"
)
type Action byte
var actionToStr = map[Action]string{
	Pass:  "pass",
	Allow: "allow",
	Deny:  "deny",
}
func (a Action) String() string {
	return actionToStr[a]
}
const (
	Pass Action = iota
	Allow
	Deny
)
type subnetRule struct {
	action Action
	net    *net.IPNet
}
func (r subnetRule) Action(addr turn.Addr) Action {
	inSubnet := r.net.Contains(addr.IP)
	if inSubnet {
		return r.action
	}
	return Pass
}
func AllowNet(subnet string) (Rule, error) {
	return StaticNetRule(Allow, subnet)
}
func ForbidNet(subnet string) (Rule, error) {
	return StaticNetRule(Deny, subnet)
}