discov

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfValidErr       = errors.New("conf valid error")
	ServiceNotFoundErr = errors.New("service not found error")
	NodeNotFoundErr    = errors.New("node not found error")
	RequestErr         = errors.New("request error")

	DIRECT_DISCOVER = "direct"
	CONSUL_DISCOVER = "consul"
)

Functions

This section is empty.

Types

type Client

type Client struct {
	Conf     Conf
	Discover Discover
}

func NewClient

func NewClient(conf Conf) *Client

func (*Client) CallWithHeader

func (c *Client) CallWithHeader(path string, method string, params map[string]string, jsonParams interface{}, headers map[string]string) ([]byte, error)

type Conf

type Conf struct {
	Discover    string `json:"discover" mapstructure:"Discover"`
	Host        string `json:"host" mapstructure:"Host"`
	ServiceName string `json:"serviceName" mapstructure:"ServiceName"`
	Debug       bool   `json:"debug"  mapstructure:"Debug"`
	Proxy       string `json:"proxy" mapstructure:"Proxy"`
}

type ConsulDiscover

type ConsulDiscover struct {
	// contains filtered or unexported fields
}

func (*ConsulDiscover) Endpoint

func (d *ConsulDiscover) Endpoint() (string, error)

func (*ConsulDiscover) GetService

func (d *ConsulDiscover) GetService() error

type DirectDiscover

type DirectDiscover struct {
	// contains filtered or unexported fields
}

func (*DirectDiscover) Endpoint

func (d *DirectDiscover) Endpoint() (string, error)

type Discover

type Discover interface {
	Endpoint() (string, error)
}

func MustNewDiscover

func MustNewDiscover(conf Conf) Discover

func NewConsulDiscover

func NewConsulDiscover(conf Conf) (Discover, error)

func NewDirectDiscover

func NewDirectDiscover(conf Conf) (Discover, error)

func NewDiscover

func NewDiscover(conf Conf) (Discover, error)

type Publisher

type Publisher struct {
	// contains filtered or unexported fields
}

func NewPublisher

func NewPublisher(consulHost string, consulKey string, listenOn string, listenPort int, isSecure bool, opts ...PublisherOption) *Publisher

func (*Publisher) Register

func (p *Publisher) Register() error

func (*Publisher) Revoke

func (p *Publisher) Revoke()

type PublisherOption

type PublisherOption func(client *Publisher)

Jump to

Keyboard shortcuts

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