handlers

package
v0.0.0-...-402233a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2018 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authentication

func Authentication(w http.ResponseWriter, r *http.Request)

身份认证

func Backup

func Backup(w http.ResponseWriter, r *http.Request)

备份数据库

func Broadcast

func Broadcast(w http.ResponseWriter, r *http.Request)

广播消息

func Deposit

func Deposit(w http.ResponseWriter, r *http.Request)

充值资产

func GetActions

func GetActions(w http.ResponseWriter, r *http.Request)

获取用户操作

func GetBalance

func GetBalance(w http.ResponseWriter, r *http.Request)

获取余额

func GetLuckymoney

func GetLuckymoney(w http.ResponseWriter, r *http.Request)

获取红包信息

func NewAuthenticatorOnce

func NewAuthenticatorOnce()

创建验证器

func Subscribers

func Subscribers(w http.ResponseWriter, r *http.Request)

获取订户

Types

type AuthRequest

type AuthRequest struct {
	Tonce int64 `json:"tonce"` // 时间戳
}

身份认证请求

type AuthRespone

type AuthRespone struct {
	SessionID string `json:"session_id"` // 会话ID
}

身份认证响应

type Authenticator

type Authenticator struct {
	// contains filtered or unexported fields
}

验证器

func (*Authenticator) Auth

func (a *Authenticator) Auth(ip string, data []byte) (string, bool)

验证身份

func (*Authenticator) Decode

func (a *Authenticator) Decode(data []byte) (string, []byte, bool)

解码消息

func (*Authenticator) Encode

func (a *Authenticator) Encode(sessionID string, data []byte) []byte

编码消息

func (*Authenticator) KeepAlive

func (a *Authenticator) KeepAlive(sessionID string)

保持活跃

type BackupRequest

type BackupRequest struct {
	Tonce int64 `json:"tonce"` // 时间戳
}

备份数据库请求

type BroadcastRequest

type BroadcastRequest struct {
	Message string `json:"message"` // 消息内容
	Tonce   int64  `json:"tonce"`   // 时间戳
}

广播消息请求

type BroadcastRespone

type BroadcastRespone struct {
	OK bool `json:"ok"` // 是否成功
}

广播消息响应

type Ciphertext

type Ciphertext struct {
	ACK      bool   `json:"ack"`
	Session  string `json:"session,omitempty"`
	Data     string `json:"data"`
	Checksum uint32 `json:"checksum"`
}

密文消息

func (*Ciphertext) Decode

func (msg *Ciphertext) Decode(key [16]byte) ([]byte, bool)

解密消息

func (*Ciphertext) Encode

func (msg *Ciphertext) Encode(src []byte, key [16]byte) error

加密消息

type DepositRequest

type DepositRequest struct {
	UserID int64      `json:"user_id"` // 用户ID
	Amount *big.Float `json:"amount"`  // 充值金额
	Tonce  int64      `json:"tonce"`   // 时间戳
}

充值请求

type DepositRespone

type DepositRespone struct {
	Amount *big.Float `json:"amount"` // 可用余额
	Locked *big.Float `json:"locked"` // 锁定金额
}

充值响应

type GetActionsRequest

type GetActionsRequest struct {
	UserID int64 `json:"user_id"` // 用户ID
	Offset uint  `json:"offset"`  // 偏移量
	Limit  uint  `json:"limit"`   // 返回数量
	Tonce  int64 `json:"tonce"`   // 时间戳
}

获取动作请求

type GetActionsRespone

type GetActionsRespone struct {
	Sum     int               `json:"sum"`     // 动作总量
	Count   int               `json:"count"`   // 返回数量
	Actions []*models.Version `json:"actions"` // 动作列表
}

获取动作响应

type GetBalanceRequest

type GetBalanceRequest struct {
	UserID int64 `json:"user_id"` // 用户ID
	Tonce  int64 `json:"tonce"`   // 时间戳
}

获取余额请求

type GetBalanceRespone

type GetBalanceRespone struct {
	Amount *big.Float `json:"amount"` // 可用余额
	Locked *big.Float `json:"locked"` // 锁定金额
}

获取余额响应

type GetLuckymoneyRequest

type GetLuckymoneyRequest struct {
	UserID int64 `json:"user_id"` // 用户ID
	Offset uint  `json:"offset"`  // 偏移量
	Limit  uint  `json:"limit"`   // 返回数量
	Tonce  int64 `json:"tonce"`   // 时间戳
}

获取红包请求

type GetLuckymoneyRespone

type GetLuckymoneyRespone struct {
	Sum    int           `json:"sum"`    // 动作总量
	Count  int           `json:"count"`  // 返回数量
	Result []*Luckymoney `json:"result"` // 红包列表
}

获取红包响应

type GetSubscribersRequest

type GetSubscribersRequest struct {
	Tonce int64 `json:"tonce"` // 时间戳
}

获取订户请求

type Luckymoney

type Luckymoney struct {
	*models.LuckyMoney
	Count uint32 `json:"count"`
}

红包信息

type Session

type Session struct {
	ID        string
	IP        string
	Key       string
	CreatedAt int64
	ExpiredAt int64
}

会话

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL