Documentation ¶
Index ¶
- Constants
- func AesDecode(encryptedString, key string) (string, error)
- func AesEncode(rawString, key string) (string, error)
- func Base64Decode(encodedString string) ([]byte, error)
- func Base64Encode(rawBytes []byte) string
- func FileAppendContents(content []byte, dst string) error
- func FileExists(dst string) bool
- func FileExistsWithError(dst string) (bool, error)
- func FileExt(filename string) string
- func FileGetContents(filename string) ([]byte, error)
- func FileGetContentsReadLine(dst string) (<-chan string, error)
- func FilePutContents(content []byte, dst string) error
- func GenerateVAPIDKeys() (privateKey string, publicKey string, err error)
- func GetLocalIP() (string, error)
- func ListeningExitSignal(wg *sync.WaitGroup)
- func RSADecrypt(encodedString string, privateKey []byte) (string, error)
- func RSAEncrypt(rawString string, publicKey []byte) (string, error)
- func RSASign(rawStringBytes, privateKey []byte) (string, error)
- func RSAVerifySign(rawStringBytes, sign, publicKey []byte) (bool, error)
- func RandomDigitalChars(length int) string
- func RandomLetters(length int) string
- func RedisClusterLock(key string) bool
- func RedisClusterUnlock(key string)
- func RedisLock(key string) bool
- func RedisUnlock(key string)
- func SaveFile2Dst(file *multipart.FileHeader, dst string) error
- func SendNotification(privateKey, publicKey string, sub webpush.Subscription, subscriberEmail string, ...) error
- func ValidateEmail(email string) bool
- func Wordwrap(rawStr string, length int, split string) string
- func WrapRedisKey(appName, key string) string
- type Payload
- type PayloadDataField
- type TIM
Constants ¶
View Source
const KEY = "fakeKeyChangeMe!"
KEY 密钥
Variables ¶
This section is empty.
Functions ¶
func FileGetContentsReadLine ¶
FileGetContentsReadLine 逐行读取文件内容
func GenerateVAPIDKeys ¶ added in v2.0.2
GenerateVAPIDKeys 生成web push的公私钥
func GetLocalIP ¶
func ListeningExitSignal ¶
ListeningExitSignal 监听系统退出信号
func RSADecrypt ¶
RSADecrypt rsa解密
func RSAEncrypt ¶
RSAEncrypt rsa加密
func RSAVerifySign ¶
RSAVerifySign rsa验签
func RedisClusterUnlock ¶ added in v2.0.2
func RedisClusterUnlock(key string)
RedisClusterUnlock redis锁-解锁(使用cluster)
using SetNX
func SaveFile2Dst ¶
func SaveFile2Dst(file *multipart.FileHeader, dst string) error
SaveFile2Dst 将文件保存到目标地址(拷贝文件)
file *multipart.FileHeader 文件
dst string 拷贝到的目标地址
func SendNotification ¶ added in v2.0.2
func SendNotification(privateKey, publicKey string, sub webpush.Subscription, subscriberEmail string, body Payload) error
SendNotification 发送通知
func WrapRedisKey ¶
WrapRedisKey 包装redis键名
给redis的键加入应用名前缀,如:
appName=game key=user
最终的redis键名为:game:user
此方法的主要作用是按应用来划分redis键名
Types ¶
type Payload ¶ added in v2.0.2
type Payload struct { Title string `json:"title"` Body string `json:"body"` Icon string `json:"icon"` Data PayloadDataField `json:"data"` Badge string `json:"badge"` }
Payload 消息推送载荷
type PayloadDataField ¶ added in v2.0.2
type PayloadDataField struct {
URL string `json:"url"`
}
PayloadDataField 消息推送载荷-data字段
type TIM ¶
type TIM struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.