client

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2018 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Name      string // имя сервиса для Consul
	Namespace string
	Conn      *grpc.ClientConn

	Addr         string
	Port         int64
	HealthChecks []string

	ServerName    string // "" если не использовать TLS
	ServiceName   string // имя сервиса для Consul
	ConsulAddress string

	Balancer       grpc.Balancer
	ConsulResolver *lb.ConsulResolver

	LogrusEntry *log.Entry
	// contains filtered or unexported fields
}

Client

func NewClient

func NewClient(options ...ClientOption) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) GetServerAddress

func (c *Client) GetServerAddress() (addr string)

func (*Client) HealthzResolver

func (c *Client) HealthzResolver() (naming.Resolver, error)

HealthzResolver - пока непонятно

func (*Client) Shutdown

func (c *Client) Shutdown()

type ClientOption

type ClientOption func(*Client)

func SetAddr

func SetAddr(addr string) ClientOption

func SetAuthBasic

func SetAuthBasic(login string, passwd string) ClientOption

SetAuthBasic - setting Basic Authentication provided login and passwd

func SetAuthJWT

func SetAuthJWT(token string) ClientOption

SetAuthJWT - setting

func SetBalancer

func SetBalancer(balancer grpc.Balancer) ClientOption

func SetCAFile

func SetCAFile(caFile string) ClientOption

func SetConsul

func SetConsul(consulAddr string) ClientOption

func SetHealthcheckURL

func SetHealthcheckURL(urls ...string) ClientOption

func SetLogger

func SetLogger(logger *log.Logger) ClientOption

SetLogger устанавливаем значения для Logrus

func SetMaxRetries

func SetMaxRetries(maxRetries uint) ClientOption

func SetRateLimiter

func SetRateLimiter(limiter *rate.Limiter) ClientOption

func SetServerName

func SetServerName(serverName string) ClientOption

func SetServiceName

func SetServiceName(name string, namespace string, addr string, port int) ClientOption

SetServiceName созаем имя сервиса и его адресс name - имя сервиса разделитель - для того чтобы можно было к нему обращатся через DNS addr адрес сервера к которому будет конектится клиент

если "" то будет автоматически братся IP внешнего интерфейса
если local то будет коннектится к localhost:9000
port - порт на котором прослушивает сервер

func SetSetting

func SetSetting(verbose int, debug bool, prom bool) ClientOption

SetSetting разные настройки

func SetTLS

func SetTLS(tls bool) ClientOption

type TokenAuth

type TokenAuth struct {
	Token    string
	Security bool
	Schema   string
}

func (*TokenAuth) GetRequestMetadata

func (t *TokenAuth) GetRequestMetadata(context.Context, ...string) (map[string]string, error)

func (*TokenAuth) RequireTransportSecurity

func (t *TokenAuth) RequireTransportSecurity() bool

Jump to

Keyboard shortcuts

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