emissary/internal/spec/gateway.go

36 lines
664 B
Go

package spec
const NameGateway Name = "gateway.emissary.cadoles.com"
type GatewayID string
type Gateway struct {
Revision int `json:"revision"`
Gateways map[GatewayID]GatewayEntry `json:"gateways"`
}
type GatewayEntry struct {
Address string `json:"address"`
Target string `json:"target"`
}
func (g *Gateway) SpecName() Name {
return NameGateway
}
func (g *Gateway) SpecRevision() int {
return g.Revision
}
func (g *Gateway) SpecData() any {
return struct {
Gateways map[GatewayID]GatewayEntry
}{Gateways: g.Gateways}
}
func NewGatewaySpec() *Gateway {
return &Gateway{
Gateways: make(map[GatewayID]GatewayEntry),
}
}