Documentation ¶
Overview ¶
来自blueeye
来自blueeye
Index ¶
- Constants
- Variables
- func AddMember(account, password string) error
- func AllowCORS(writer http.ResponseWriter)
- func Asset(p string, cdn string) string
- func AutoSummary(body string, l int) string
- func CheckAuth(authString string) bool
- func CheckToken(tokenString string) (userName string, err error)
- func ConvertDateTimeStringToTime(timeString string) time.Time
- func ConvertTimeToDateString(time time.Time) string
- func ConvertTimeToDateTimeString(time time.Time) string
- func ConvertTimeToTimeString(time time.Time) string
- func CreateToken(userName string) (tokenString string, err error)
- func Decode(value string, r interface{}) error
- func DisableCache(writer http.ResponseWriter)
- func Encode(value interface{}) (string, error)
- func EncodingAESKey2AESKey(encodingKey string) []byte
- func FetchHttpStatus(code string) int
- func FirstMinuteOfDay(day time.Time) time.Time
- func FirstSecondOfDay(day time.Time) time.Time
- func GenerateToken(expiredSeconds int) (tokenString string)
- func GetAccessToken(app_version string) (accesstoken string, errcode float64, errmsg string, err error)
- func GetFileType(fSrc []byte) string
- func GetHostFromRequest(request *http.Request) string
- func GetIpAddress(r *http.Request) string
- func GetMysqlUrl(mysqlPort int, mysqlHost string, mysqlSchema string, mysqlUsername string, ...) string
- func GetSessionUuidFromRequest(request *http.Request, cookieAuthKey string) string
- func HumanFileSize(bytes int64) string
- func ImgSecCheck(bts []byte, accessToken string) (errcode float64, errmsg string, err error)
- func JoinURI(elem ...string) string
- func JsonResponse(response interface{}, w http.ResponseWriter)
- func Krand(size int, kind int) []byte
- func LastSecondOfDay(day time.Time) time.Time
- func LoginHandler(w http.ResponseWriter, r *http.Request)
- func LubanCheckToken(tokenString string) (userId, userName, userNickname string, err error)
- func ModifyPassword(account, old_password, new_password string) error
- func MsgSecCheck(scene, version int, access_token, openid, content string) (errcode float64, errmsg string, err error)
- func ParseAuthToken()
- func ParseToken(authString string) (t *jwt.Token, err error)
- func PasswordHash(pass string) (string, error)
- func PasswordVerify(hashing string, pass string) (bool, error)
- func RandomNumber4() string
- func RandomString4() string
- func RefreshToken(tokenString string) (string, error)
- func SafetyProcessor(html string) string
- func SendMessage(access_token, openid, template_id string) (errcode float64, errmsg string, err error)
- func StripTags(s string) string
- func SubString(str string, begin, length int) (substr string)
- func TestGetFileType(t *testing.T)
- func TestLog(t *testing.T)
- func Tomorrow() time.Time
- func ValidLDAPLogin(password string) (result bool, err error)
- func ValidateToken(tokenString string) error
- func VerifyToken(tokenString string) bool
- func Yesterday() time.Time
- type CodeWrapper
- type Command
- type Connection
- type Data
- type Message
- type MsgInput
- type MyCustomClaims
- type Response
- type TailFile
- type Token
- type User
- type UserCredentials
- type WebResult
- func BadRequest(format string, v ...interface{}) *WebResult
- func ConstWebResult(codeWrapper *CodeWrapper) *WebResult
- func CustomWebResult(codeWrapper *CodeWrapper, description string) *WebResult
- func NotFound(format string, v ...interface{}) *WebResult
- func Server(format string, v ...interface{}) *WebResult
- func Unauthorized(format string, v ...interface{}) *WebResult
- type WxKeyword
- type WxPushContent
Constants ¶
View Source
const ( KEY string = "JWT-ARY-STARK" DEFAULT_EXPIRE_SECONDS int = 3000 //600 // default 10 minutes //SecretKey = "welcome to wangshubo's blog" SecretKey = "I have login" )
View Source
const ( KC_RAND_KIND_NUM = 0 // 纯数字 KC_RAND_KIND_LOWER = 1 // 小写字母 KC_RAND_KIND_UPPER = 2 // 大写字母 KC_RAND_KIND_ALL = 3 // 数字、大小写字母 )
Variables ¶
View Source
var ( OK = &CodeWrapper{Code: "OK", HttpStatus: http.StatusOK, Description: "ok"} BAD_REQUEST = &CodeWrapper{Code: "BAD_REQUEST", HttpStatus: http.StatusBadRequest, Description: "bad request"} NEED_SHARE_CODE = &CodeWrapper{Code: "NEED_SHARE_CODE", HttpStatus: http.StatusUnauthorized, Description: "share code required"} SHARE_CODE_ERROR = &CodeWrapper{Code: "SHARE_CODE_ERROR", HttpStatus: http.StatusUnauthorized, Description: "share code error"} LOGIN = &CodeWrapper{Code: "LOGIN", HttpStatus: http.StatusUnauthorized, Description: "not login"} USER_DISABLED = &CodeWrapper{Code: "USER_DISABLED", HttpStatus: http.StatusForbidden, Description: "user disabled"} UNAUTHORIZED = &CodeWrapper{Code: "UNAUTHORIZED", HttpStatus: http.StatusUnauthorized, Description: "unauthorized"} NOT_FOUND = &CodeWrapper{Code: "NOT_FOUND", HttpStatus: http.StatusNotFound, Description: "404 not found"} RANGE_NOT_SATISFIABLE = &CodeWrapper{Code: "RANGE_NOT_SATISFIABLE", HttpStatus: http.StatusRequestedRangeNotSatisfiable, Description: "range not satisfiable"} NOT_INSTALLED = &CodeWrapper{Code: "NOT_INSTALLED", HttpStatus: http.StatusInternalServerError, Description: "application not installed"} SERVER = &CodeWrapper{Code: "SERVER", HttpStatus: http.StatusInternalServerError, Description: "server error"} UNKNOWN = &CodeWrapper{Code: "UNKNOWN", HttpStatus: http.StatusInternalServerError, Description: "server unknow error"} )
View Source
var ( DB_ERROR_DUPLICATE_KEY = "Error 1062: Duplicate entry" DB_ERROR_NOT_FOUND = "record not found" DB_TOO_MANY_CONNECTIONS = "Error 1040: Too many connections" DB_BAD_CONNECTION = "driver: bad connection" )
db error.
View Source
var AesKey []byte
View Source
var FileLogs *logs.BeeLogger
var ConsoleLogs *logs.BeeLogger
View Source
var (
SIGN_NAME_SCERET = "aweQurt178BNI"
)
View Source
var Tail = &Command{
UsageLine: `tail -f main.go -l 10 -n 5 -o tmp.txt`,
Run: tail,
Short: "从文件结尾或指定位置读取内容",
Long: `从文件结尾或指定位置读取内容,可以按行读取,也可以按大小读取,-i 和 -l同时使用的话-i生效,-s 与 -n
同时使用的话-s生效`,
}
Functions ¶
func ConvertDateTimeStringToTime ¶
convert time string(yyyy-MM-dd HH:mm:ss) to Time object
func ConvertTimeToDateString ¶
convert Time object to string(yyyy-MM-dd)
func ConvertTimeToDateTimeString ¶
convert Time object to string(yyyy-MM-dd HH:mm:ss)
func ConvertTimeToTimeString ¶
convert Time object to string(HH:mm:ss)
func EncodingAESKey2AESKey ¶
func FetchHttpStatus ¶
func GenerateToken ¶
func GetAccessToken ¶
func GetAccessToken(app_version string) (accesstoken string, errcode float64, errmsg string, err error)
验证token时效性
func GetHostFromRequest ¶
get host from request
func GetMysqlUrl ¶
func GetMysqlUrl( mysqlPort int, mysqlHost string, mysqlSchema string, mysqlUsername string, mysqlPassword string) string
get mysql url.
func GetSessionUuidFromRequest ¶
get cookieAuthKey from request.
func ImgSecCheck ¶
func JsonResponse ¶
func JsonResponse(response interface{}, w http.ResponseWriter)
func LoginHandler ¶
func LoginHandler(w http.ResponseWriter, r *http.Request)
服务端生成token,并放入到response的header * JWT由三部份组成: * Header:头部 (对应:Header) * Claims:声明 (对应:Payload) * Signature:签名 (对应:Signature)
func LubanCheckToken ¶
校验token是否有效 返回参数
func ModifyPassword ¶
func MsgSecCheck ¶
func MsgSecCheck(scene, version int, access_token, openid, content string) (errcode float64, errmsg string, err error)
文本敏感字符检测
func ParseAuthToken ¶
func ParseAuthToken()
func ParseToken ¶
ParseToken parse JWT token in http header.
func RefreshToken ¶
update expireAt and return a new token
func SendMessage ¶
func SendMessage(access_token, openid, template_id string) (errcode float64, errmsg string, err error)
发送订阅消息
func TestGetFileType ¶
func ValidLDAPLogin ¶
func ValidateToken ¶
Types ¶
type CodeWrapper ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func InitConnection ¶
func InitConnection(wsConn *websocket.Conn) (conn *Connection, err error)
func (*Connection) Close ¶
func (conn *Connection) Close()
func (*Connection) ReadMessage ¶
func (conn *Connection) ReadMessage() (data []byte, err error)
func (*Connection) WriteMessage ¶
func (conn *Connection) WriteMessage(data []byte) (err error)
type MyCustomClaims ¶
type MyCustomClaims struct { User jwt.StandardClaims }
JWT -- json web token HEADER PAYLOAD SIGNATURE This struct is the PAYLOAD
type UserCredentials ¶
type WebResult ¶
type WebResult struct { Code string `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data"` }
func BadRequest ¶
func ConstWebResult ¶
func ConstWebResult(codeWrapper *CodeWrapper) *WebResult
func CustomWebResult ¶
func CustomWebResult(codeWrapper *CodeWrapper, description string) *WebResult
func Unauthorized ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package wkhtmltopdf contains wrappers around the wkhtmltopdf commandline tool
|
Package wkhtmltopdf contains wrappers around the wkhtmltopdf commandline tool |
Click to show internal directories.
Click to hide internal directories.