Documentation ¶
Overview ¶
goo.go this file incloud the common functions,maps slices, structs or anything else.
mysql.go has add delete search ect about the mysql using go-sql-driver/mysql.
salt.go This file is all about encrypting and decrypting passwords. this is a example for you:
pass,salt := EncryptMd5("991182@") passReal := "991182@" a,b := DeEncryptMd5(passReal,pass,salt) if b != nil || !a { t.Error("❌") } fmt.Println(pass,salt) passErr := "123456!@" d,e := DeEncryptMd5(passErr,pass,salt) if e != nil || !d { t.Error("这个错误 应该被打印出来") }
session.go
Index ¶
- func ConvertToString(src string, srcCode string, tagCode string) string
- func DeEncryptArgon2(password, resultDB, saltDB string) (is bool, err error)
- func DeEncryptMd5(password string, resultDB, saltDB string) (is bool, err error)
- func EncryptArgon2(password string) (resultDB, saltDB string)
- func EncryptMd5(password string) (resultDB, saltDB string)
- func GetCookie(r *http.Request, cookieName string) (*http.Cookie, error)
- func SetCookie(w http.ResponseWriter, cookie *http.Cookie)
- type Data
- type IntSet
- type Session
- type SessionStore
- type Values
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToString ¶
转码 将文字 从 比如 gbk转化为 utf8
func DeEncryptArgon2 ¶
Verify that the user's password is equal to the password in the database
func DeEncryptMd5 ¶
Verify that the user's password is equal to the password in the database
Example ¶
pass, salt := EncryptMd5("991182@") passReal := "991182@" a, b := DeEncryptMd5(passReal, pass, salt) if b != nil || !a { fmt.Println("x") // output:x } passErr := "123456!@" d, e := DeEncryptMd5(passErr, pass, salt) if e != nil || !d { fmt.Println("err")
Output: err
func EncryptArgon2 ¶
return result and salt. Use hexadecimal to save []byte of data.
func EncryptMd5 ¶
use md5+salt return result and salt.
Types ¶
type IntSet ¶
type IntSet struct {
Words []uint64 // bit array
}
InSet is a bit array struct.
type Session ¶
type Session interface { Get(key interface{}) interface{} Set(key, value interface{}) error Delete(key interface{}) error SessionID() string }
Session interface
type SessionStore ¶
type SessionStore struct {
// contains filtered or unexported fields
}
the main manager about the session system
func (*SessionStore) Delete ¶
func (s *SessionStore) Delete(key interface{}) error
func (*SessionStore) Get ¶
func (s *SessionStore) Get(key interface{}) interface{}
the content about the system.
func (*SessionStore) SessionID ¶
func (s *SessionStore) SessionID() string
func (*SessionStore) Set ¶
func (s *SessionStore) Set(key, value interface{}) error
type Values ¶
func WhichCountry ¶
add ip address, return country and city.
Example ¶
v := WhichCountry("173.82.115.125") for _, b := range v { fmt.Println(b.Country, b.City)
Output: 美国 洛杉矶
Directories ¶
Path | Synopsis |
---|---|
app.go this file has the global functions structs maps slices or anything else.
|
app.go this file has the global functions structs maps slices or anything else. |
deal with pictures.Handling images, such as compression
|
deal with pictures.Handling images, such as compression |