discovery

package
v0.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2023 License: MIT Imports: 15 Imported by: 2

README

discovery

Documentation

Index

Constants

View Source
const (
	Delimiter = "/"
)
View Source
const (
	EtcdScheme = "etcd"
)

Variables

This section is empty.

Functions

func PublishClientConf

func PublishClientConf(dstDir string) error

func PublishExampleConf

func PublishExampleConf(dstDir string) error

PublishExampleConf publish the config examples in the ./etc directory

func PublishServerConf

func PublishServerConf(dstDir string) error

func RegService

func RegService(conf *Conf)

RegService register the current server service to etcd

Types

type Client

type Client struct {
	*grpc.ClientConn
}

func NewClient

func NewClient(c *Conf, rpcServiceName string) *Client

NewClient rpcServiceName is the key of Conf.RpcServices, not the Conf.Service.Name use round_robin balancing policy

type Conf

type Conf struct {
	Service     Service     `yaml:"Service"`
	Etcd        EtcdConf    `yaml:"Etcd"`
	RpcServices RpcServices `yaml:"RpcServices"`
}

func MustResolveConf

func MustResolveConf(configFile string) *Conf

func ResolveConf

func ResolveConf(configFile string) (*Conf, error)

type EtcdConf

type EtcdConf struct {
	Endpoints []string `yaml:"Endpoints"`
	// TODO
	Username string `yaml:"Username"`
	Password string `yaml:"Password"`
}

type RpcServices

type RpcServices map[string]string

type Service

type Service struct {
	Name     string `yaml:"Name"`
	ListenOn string `yaml:"ListenOn"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL