From 8835e0e647f9b57039fa93ef35363b4e94a40d30 Mon Sep 17 00:00:00 2001 From: ginuerzh Date: Tue, 31 Oct 2023 22:56:51 +0800 Subject: [PATCH] add sd --- sd/sd.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 sd/sd.go diff --git a/sd/sd.go b/sd/sd.go new file mode 100644 index 0000000..71da211 --- /dev/null +++ b/sd/sd.go @@ -0,0 +1,24 @@ +package sd + +import ( + "context" +) + +type Options struct{} + +type Option func(opts *Options) + +type Service struct { + Node string + Name string + Network string + Address string +} + +// SD is the service discovery interface. +type SD interface { + Register(ctx context.Context, name string, network string, address string, opts ...Option) error + Deregister(ctx context.Context, name string) error + Renew(ctx context.Context, name string) error + Get(ctx context.Context, name string) ([]*Service, error) +}