2023-04-04 20:26:19 +02:00
|
|
|
package spec
|
|
|
|
|
|
|
|
import (
|
|
|
|
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
|
|
|
)
|
|
|
|
|
2024-03-12 16:22:35 +01:00
|
|
|
const (
|
|
|
|
Name string = "mdns.emissary.cadoles.com"
|
|
|
|
Version string = "0.0.0"
|
|
|
|
)
|
2023-04-04 20:26:19 +02:00
|
|
|
|
|
|
|
type Spec struct {
|
|
|
|
Revision int `json:"revision"`
|
|
|
|
Services map[string]Service `json:"services"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Service struct {
|
|
|
|
Type string `json:"type"`
|
|
|
|
Domain string `json:"domain"`
|
|
|
|
Host string `json:"host"`
|
|
|
|
Ifaces []string `json:"ifaces"`
|
|
|
|
Port int `json:"port"`
|
|
|
|
}
|
|
|
|
|
2024-03-12 16:22:35 +01:00
|
|
|
func (s *Spec) SpecDefinitionName() string {
|
2023-04-04 20:26:19 +02:00
|
|
|
return Name
|
|
|
|
}
|
|
|
|
|
2024-03-12 16:22:35 +01:00
|
|
|
func (s *Spec) SpecDefinitionVersion() string {
|
|
|
|
return Version
|
|
|
|
}
|
|
|
|
|
2023-04-04 20:26:19 +02:00
|
|
|
func (s *Spec) SpecRevision() int {
|
|
|
|
return s.Revision
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Spec) SpecData() map[string]any {
|
|
|
|
return map[string]any{
|
|
|
|
"services": s.Services,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewSpec() *Spec {
|
|
|
|
return &Spec{
|
|
|
|
Revision: -1,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var _ spec.Spec = &Spec{}
|