Files
tomswallapi/internal/model/perdevice_l2.go
T
benvin d9d192757b
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
Add per-device L2/misc long-tail: tunnels/stopped_rules/proxy_arp/proxy_ndp/arp_rules/maclist
Storage + CRUD (migration 0007, model, id-keyed store, REST handlers) + compiler
rendering, each owned by a device. proxy_arp/proxy_ndp share the ProxyEntry
shape via table-parameterized store helpers.
2026-07-26 15:50:01 +10:00

62 lines
2.0 KiB
Go

package model
// Per-device L2/misc long-tail sections.
type Tunnel struct {
ID int64 `json:"id"`
Device string `json:"device"`
Type string `json:"type"`
Zone string `json:"zone"`
Gateways []string `json:"gateways,omitempty"`
GatewayZones []string `json:"gateway_zones,omitempty"`
Port int `json:"port,omitempty"`
Comment string `json:"comment,omitempty"`
}
type StoppedRule struct {
ID int64 `json:"id"`
Device string `json:"device"`
Action string `json:"action"`
Source string `json:"source,omitempty"`
Dest string `json:"dest,omitempty"`
Proto string `json:"proto,omitempty"`
DPort []string `json:"dport,omitempty"`
SPort []string `json:"sport,omitempty"`
Comment string `json:"comment,omitempty"`
}
// ProxyEntry backs both proxy_arp and proxy_ndp (identical shape).
type ProxyEntry struct {
ID int64 `json:"id"`
Device string `json:"device"`
Address string `json:"address"`
Interface string `json:"interface,omitempty"`
External string `json:"external"`
HaveRoute bool `json:"haveroute,omitempty"`
Persistent bool `json:"persistent,omitempty"`
Comment string `json:"comment,omitempty"`
}
type ArpRule struct {
ID int64 `json:"id"`
Device string `json:"device"`
Action string `json:"action"`
ActionAddress string `json:"action_address,omitempty"`
ActionMAC string `json:"action_mac,omitempty"`
Source string `json:"source,omitempty"`
Dest string `json:"dest,omitempty"`
Opcode int `json:"opcode,omitempty"`
Comment string `json:"comment,omitempty"`
}
type MaclistEntry struct {
ID int64 `json:"id"`
Device string `json:"device"`
Action string `json:"action"`
Interface string `json:"interface"`
MAC string `json:"mac,omitempty"`
Addresses []string `json:"addresses,omitempty"`
Log string `json:"log,omitempty"`
Comment string `json:"comment,omitempty"`
}