feature:支持使用配置文件,增加网络检查

1、从Config.json读取配置
2、网络正常时跳过登录
This commit is contained in:
Mmx
2021-03-16 22:51:54 +08:00
parent a273e2673c
commit 56dfeaf4cf
11 changed files with 220 additions and 99 deletions

View File

@@ -26,11 +26,11 @@ func GetIp(body string) (string, error) {
}
func GetToken(body string) (string, error) {
return Search("\"challenge\":\"(.*?)\"",body)
return Search("\"challenge\":\"(.*?)\"", body)
}
func GetResult(body string)(string,error){
return Search("\"error\":\"(.+?)\"",body)
func GetResult(body string) (string, error) {
return Search("\"error\":\"(.+?)\"", body)
}
func Md5(content string) string {
@@ -39,9 +39,9 @@ func Md5(content string) string {
return fmt.Sprintf("%x", w.Sum(nil)) //w.Sum(nil)将w的hash转成[]byte格式
}
func Sha1(content string)string{
func Sha1(content string) string {
h := sha1.New()
h.Write([]byte(content))
bs := h.Sum(nil)
return fmt.Sprintf("%x\n", bs)
}
}