Documentation ¶
Index ¶
- func BtsEqualFold(s, p []byte) bool
- func BtsHasToken(header, token []byte) (has bool)
- func GetObjectTypeName(obj interface{}) string
- func GetPk(obj interface{}) string
- func GraphQLSmartErrorMessageBytes(msg interface{}) []byte
- func IsHMACAlg(token []byte) bool
- func IsObjectStructType(obj interface{}) bool
- func Iterator(o *OMap) *iterator
- func JWTTokenAuth(ctx *HContext) *graphql.Field
- func JWTTokenVerify(ctx *HContext) *graphql.Field
- func LoadPrivateKey(data []byte) (interface{}, error)
- func ParseGraphQLData(gqlData []byte) (string, map[string]interface{}, error)
- func StrEqualFold(s, p string) bool
- func StrHasToken(header, token string) (has bool)
- func StrToBytes(str string) (bts []byte)
- func VerifyJWT(token []byte, authPublicKey []byte, authSecretKey []byte, authBearer string, ...) (map[string]interface{}, bool)
- func WebsocketFileDescriptor(conn net.Conn) int
- type AuthVerify
- type AuthVerifyInterface
- type EventPool
- func (e *EventPool) AddConnection(conn net.Conn) error
- func (e *EventPool) GetConnection(cid int) (net.Conn, bool)
- func (e *EventPool) GetWebSocketConnectionIdSlice() []int
- func (e *EventPool) GetWebSocketConnectionMap() map[int]net.Conn
- func (e *EventPool) GetWebSocketConnectionSlice() []net.Conn
- func (e *EventPool) RemoveConnection(conn net.Conn) error
- func (e *EventPool) TotalActiveWebSocketConnections() int
- func (e *EventPool) Wait() ([]net.Conn, error)
- type HContext
- func (c *HContext) AddAuthMutationField(name string, field *graphql.Field)
- func (c *HContext) AddAuthQueryField(name string, field *graphql.Field)
- func (c *HContext) AddConnection(conn net.Conn) error
- func (c *HContext) AddGraphQLMutationField(name string, field *graphql.Field)
- func (c *HContext) AddGraphQLQueryField(name string, field *graphql.Field)
- func (c *HContext) AddMiddleware(mi MiddlewareInterface)
- func (c *HContext) AddObject(obj interface{}) bool
- func (c *HContext) AddRoute(pattern string, httpHandlerObject ServeHTTPInterface)
- func (c *HContext) AddUser(uid string, group string, sid int)
- func (c *HContext) ClearKeyValueStore()
- func (c *HContext) DeleteFromStorage(key []byte) bool
- func (c *HContext) DeleteObject(obj interface{}) bool
- func (c *HContext) GetConnection(cid int) (net.Conn, bool)
- func (c *HContext) GetFromStorage(key []byte) ([]byte, bool)
- func (c *HContext) GetGroupFromSID(sid int) string
- func (c *HContext) GetIdList(uid string) []int
- func (c *HContext) GetIsLive() bool
- func (c *HContext) GetObject(obj interface{}) bool
- func (c *HContext) GetTotalUID() int
- func (c *HContext) GetUIDFromSID(sid int) string
- func (c *HContext) GetUIDList() []string
- func (c *HContext) GetValue(key string) string
- func (c *HContext) GetWebSocketConnectionIdSlice() []int
- func (c *HContext) GetWebSocketConnectionMap() map[int]net.Conn
- func (c *HContext) GetWebSocketConnectionSlice() []net.Conn
- func (c *HContext) HasAuthVerify() bool
- func (c *HContext) HasWSServer() bool
- func (c *HContext) IsExistsInStorage(key []byte) bool
- func (c *HContext) IsObjectExists(obj interface{}) bool
- func (c *HContext) IsStorageEngineReady() bool
- func (c *HContext) RemoveConnection(conn net.Conn) error
- func (c *HContext) RemoveUser(sid int)
- func (c *HContext) RemoveValue(key string)
- func (c *HContext) SaveToStorage(key []byte, value []byte) bool
- func (c *HContext) SetIsLive(live bool)
- func (c *HContext) SetKeyValueStore(dataMap map[string]string)
- func (c *HContext) SetValue(key string, value string)
- func (c *HContext) TotalActiveWebSocketConnections() int
- func (c *HContext) WriteLowLevelMessage(connectionId int, opCode ws.OpCode, message []byte)
- func (c *HContext) WriteMessage(connectionId int, message []byte)
- type MiddlewareInterface
- type OMap
- func (o *OMap) Append(key, value interface{})
- func (o *OMap) DeleteByFirst(value interface{}) bool
- func (o *OMap) DeleteByIndex(index int) bool
- func (o *OMap) DeleteBySecond(value interface{}) bool
- func (o *OMap) Get(index int) (interface{}, interface{})
- func (o *OMap) GetByFirst(value interface{}) interface{}
- func (o *OMap) GetBySecond(value interface{}) interface{}
- func (o *OMap) GetFirstByIndex(index int) interface{}
- func (o *OMap) GetSecondByIndex(index int) interface{}
- func (o *OMap) IsCompatible() bool
- func (o *OMap) Length() int
- func (o *OMap) New(first []interface{}, second []interface{}) *OMap
- type OnlineUserDataStoreInterface
- type OnlineUserMemoryMap
- func (o *OnlineUserMemoryMap) AddUser(uid string, group string, sid int)
- func (o *OnlineUserMemoryMap) GetGroupFromSID(sid int) string
- func (o *OnlineUserMemoryMap) GetIdList(uid string) []int
- func (o *OnlineUserMemoryMap) GetTotalUID() int
- func (o *OnlineUserMemoryMap) GetUIDFromSID(sid int) string
- func (o *OnlineUserMemoryMap) GetUIDList() []string
- func (o *OnlineUserMemoryMap) RemoveUser(sid int)
- type Route
- type ServeHTTPInterface
- type ServeWSGraphQL
- type ServeWSInterface
- type ServiceInterface
- type ServiceRegistry
- type SettingsInterface
- type StorageInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BtsEqualFold ¶
btsEqualFold checks s to be case insensitive equal to p. Note that p must be only ascii letters. That is, every byte in p belongs to range ['a','z'] or ['A','Z'].
func BtsHasToken ¶
func GetObjectTypeName ¶
func GetObjectTypeName(obj interface{}) string
func GraphQLSmartErrorMessageBytes ¶
func GraphQLSmartErrorMessageBytes(msg interface{}) []byte
func IsObjectStructType ¶
func IsObjectStructType(obj interface{}) bool
func JWTTokenAuth ¶
func JWTTokenVerify ¶
func LoadPrivateKey ¶
func ParseGraphQLData ¶
func StrEqualFold ¶
StrEqualFold checks s to be case insensitive equal to p. Note that p must be only ascii letters. That is, every byte in p belongs to range ['a','z'] or ['A','Z'].
func StrHasToken ¶
func StrToBytes ¶
func WebsocketFileDescriptor ¶
Types ¶
type AuthVerify ¶
type AuthVerify struct { }
type AuthVerifyInterface ¶
type EventPool ¶
type EventPool struct {
// contains filtered or unexported fields
}
func MakeCustomEventPool ¶
func MakeEventPool ¶
func (*EventPool) GetWebSocketConnectionIdSlice ¶
func (*EventPool) GetWebSocketConnectionMap ¶
func (*EventPool) GetWebSocketConnectionSlice ¶
func (*EventPool) TotalActiveWebSocketConnections ¶
type HContext ¶
type HContext struct { Host string // read only Port string // read only EPollEventQueueSize int //read only EPollWaitingTime int //read only EnableTLS bool //read only CertFile string //read only KeyFile string //read only ServerMux *http.ServeMux ConnectionEventPool *EventPool IsLive bool // read write Lock *sync.RWMutex // mutex for modifiable params AuthVerify AuthVerifyInterface // read only ServeWS ServeWSInterface // read only AuthBearer string // read only AuthPublicKey string // read only AuthPrivateKey string // read only AuthSecretKey string // read only AuthAlgorithm string // read only AuthIssuer string // read only AuthAudiences []string // read only AuthTokenDefaultTimeout int64 // seconds AuthTokenSuperGroupTimeout int64 // seconds AuthTokenServiceGroupTimeout int64 // seconds AuthTokenNormalGroupTimeout int64 // seconds OnlineUserDataStore OnlineUserDataStoreInterface // read only LivePath []byte // read only AuthPath []byte // read only GraphQLPath []byte // read only WebSocketUpgradePath []byte // read only MiddlewareList []MiddlewareInterface // read only while running the server RouteList []*Route // read only while running the server KeyValueStore map[string]string StorageEngine StorageInterface DbPath string //GraphQL related Objects //GraphQLQuery *graphql.Object //GraphQLMutation *graphql.Object GraphQLQueryFields graphql.Fields GraphQLMutationFields graphql.Fields GraphQLSchema *graphql.Schema AuthQueryFields graphql.Fields AuthMutationFields graphql.Fields AuthSchema *graphql.Schema EnableLivePath bool EnableAuthPath bool EnableGraphQLPath bool EnableWebSocketPath bool CORSOptions *cors.Options }
func (*HContext) AddAuthMutationField ¶
func (*HContext) AddAuthQueryField ¶
func (*HContext) AddGraphQLMutationField ¶
func (*HContext) AddGraphQLQueryField ¶
func (*HContext) AddMiddleware ¶
func (c *HContext) AddMiddleware(mi MiddlewareInterface)
func (*HContext) AddRoute ¶
func (c *HContext) AddRoute(pattern string, httpHandlerObject ServeHTTPInterface)
func (*HContext) ClearKeyValueStore ¶
func (c *HContext) ClearKeyValueStore()
func (*HContext) DeleteFromStorage ¶
func (*HContext) DeleteObject ¶
func (*HContext) GetGroupFromSID ¶
func (*HContext) GetTotalUID ¶
func (*HContext) GetUIDFromSID ¶
func (*HContext) GetUIDList ¶
func (*HContext) GetWebSocketConnectionIdSlice ¶
func (*HContext) GetWebSocketConnectionMap ¶
func (*HContext) GetWebSocketConnectionSlice ¶
func (*HContext) HasAuthVerify ¶
func (*HContext) HasWSServer ¶
func (*HContext) IsExistsInStorage ¶
func (*HContext) IsObjectExists ¶
func (*HContext) IsStorageEngineReady ¶
func (*HContext) RemoveUser ¶
func (*HContext) RemoveValue ¶
func (*HContext) SetKeyValueStore ¶
func (*HContext) TotalActiveWebSocketConnections ¶
func (*HContext) WriteLowLevelMessage ¶
func (*HContext) WriteMessage ¶
type MiddlewareInterface ¶
type OMap ¶
type OMap struct {
// contains filtered or unexported fields
}
Thread safe One One Map
func (*OMap) DeleteByFirst ¶
func (*OMap) DeleteByIndex ¶
func (*OMap) DeleteBySecond ¶
func (*OMap) GetByFirst ¶
func (o *OMap) GetByFirst(value interface{}) interface{}
func (*OMap) GetBySecond ¶
func (o *OMap) GetBySecond(value interface{}) interface{}
func (*OMap) GetFirstByIndex ¶
func (*OMap) GetSecondByIndex ¶
func (*OMap) IsCompatible ¶
type OnlineUserMemoryMap ¶
type OnlineUserMemoryMap struct { UserMap map[string][]int SocketIDToUserMap map[int]string SocketIDToUserGroupMap map[int]string UserMapLock *sync.RWMutex }
func NewOnlineUserMemoryMap ¶
func NewOnlineUserMemoryMap() *OnlineUserMemoryMap
func (*OnlineUserMemoryMap) AddUser ¶
func (o *OnlineUserMemoryMap) AddUser(uid string, group string, sid int)
func (*OnlineUserMemoryMap) GetGroupFromSID ¶
func (o *OnlineUserMemoryMap) GetGroupFromSID(sid int) string
func (*OnlineUserMemoryMap) GetIdList ¶
func (o *OnlineUserMemoryMap) GetIdList(uid string) []int
func (*OnlineUserMemoryMap) GetTotalUID ¶
func (o *OnlineUserMemoryMap) GetTotalUID() int
func (*OnlineUserMemoryMap) GetUIDFromSID ¶
func (o *OnlineUserMemoryMap) GetUIDFromSID(sid int) string
func (*OnlineUserMemoryMap) GetUIDList ¶
func (o *OnlineUserMemoryMap) GetUIDList() []string
func (*OnlineUserMemoryMap) RemoveUser ¶
func (o *OnlineUserMemoryMap) RemoveUser(sid int)
type Route ¶
type Route struct { Pattern string HttpHandlerObject ServeHTTPInterface }
type ServeHTTPInterface ¶
type ServeHTTPInterface interface {
ServeHTTP(ctx *HContext, request *http.Request, response http.ResponseWriter)
}
type ServeWSGraphQL ¶
type ServeWSGraphQL struct { }
type ServeWSInterface ¶
type ServiceInterface ¶
type ServiceRegistry ¶
type ServiceRegistry struct {
ServiceMap map[string]ServiceInterface
}
func NewServiceRegistry ¶
func NewServiceRegistry() *ServiceRegistry
func (*ServiceRegistry) Get ¶
func (sr *ServiceRegistry) Get(name string) (ServiceInterface, bool)
func (*ServiceRegistry) RegisterService ¶
func (sr *ServiceRegistry) RegisterService(si ServiceInterface)
func (*ServiceRegistry) SetServiceSettings ¶
func (sr *ServiceRegistry) SetServiceSettings(name string, data []byte) bool
type SettingsInterface ¶
Source Files ¶
- authverify.go
- authverifyinterface.go
- eventpool.go
- graphqlutils.go
- hcontext.go
- jwttokenauth.go
- jwtutils.go
- middlewareinterface.go
- omap.go
- onlineuserdatastoreinterface.go
- onlineusermemorymap.go
- route.go
- servehttpinterface.go
- servewsgraphql.go
- servewsinterface.go
- serviceinterface.go
- serviceregistry.go
- settingsinterface.go
- storageinterface.go
- utils.go
Click to show internal directories.
Click to hide internal directories.