MCPcopy
hub / github.com/cloudflare/cloudflared / NewRule

Function NewRule

ipaccess/access.go:48–55  ·  view source on GitHub ↗
(ipnet *net.IPNet, ports []int, allow bool)

Source from the content-addressed store, hash-verified

46}
47
48func 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
57func (r *Rule) Validate() error {
58 if r.ipNet == nil {

Callers 4

NewRuleByCIDRFunction · 0.85
TestRuleCreationFunction · 0.85
TestRulesMatchIPAndPortFunction · 0.85
TestRulesMatchIPAndPort2Function · 0.85

Calls 1

ValidateMethod · 0.95

Tested by 3

TestRuleCreationFunction · 0.68
TestRulesMatchIPAndPortFunction · 0.68
TestRulesMatchIPAndPort2Function · 0.68