discovery

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

README

discovery

Discovery SPI for Fns

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientTLS

type ClientTLS struct {
	// Enable
	// 是否起效
	Enable bool `json:"enable"`
	// RootCA
	// 根证书的PEM内容
	RootCA []byte `json:"rootCa"`
	// Cert
	// Cert的PEM内容
	Cert []byte `json:"cert"`
	// Key
	// Key的PEM内容
	Key []byte `json:"key"`
	// Insecure
	// 是否跳过验证
	Insecure bool `json:"insecure"`
}

ClientTLS Fn的客户端TLS信息

func (*ClientTLS) Config

func (c *ClientTLS) Config() (config *tls.Config, err error)

Config 构建*tls.Config

type Discovery

type Discovery interface {
	// Publish
	// 注册Fn
	Publish(name string) (registrationId string, err error)
	// UnPublish
	// 注销Fn
	UnPublish(registrationId string) (err error)
	// Get
	// 发现Fn注册信息
	Get(name string) (registrations []Registration, err error)
	// IsLocaled
	// 判断是否是本地的
	IsLocaled(name string) (ok bool)
	// Close
	// 关闭
	Close()
}

Discovery Fn的注册与发现

type Option

type Option func(*Options) error

func WithAddress

func WithAddress(host string, port int) Option

func WithClientTLS

func WithClientTLS(rootCAPEM []byte, certPEM []byte, KeyPEM []byte, insecure bool) Option

func WithConfig

func WithConfig(config []byte) Option

type Options

type Options struct {
	Address   string
	ClientTLS ClientTLS
	Config    []byte
}

type Registration

type Registration struct {
	Id        string    `json:"id"`
	Name      string    `json:"name"`
	Address   string    `json:"address"`
	ClientTLS ClientTLS `json:"clientTls"`
}

Registration 注册结果

type Retriever

type Retriever func(options ...Option) (d Discovery, err error)

Jump to

Keyboard shortcuts

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