Documentation ¶
Index ¶
- Constants
- func BoolToString(flag bool) string
- func GetArgs(args ...string) (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 string)
- func GetRedisPeerKey(sid, uid string) string
- func GetRedisPeersPrefixKey(sid string) string
- func GetRedisRoomKey(sid string) string
- func GetServiceInfo(nc nrpc.NatsConn, nid string, selfnid string) (map[string][]*reflection.MethodDescriptor, error)
- func NewNatsConn(url string) (*nats.Conn, error)
- func RandomString(n int) string
- func Recover(flag string)
- func StringToBool(flag string) bool
- type AtomicBool
- type ClientConnInterface
- type ServiceInterface
- type WrapperedGRPCWebServer
- type WrapperedServerOptions
Constants ¶
View Source
const ( DefaultStatCycle = time.Second * 3 DefaultGRPCTimeout = 15 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func BoolToString ¶ added in v1.10.0
func GetRedisPeerKey ¶ added in v1.10.0
func GetRedisPeersPrefixKey ¶ added in v1.10.0
func GetRedisRoomKey ¶ added in v1.10.0
func GetServiceInfo ¶ added in v1.9.1
func GetServiceInfo(nc nrpc.NatsConn, nid string, selfnid string) (map[string][]*reflection.MethodDescriptor, error)
Get service information through reflection, this feature can be used to create json-rpc, restful API
func RandomString ¶ added in v1.5.0
RandomString generate a random string
func StringToBool ¶ added in v1.10.0
Types ¶
type AtomicBool ¶ added in v1.5.0
type AtomicBool struct {
// contains filtered or unexported fields
}
AtomicBool represents a atomic bool
func (*AtomicBool) Set ¶ added in v1.5.0
func (b *AtomicBool) Set(value bool) (swapped bool)
Set atomic bool
type ClientConnInterface ¶ added in v1.9.0
type ClientConnInterface interface { grpc.ClientConnInterface Close() error }
ClientConnInterface .
func NewGRPCClientConnForNode ¶ added in v1.9.0
func NewGRPCClientConnForNode(node discovery.Node) (ClientConnInterface, error)
NewGRPCClientForNode .
type ServiceInterface ¶ added in v1.9.0
type ServiceInterface interface { grpc.ServiceRegistrar Serve(lis net.Listener) error Stop() }
ServiceInterface .
func NewGRPCServiceForNode ¶ added in v1.9.0
func NewGRPCServiceForNode(node discovery.Node) (ServiceInterface, error)
NewGRPCServiceForNode .
type WrapperedGRPCWebServer ¶ added in v1.10.0
type WrapperedGRPCWebServer struct { GRPCServer *grpc.Server // contains filtered or unexported fields }
func NewWrapperedGRPCWebServer ¶ added in v1.10.0
func NewWrapperedGRPCWebServer(options WrapperedServerOptions, s *grpc.Server) *WrapperedGRPCWebServer
func (*WrapperedGRPCWebServer) Serve ¶ added in v1.10.0
func (s *WrapperedGRPCWebServer) Serve() error
type WrapperedServerOptions ¶ added in v1.10.0
type WrapperedServerOptions struct { Addr string Cert string Key string AllowAllOrigins bool AllowedOrigins *[]string AllowedHeaders *[]string UseWebSocket bool WebsocketPingInterval time.Duration }
func DefaultWrapperedServerOptions ¶ added in v1.10.0
func DefaultWrapperedServerOptions() WrapperedServerOptions
func NewWrapperedServerOptions ¶ added in v1.10.0
func NewWrapperedServerOptions(addr, cert, key string, websocket bool) WrapperedServerOptions
Click to show internal directories.
Click to hide internal directories.