Documentation ¶
Overview ¶
Package app 应用配置(包含路由和CheckSum计算)
收到IM信令后,根据信令名(例如:msg/foo/bar),查询信息的处理路由。 可以提供多种路由设置与维护方式,包括:本地配置文件、Redis服务、etcd服务和consul服务。
Index ¶
Constants ¶
View Source
const (
// ContextAppController AppController名
ContextAppController contextKey = "zim/appcontroller"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { ID string `json:"id"` Key string `json:"key"` KeyBytes []byte `json:"-"` RouteMap InfoMap `json:"router"` Router *Router `json:"-"` TokenCheck string `json:"token-check"` }
App 应用数据
func GetAppFromContext ¶
GetAppFromContext 从Context获取App
func (*App) CheckSumMD5 ¶
CheckSumMD5 取得CheckSum MD5算法
func (*App) CheckSumSHA1 ¶
CheckSumSHA1 取得CheckSum SHA1算法
func (*App) CheckSumSHA256 ¶
CheckSumSHA256 取得CheckSum SHA256算法
type CheckSum ¶
type CheckSum interface { CheckSumSHA1(fields ...[]byte) string CheckSumSHA256(fields ...[]byte) string CheckSumMD5(fields ...[]byte) string }
CheckSum CheckSum接口
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller App map controller
func NewController ¶
func NewController(configs []string) (*Controller, error)
NewController create a new controller from configs
func (*Controller) AddApp ¶
func (controller *Controller) AddApp(app *App)
AddApp append an app into map (multi-thread unsafe!)
func (*Controller) GetApp ¶
func (controller *Controller) GetApp(appid string) *App
GetApp find app by app ID
func (*Controller) SaveIntoContext ¶
func (controller *Controller) SaveIntoContext(ctx context.Context) context.Context
SaveIntoContext 设置AppController到Context中
Click to show internal directories.
Click to hide internal directories.