b312645387
Storage + CRUD (migration 0006, model, id-keyed store, REST handlers) plus compiler rendering: each section is owned by a device and projected into that device's rendered config (hosts/providers/routes/routing_rules).
55 lines
1.9 KiB
Go
55 lines
1.9 KiB
Go
package model
|
|
|
|
// Per-device long-tail sections. Each is owned by a device (the fleet member it
|
|
// renders on) and maps to the corresponding tomswall config section.
|
|
|
|
// Host constrains a zone to specific addresses on a device's interface.
|
|
type Host struct {
|
|
ID int64 `json:"id"`
|
|
Device string `json:"device"`
|
|
Zone string `json:"zone"`
|
|
Interface string `json:"interface"`
|
|
Addresses []string `json:"addresses,omitempty"`
|
|
Exclusions []string `json:"exclusions,omitempty"`
|
|
Dynamic bool `json:"dynamic,omitempty"`
|
|
}
|
|
|
|
// Provider is a multi-ISP routing provider on a device.
|
|
type Provider struct {
|
|
ID int64 `json:"id"`
|
|
Device string `json:"device"`
|
|
Name string `json:"name"`
|
|
Number int `json:"number"`
|
|
Mark int `json:"mark,omitempty"`
|
|
Duplicate string `json:"duplicate,omitempty"`
|
|
Interface string `json:"interface"`
|
|
Gateway string `json:"gateway,omitempty"`
|
|
Copy []string `json:"copy,omitempty"`
|
|
}
|
|
|
|
// Route is a static route on a device. Oif is the egress interface (tomswall's
|
|
// route "device" field, renamed to avoid colliding with the fleet device).
|
|
type Route struct {
|
|
ID int64 `json:"id"`
|
|
Device string `json:"device"`
|
|
Provider string `json:"provider,omitempty"`
|
|
Dest string `json:"dest"`
|
|
Gateway string `json:"gateway,omitempty"`
|
|
Oif string `json:"oif,omitempty"`
|
|
Persistent bool `json:"persistent,omitempty"`
|
|
Comment string `json:"comment,omitempty"`
|
|
}
|
|
|
|
// RoutingRule directs traffic to a provider's routing table on a device.
|
|
type RoutingRule struct {
|
|
ID int64 `json:"id"`
|
|
Device string `json:"device"`
|
|
Source string `json:"source,omitempty"`
|
|
Dest string `json:"dest,omitempty"`
|
|
Provider string `json:"provider"`
|
|
Priority int `json:"priority,omitempty"`
|
|
Persistent bool `json:"persistent,omitempty"`
|
|
Mark string `json:"mark,omitempty"`
|
|
Comment string `json:"comment,omitempty"`
|
|
}
|