mirror of
https://github.com/genxium/DelayNoMore
synced 2024-12-26 03:39:00 +00:00
31 lines
824 B
Go
31 lines
824 B
Go
|
package common
|
||
|
|
||
|
import (
|
||
|
"regexp"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
RE_PHONE_NUM = regexp.MustCompile(`^\+?[0-9]{8,14}$`)
|
||
|
RE_SMS_CAPTCHA_CODE = regexp.MustCompile(`^[0-9]{4}$`)
|
||
|
RE_CHINA_PHONE_NUM = regexp.MustCompile(`^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$`)
|
||
|
)
|
||
|
|
||
|
var ConstVals = &struct {
|
||
|
Player struct {
|
||
|
CaptchaExpire time.Duration
|
||
|
CaptchaMaxTTL time.Duration
|
||
|
}
|
||
|
Ws struct {
|
||
|
WillKickIfInactiveFor time.Duration
|
||
|
}
|
||
|
}{}
|
||
|
|
||
|
func constantsPost() {
|
||
|
ConstVals.Player.CaptchaExpire = time.Duration(Constants.Player.SmsExpiredSeconds) * time.Second
|
||
|
ConstVals.Player.CaptchaMaxTTL = ConstVals.Player.CaptchaExpire -
|
||
|
time.Duration(Constants.Player.SmsValidResendPeriodSeconds)*time.Second
|
||
|
|
||
|
ConstVals.Ws.WillKickIfInactiveFor = time.Duration(Constants.Ws.WillKickIfInactiveFor) * time.Millisecond
|
||
|
}
|