38 lines
676 B
Go
38 lines
676 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() any {
|
||
|
return struct {
|
||
|
Gateways map[ID]GatewayEntry
|
||
|
}{Gateways: s.Gateways}
|
||
|
}
|
||
|
|
||
|
func NewSpec() *Spec {
|
||
|
return &Spec{
|
||
|
Gateways: make(map[ID]GatewayEntry),
|
||
|
}
|
||
|
}
|