41 lines
691 B
Go
41 lines
691 B
Go
package proxy
|
|
|
|
import "forge.cadoles.com/Cadoles/emissary/internal/spec"
|
|
|
|
const NameProxy spec.Name = "proxy.emissary.cadoles.com"
|
|
|
|
type ID string
|
|
|
|
type Spec struct {
|
|
Revision int `json:"revision"`
|
|
Proxies map[ID]ProxyEntry `json:"proxies"`
|
|
}
|
|
|
|
type ProxyEntry struct {
|
|
Address string `json:"address"`
|
|
Target string `json:"target"`
|
|
}
|
|
|
|
func (s *Spec) SpecName() spec.Name {
|
|
return NameProxy
|
|
}
|
|
|
|
func (s *Spec) SpecRevision() int {
|
|
return s.Revision
|
|
}
|
|
|
|
func (s *Spec) SpecData() map[string]any {
|
|
return map[string]any{
|
|
"proxies": s.Proxies,
|
|
}
|
|
}
|
|
|
|
func NewSpec() *Spec {
|
|
return &Spec{
|
|
Revision: -1,
|
|
Proxies: make(map[ID]ProxyEntry),
|
|
}
|
|
}
|
|
|
|
var _ spec.Spec = &Spec{}
|