-
Notifications
You must be signed in to change notification settings - Fork 0
/
const.go
97 lines (86 loc) · 2.7 KB
/
const.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package main
import "time"
const (
// TokenStateIdle is that the token state is idle, and the token is unavailable
// at this time, and it needs to wait for subsequent authorization.
// When the idle time exceeds 1 minute, the token becomes invalid.
TokenStateIdle = 1
// TokenStateActivated means that the current token is activated and
// can be used only after authorization.
// If it is not authorized within 1 minute, the token will become invalid.
TokenStateActivated = 2
// TokenStateAuthorized means that the token is authorized,
// this state is hidden and invisible in the system.
// When the token is authorized, the token will be associated with the user.
TokenStateAuthorized = 4
)
const (
// Version is current version number
Version = 20
// VersionName is current version name
VersionName = "0.0.20"
// DBVersion is current database version number
DBVersion = 1
)
const (
// ExpireTimeToken is token expire time
ExpireTimeToken = 30 * 24 * time.Hour
// ExpireTimeTokenOnce is temporary authorization, only once
ExpireTimeTokenOnce = 2 * time.Hour
// ExpireTimeChallenge is challenge expire time
ExpireTimeChallenge = 1 * time.Minute
// ExpireTimeChallengeConfirm is authorized party's final confirmation time
ExpireTimeChallengeConfirm = 15 * time.Second
// ExpireTimeIPInfo is ipinfo expire time
ExpireTimeIPInfo = 7 * 24 * time.Hour
)
// HTML template
const (
// TplIndexHTML is index html template
TplIndexHTML = "index.html"
)
const (
// DefaultLanguage is article default language
DefaultLanguage = "en"
)
// HTTP URL query key
const (
// QueryLang is http url query `lang` key
QueryLang = "lang"
// QueryCode is http url query `code` key
QueryCode = "code"
)
// HTTP Header key
const (
// HeaderAccept means http header `accept` field
HeaderAccept = "Accept"
// HeaderContentType means http header `Content-Type` field
HeaderContentType = "Content-Type"
// HeaderAuthorization means http header `Authorization` field
HeaderAuthorization = "Authorization"
// HeaderAcceptLanguage means http header `Accept-Language`field
HeaderAcceptLanguage = "Accept-Language"
// HeaderUserAgent means http header `User-Agent`field
HeaderUserAgent = "User-Agent"
)
// HTTP cookies key
const (
// CookieToken means http cookie `access_token`field
CookieToken = "access_token"
// CookieUserLang means http cookie `user-lang`field
CookieUserLang = "user-lang"
)
// Gin set keys
const (
// GinKeyUserID means gin context keys `user_id` field
GinKeyUserID = "user_id"
// GinKeyChallenge means gin context keys `challenge` field
GinKeyChallenge = "challenge"
)
// Redis Key
const (
// SF is static file short word
SF = "sf:"
// SFVersion is current static file version code
SFVersion = "sf_version"
)