|
- package main
-
- import (
- "log"
- "net/http"
- "rh1/utils"
- "rh1/route"
- "strconv"
- "fmt"
- )
-
-
-
- func main() {
- //utils.WriteStructDataToJsonFile();
- config := utils.DeserializeJson2()
- //utils.UpdateUserData(utils.Userdata{Name:"admin1", Pwd:"123456"})
- http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir("./template/assets"))))
- http.HandleFunc("/login", route.Login)
- http.HandleFunc("/changePwd", route.ChangePwd)
- http.HandleFunc("/", route.Index)
- http.HandleFunc("/index", route.Index)
- http.HandleFunc("/handleAct", route.RemoteHandle)
- http.HandleFunc("/devList", route.DevList)
-
-
-
- /*origData := "hello" // 待加密的数据
- log.Println("原文:", string(origData))
-
- now := time.Now()
- log.Println(now)
- kk := now.Format("20060102")
- log.Println(kk)
-
-
- log.Println("------------------ECB模式 --------------------")
- encrypted2 := aes.EncryptDES_ECB(origData, kk)
- log.Println("密文(hex):", encrypted2)
-
- log.Println("密文(base64):", base64.StdEncoding.EncodeToString([]byte(encrypted2)))
- decrypted2 := aes.DecryptDES_ECB(encrypted2, kk)
- log.Println("解密结果:", string(decrypted2))*/
-
-
- err := http.ListenAndServe(":"+strconv.Itoa(config.Port), nil)
- if err != nil {
- log.Fatal(err)
- }
- fmt.Printf("start successful. Port: %d", config.Port)
- }
-
-
-
-
-
-
|