40 lines
694 B
Go
40 lines
694 B
Go
package gateway
|
|
|
|
import "forge.cadoles.com/Cadoles/emissary/internal/spec"
|
|
|
|
const NameGateway spec.Name = "gateway.emissary.cadoles.com"
|
|
|
|
type ID string
|
|
|
|
type Spec struct {
|
|
Revision int `json:"revision"`
|
|
Gateways map[ID]GatewayEntry `json:"gateways"`
|
|
}
|
|
|
|
type GatewayEntry struct {
|
|
Address string `json:"address"`
|
|
Target string `json:"target"`
|
|
}
|
|
|
|
func (s *Spec) SpecName() spec.Name {
|
|
return NameGateway
|
|
}
|
|
|
|
func (s *Spec) SpecRevision() int {
|
|
return s.Revision
|
|
}
|
|
|
|
func (s *Spec) SpecData() map[string]any {
|
|
return map[string]any{
|
|
"gateways": s.Gateways,
|
|
}
|
|
}
|
|
|
|
func NewSpec() *Spec {
|
|
return &Spec{
|
|
Gateways: make(map[ID]GatewayEntry),
|
|
}
|
|
}
|
|
|
|
var _ spec.Spec = &Spec{}
|