Documentation ¶
Index ¶
- Constants
- Variables
- func CheckEmailFormat(email string) bool
- func GetPasswordHash(password string) string
- func GetTimeNow() time.Time
- func LoadConfig(config string) (*anyvalue.AnyValue, error)
- func RandomString(n int) string
- func Response200(c *gin.Context, data interface{})
- func Response400(c *gin.Context, code int)
- func Response500(c *gin.Context, code int)
- type Conn
- type LoginReq
- type ProcessHandler
- type RegisterReq
- type WebSocketConn
- type WsManager
Constants ¶
View Source
const ( RESP_SUCCESS_CODE = 0 RESP_PARAM_ERROR_CODE = 1000 RESP_USER_NOT_FOUND_CODE = 1001 RESP_USER_EMAIL_ERROR = 1002 RESP_USER_PASSWORD_ERROR = 1003 RESP_USER_EXIST_CODE = 1004 RESP_INTERNAL_ERROR_CODE = 1099 )
View Source
const ( SERVICE_NAME = "task-monitor-service" WEBSOCKET_NAME = "ws://127.0.0.1:9010/ws" )
View Source
const ( PASSWORD_SALT = "sLx2j3SfvE&" PASSWORD_MIN_LENGTH = 6 )
View Source
const ( TOKEN_TIME_LEFT = 3600 * 24 * 7 TOKEN_KEY = SERVICE_NAME + ":token:" )
View Source
const ( TCP_WRITE_BUFFER_SIZE = 524288 TCP_READ_BUFFER_SIZE = 524288 CH_WEBSOCKET_WRITE_SIZE = 2000 TRAFFIC_LIMIT_INTERVAL = 10 )
Variables ¶
View Source
var Config *anyvalue.AnyValue
View Source
var DBClient *gorm.DB
View Source
var RESPONSE_TEXT = map[int]string{
0: "success",
1000: "param error",
1001: "invalid username or password",
1002: "invalid email",
1003: "invalid password",
1004: "user exist",
1099: "internal error",
}
View Source
var RedisClient *redis.Client
Functions ¶
func CheckEmailFormat ¶
func GetPasswordHash ¶
func GetTimeNow ¶
func RandomString ¶
func Response200 ¶
func Response400 ¶
func Response500 ¶
Types ¶
type ProcessHandler ¶
type RegisterReq ¶
type WebSocketConn ¶
type WebSocketConn struct {
// contains filtered or unexported fields
}
func NewWebSocketConn ¶
func NewWebSocketConn(conn *websocket.Conn, handler ProcessHandler) *WebSocketConn
new websocket connection
func (*WebSocketConn) Close ¶
func (wsc *WebSocketConn) Close(flag bool) error
func (*WebSocketConn) Id ¶
func (wsc *WebSocketConn) Id() string
func (*WebSocketConn) IsClosed ¶
func (wsc *WebSocketConn) IsClosed() bool
func (*WebSocketConn) Read ¶
func (wsc *WebSocketConn) Read()
func (*WebSocketConn) Send ¶
func (wsc *WebSocketConn) Send(pkt []byte)
func (*WebSocketConn) String ¶
func (wsc *WebSocketConn) String() string
func (*WebSocketConn) Write ¶
func (wsc *WebSocketConn) Write()
type WsManager ¶
type WsManager struct {
// contains filtered or unexported fields
}
func NewConnectionPool ¶
func (*WsManager) OnConnected ¶
Click to show internal directories.
Click to hide internal directories.