50 lines
832 B
Go
50 lines
832 B
Go
package spec
|
|
|
|
import (
|
|
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
|
)
|
|
|
|
const (
|
|
Name string = "mdns.emissary.cadoles.com"
|
|
Version string = "0.0.0"
|
|
)
|
|
|
|
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"`
|
|
}
|
|
|
|
func (s *Spec) SpecDefinitionName() string {
|
|
return Name
|
|
}
|
|
|
|
func (s *Spec) SpecDefinitionVersion() string {
|
|
return Version
|
|
}
|
|
|
|
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{}
|