Documentation ¶
Index ¶
- Constants
- func AddZone()
- func DelUserHash(uid uint64, did string, token string)
- func DelZone()
- func Do(args ...interface{}) (cmd *redis.Cmd)
- func Exists(key string) (yes bool)
- func FindLivingUids(uid uint64) (ret map[string][]string)
- func Get(key string) (val string)
- func GetClient() redis.Cmdable
- func GetClientFor(readOnly bool) redis.Cmdable
- func GetClientForWrite() redis.Cmdable
- func GetRedisRd() redis.Cmdable
- func GetRedisRw() redis.Cmdable
- func GetUserToken(uid uint64, did string) (token string, err error)
- func GetUserZone(uid uint64, did string) (zoneId string, err error)
- func HashDel(key, field string)
- func HashExists(key, field string) bool
- func HashGet(key, field string) (st *redis.StringCmd)
- func HashPut(key, field string, val interface{})
- func IsUserInZone(uid uint64, did string, zoneId string) (yes bool)
- func IsUserTokenValid(token string) (valid bool)
- func JwtDecodeToken(tokenString string) (token *jwt.Token, valid bool, err error)
- func JwtExtract(c echo.Context) (token *jwt.Token, valid bool, err error)
- func JwtExtractToken(tokenString string) (token *jwt.Token, err error)
- func JwtInit()
- func JwtSign(userId, deviceId string) (string, error)
- func JwtVerifyToken(tokenString string) (valid bool, err error)
- func ListGet(key string) (list []interface{})
- func ListPut(key string, val interface{})
- func PipelineExec(fn func(pipeline redis.Pipeliner) (err error)) (err error)
- func Publish(channel string, message interface{}) *redis.IntCmd
- func Put(key string, val interface{})
- func PutUserHash(uid uint64, did string, token string, expire time.Duration)
- func Start()
- func StartWithConfig(config *Config)
- func Stop()
- func Subscribe(channels ...string) (pubsub *redis.PubSub)
- func TokenToUserId(token string) (uid uint64, did string)
- func TxPipelineExec(fn func(pipeline redis.Pipeliner) (err error)) (err error)
- func Watch(fn func(*redis.Tx) error, keys ...string) error
- type Config
- type Hub
Constants ¶
View Source
const ( AlgorithmHS256 = "HS256" DefaultSigningKey = "fxxking-secrets-here" )
Variables ¶
This section is empty.
Functions ¶
func DelUserHash ¶
func FindLivingUids ¶
func GetClientFor ¶
func GetClientForWrite ¶
func GetRedisRd ¶
func GetRedisRw ¶
func GetUserToken ¶
返回值 err == redis.Nil 表示 uid+did 不存在, 此时并非关键性错误
func GetUserZone ¶
返回值 err == redis.Nil 表示 uid+did 不存在, 此时并非关键性错误
func HashExists ¶
func IsUserTokenValid ¶
func JwtDecodeToken ¶
func JwtExtractToken ¶
func JwtVerifyToken ¶
func PutUserHash ¶
* <root>
"tokens":token = uid(hex) -> did "token-to-zone":token = zoneId "users":uid:did = token "zones":zoneId = token
<root>:
im-core: zones: z: []zid // instance id t: // tokens... <zid>: tks: []token // token string usr: // users and devices... <uid>:<did>: = token // token string u: <uid>:<did>: = token
func StartWithConfig ¶
func StartWithConfig(config *Config)
func TokenToUserId ¶
func TxPipelineExec ¶
Types ¶
type Config ¶
type Config struct { Peers []string `yaml:"peers"` Username string `yaml:"user"'` Password string `yaml:"pass"` Db int `yaml:"db"` ReadonlyRoute bool `yaml:readonly-route` DialTimeout time.Duration `yaml:"dial-timeout"` ReadTimeout time.Duration `yaml:"read-timeout"` WriteTimeout time.Duration `yaml:"write-timeout"` EnableCluster bool `yaml:"enable-cluster"` }
Click to show internal directories.
Click to hide internal directories.