remove transport draft, add grpc web and gateway support

This commit is contained in:
2021-09-18 01:39:15 +02:00
parent 4085420f6f
commit 1eea54f18a
37 changed files with 2884 additions and 290 deletions

View File

@ -27,9 +27,9 @@ var (
)
type mdnsTxt struct {
Service string
Version string
Metadata map[string]string
Service string
Version string
Metadata map[string]string
}
type mdnsEntry struct {
@ -225,9 +225,9 @@ func (m *mdnsRegistry) Register(service *registry.Service, opts ...registry.Regi
}
txt, err := encode(&mdnsTxt{
Service: service.Name,
Version: service.Version,
Metadata: node.Metadata,
Service: service.Name,
Version: service.Version,
Metadata: node.Metadata,
})
if err != nil {
@ -351,8 +351,8 @@ func (m *mdnsRegistry) GetService(service string, opts ...registry.GetOption) ([
s, ok := serviceMap[txt.Version]
if !ok {
s = &registry.Service{
Name: txt.Service,
Version: txt.Version,
Name: txt.Service,
Version: txt.Version,
}
}
addr := ""
@ -572,8 +572,8 @@ func (m *mdnsWatcher) Next() (*registry.Result, error) {
}
service := &registry.Service{
Name: txt.Service,
Version: txt.Version,
Name: txt.Service,
Version: txt.Version,
}
// skip anything without the domain we care about

View File

@ -7,12 +7,11 @@ import (
resolver2 "go.linka.cloud/grpc/resolver"
)
func New() registry.Registry {
return &noop{}
}
type noop struct {}
type noop struct{}
func (n noop) ResolverBuilder() resolver.Builder {
return resolver2.New(n)
@ -50,11 +49,10 @@ func (n noop) String() string {
return "passthroug"
}
type noopWatcher struct {}
type noopWatcher struct{}
func (n noopWatcher) Next() (*registry.Result, error) {
return &registry.Result{}, nil
}
func (n noopWatcher) Stop() {}

View File

@ -29,10 +29,10 @@ type Registry interface {
}
type Service struct {
Name string `json:"name"`
Version string `json:"version"`
Metadata map[string]string `json:"metadata"`
Nodes []*Node `json:"nodes"`
Name string `json:"name"`
Version string `json:"version"`
Metadata map[string]string `json:"metadata"`
Nodes []*Node `json:"nodes"`
}
type Node struct {