Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PGNMatcher ¶
PGNMatcher matches PGN numbers against a set of individual values and ranges.
func (*PGNMatcher) Contains ¶
func (m *PGNMatcher) Contains(pgn uint32) bool
Contains returns true if pgn is in the matcher's set.
type SendPolicy ¶
type SendPolicy struct {
Enabled bool // must be true for /send and /query to accept requests
Rules []SendRule // ordered rules; first match wins
}
SendPolicy controls whether the /send and /query endpoints are enabled and which frames are permitted. Rules are evaluated top-to-bottom; first match wins. If no rule matches, the request is denied. An empty Rules list with Enabled=true allows all frames (backwards compatible).
type SendRule ¶
type SendRule struct {
Allow bool // true = allow, false = deny
PGNs *PGNMatcher // nil = match any PGN
Names []uint64 // nil/empty = match any destination NAME
}
SendRule is a single allow or deny rule that matches frames by PGN and/or destination CAN NAME. Either matcher may be nil (wildcard).
func ParseSendRule ¶
ParseSendRule parses a single rule string. Syntax:
[!] [pgn:<spec>] [name:<hex>,...]
where <spec> is comma-separated PGN values or ranges (e.g. "59904", "59904,126208", "129025-129029", "59904,65280-65535").
A '!' prefix makes the rule a deny rule; otherwise it's an allow rule. Omitting pgn: matches all PGNs. Omitting name: matches all destinations.
Examples:
"pgn:59904" — allow PGN 59904 to any device "pgn:59904,126208 name:001c6e4000200000" — allow two PGNs to one device "pgn:129025-129029" — allow a PGN range "!pgn:65280-65535" — deny proprietary PGN range "name:001c6e4000200000" — allow any PGN to one device
func ParseSendRules ¶
ParseSendRules parses multiple rule strings.