Documentation ¶
Index ¶
- func NewClientConn[T ClientServiceNameGenerator](serviceName string, opts ...ClientOptions[T]) (*grpc.ClientConn, error)
- func RegisterETCDRegisterPrefixKey(prefix string)
- func RegisterEtcdClient(etcdConfig clientv3.Config) error
- func RegisterRegionProxy(region, proxy string)
- func ResolveEtcdClient() *clientv3.Client
- func ResolveProxy(region string) string
- type Address
- type COptions
- type Client
- type ClientOptions
- type ClientServiceNameGenerator
- type Option
- func WithAddress[T interface{ ... }](addrs []Address) Option[T]
- func WithGrpcServerOptions[T interface{ ... }](opts ...grpc.ServerOption) Option[T]
- func WithHttpServer[T interface{ ... }](srv *http.Server) Option[T]
- func WithServiceRegister[T interface{ ... }](r register.ServiceRegister[T]) Option[T]
- type ServerConfig
- type Srv
- type SrvInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClientConn ¶
func NewClientConn[T ClientServiceNameGenerator](serviceName string, opts ...ClientOptions[T]) (*grpc.ClientConn, error)
func RegisterETCDRegisterPrefixKey ¶
func RegisterETCDRegisterPrefixKey(prefix string)
RegisterETCDRegisterPrefixKey a function to change default register(etcd) prefix key
func RegisterEtcdClient ¶
ResolveEtcdClient a function to register etcd client to watermelon global
func RegisterRegionProxy ¶
func RegisterRegionProxy(region, proxy string)
RegisterRegionProxy set region's proxy endpoint
func ResolveEtcdClient ¶
ResolveEtcdClient a function to get registed etcd client
func ResolveProxy ¶
ResolveProxy return region's proxy, if it exist
Types ¶
type Address ¶
type Address struct { ListenAddress string // exp: 10.0.0.1 or 10.0.0.1:12345 or :12345 (used host-ip:12345) // register-address will be equal listen-address when it is empty // // The registration address does not need to provide a port number. // Even if it is provided, it will be replaced with the port number // used by the listening address, unless a valid URL address is provided. // If the provided URL address needs to automatically fill in the port // number information used by the listener, you can use `{port}“ as a // template for the port number filling. RegisterAddress string // contains filtered or unexported fields }
type COptions ¶
type COptions[T ClientServiceNameGenerator] struct { CustomizeMeta T // contains filtered or unexported fields }
type Client ¶
type Client[T ClientServiceNameGenerator] struct { CustomizeMeta T }
type ClientOptions ¶
type ClientOptions[T ClientServiceNameGenerator] func(c *COptions[T])
func WithDialTimeout ¶
func WithDialTimeout[T ClientServiceNameGenerator](t time.Duration) ClientOptions[T]
func WithGrpcDialOptions ¶
func WithGrpcDialOptions[T ClientServiceNameGenerator](opts ...grpc.DialOption) ClientOptions[T]
func WithServiceResolver ¶
func WithServiceResolver[T ClientServiceNameGenerator](r resolver.Resolver) ClientOptions[T]
type Option ¶
func WithAddress ¶
func WithGrpcServerOptions ¶
func WithGrpcServerOptions[T interface { WithMeta(register.NodeMeta) T }](opts ...grpc.ServerOption) Option[T]
func WithHttpServer ¶
func WithServiceRegister ¶
func WithServiceRegister[T interface { WithMeta(register.NodeMeta) T }](r register.ServiceRegister[T]) Option[T]
type ServerConfig ¶
type Srv ¶
type Srv[T interface { WithMeta(register.NodeMeta) T }] struct { *SrvInfo[T] middleware.RouterGroup // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.