修复各种高并发下的异常

This commit is contained in:
SanJin 2019-09-02 12:56:08 +08:00
parent f68156c979
commit fbd9922b2b
18 changed files with 213 additions and 335 deletions

View File

@ -77,7 +77,7 @@
</thead> </thead>
<tbody id="tableList"> <tbody id="tableList">
<tr style="text-align: center;"> <tr style="text-align: center;">
<td style="line-height: 200px;font-size: 20px;color: #a9a9a9;" colspan="5">暂无数据</td> <td style="line-height: 200px;font-size: 20px;color: #a9a9a9;" colspan="11">暂无数据</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -182,13 +182,17 @@
<th width="11%">项目</th> <th width="11%">项目</th>
<th width="8%">集群名称</th> <th width="8%">集群名称</th>
<th width="8%">来源 IP</th> <th width="8%">来源 IP</th>
<th width="8%">地理信息</th> <th width="9%">地理信息</th>
<th width="5%">信息</th> <th width="5%">信息</th>
<th width="5%">长度</th> <th width="5%">长度</th>
<th width="8%">上钩时间</th> <th width="8%">上钩时间</th>
</tr> </tr>
</thead> </thead>
<tbody id="tableList"></tbody> <tbody id="tableList">
<tr style="text-align: center;">
<td style="line-height: 200px;font-size: 20px;color: #a9a9a9;" colspan="8">暂无数据</td>
</tr>
</tbody>
</table> </table>
</div> </div>
<button type="button" id="delbtn" class="btn btn-danger waves-effect waves-light btn-sm" <button type="button" id="delbtn" class="btn btn-danger waves-effect waves-light btn-sm"

View File

@ -5,11 +5,12 @@ import (
_ "github.com/mattn/go-sqlite3" _ "github.com/mattn/go-sqlite3"
"HFish/error" "HFish/error"
"HFish/utils/try" "HFish/utils/try"
"HFish/utils/log"
) )
// 连接数据库 // 连接数据库
func conn() *sql.DB { func conn() *sql.DB {
db, err := sql.Open("sqlite3", "./db/hfish.db") db, err := sql.Open("sqlite3", "./db/hfish.db?cache=shared&mode=rwc")
error.Check(err, "连接数据库失败") error.Check(err, "连接数据库失败")
return db return db
} }
@ -43,15 +44,19 @@ func Insert(sql string, args ...interface{}) int64 {
` `
dbUtil.Insert(sql, "插入任务测试", "测试说明", "", 1, "2", "", "1", "shell", "/scripts/myscript/test.sh", "1", "2019-07-10 16:12") dbUtil.Insert(sql, "插入任务测试", "测试说明", "", 1, "2", "", "1", "shell", "/scripts/myscript/test.sh", "1", "2019-07-10 16:12")
*/ */
db := conn()
stmt, _ := db.Prepare(sql)
var id int64 var id int64
id = 0 id = 0
try.Try(func() { try.Try(func() {
db := conn()
stmt, _ := db.Prepare(sql)
res, _ := stmt.Exec(args...) res, _ := stmt.Exec(args...)
//error.Check(err, "插入数据失败")
//if err != nil {
// log.Pr("HFish", "127.0.0.1", "插入数据失败", err)
//}
defer stmt.Close() defer stmt.Close()
@ -64,7 +69,7 @@ func Insert(sql string, args ...interface{}) int64 {
} }
// 更新数据 // 更新数据
func Update(sql string, args ...interface{}) int64 { func Update(sql string, args ...interface{}) {
/* /*
参数说明 参数说明
@ -81,20 +86,21 @@ func Update(sql string, args ...interface{}) int64 {
` `
dbUtil.Update(sql, "任务更新测试", 1) dbUtil.Update(sql, "任务更新测试", 1)
*/ */
db := conn()
stmt, _ := db.Prepare(sql)
res, err := stmt.Exec(args...) try.Try(func() {
db := conn()
stmt, _ := db.Prepare(sql)
error.Check(err, "更新数据失败") _, err := stmt.Exec(args...)
defer stmt.Close()
affect, err := res.RowsAffected() if err != nil {
error.Check(err, "获取影响行数失败") log.Pr("HFish", "127.0.0.1", "更新数据失败", err)
}
defer db.Close() defer stmt.Close()
defer db.Close()
return affect }).Catch(func() {})
} }
// 查询数据 // 查询数据
@ -114,12 +120,17 @@ func Query(sql string, args ...interface{}) []map[string]interface{} {
db := conn() db := conn()
rows, err := db.Query(sql, args ...) rows, err := db.Query(sql, args ...)
error.Check(err, "查询数据失败") if err != nil {
log.Pr("HFish", "127.0.0.1", "查询数据失败", err)
}
defer rows.Close() defer rows.Close()
columns, err := rows.Columns() columns, err := rows.Columns()
error.Check(err, "查询表名失败")
if err != nil {
log.Pr("HFish", "127.0.0.1", "查询表名失败", err)
}
count := len(columns) count := len(columns)
@ -153,7 +164,7 @@ func Query(sql string, args ...interface{}) []map[string]interface{} {
} }
// 删除数据 // 删除数据
func Delete(sql string, args ...interface{}) int64 { func Delete(sql string, args ...interface{}) {
/* /*
参数说明 参数说明
@ -165,18 +176,18 @@ func Delete(sql string, args ...interface{}) int64 {
sql := `delete from coot_tasks where id=?;` sql := `delete from coot_tasks where id=?;`
dbUtil.Delete(sql, 2) dbUtil.Delete(sql, 2)
*/ */
db := conn()
stmt, _ := db.Prepare(sql) try.Try(func() {
db := conn()
stmt, _ := db.Prepare(sql)
res, err := stmt.Exec(args...) _, err := stmt.Exec(args...)
error.Check(err, "删除数据失败")
defer stmt.Close()
affect, err := res.RowsAffected() if err != nil {
error.Check(err, "获取影响行数失败") log.Pr("HFish", "127.0.0.1", "删除数据失败", err)
}
defer db.Close() defer stmt.Close()
defer db.Close()
return affect }).Catch(func() {})
} }

View File

@ -19,7 +19,7 @@ import (
var clientData map[string]string var clientData map[string]string
func getJson() *simplejson.Json { func getJson() *simplejson.Json {
res, err := json.Get("ssh") res, err := json.GetSsh()
if err != nil { if err != nil {
log.Pr("HFish", "127.0.0.1", "解析 SSH JSON 文件失败", err) log.Pr("HFish", "127.0.0.1", "解析 SSH JSON 文件失败", err)
@ -45,10 +45,6 @@ func Start(addr string) {
fileName := res.Get("command").Get(line).MustString() fileName := res.Get("command").Get(line).MustString()
if (fileName == "") {
fileName = res.Get("command").Get("default").MustString()
}
output := file.ReadLibsText("ssh", fileName) output := file.ReadLibsText("ssh", fileName)
id := clientData[s.RemoteAddr().String()] id := clientData[s.RemoteAddr().String()]

View File

@ -54,7 +54,7 @@ func server(address string, exitChan chan int) {
} }
func getJson() *simplejson.Json { func getJson() *simplejson.Json {
res, err := json.Get("telnet") res, err := json.GetTelnet()
if err != nil { if err != nil {
log.Pr("HFish", "127.0.0.1", "解析 Telnet JSON 文件失败", err) log.Pr("HFish", "127.0.0.1", "解析 Telnet JSON 文件失败", err)

View File

@ -155,24 +155,30 @@ func ReportAgentStatus(agentName string, agentIp string, webStatus string, deepS
// 判断是否为白名单IP // 判断是否为白名单IP
func isWhiteIp(ip string) bool { func isWhiteIp(ip string) bool {
sql := `select status,info from hfish_setting where type = "whiteIp"` var isWhite = false
isStatus := dbUtil.Query(sql)
status := strconv.FormatInt(isStatus[0]["status"].(int64), 10) try.Try(func() {
sql := `select status,info from hfish_setting where type = "whiteIp"`
isStatus := dbUtil.Query(sql)
// 判断是否启用通知 status := strconv.FormatInt(isStatus[0]["status"].(int64), 10)
if status == "1" {
info := isStatus[0]["info"]
ipArr := strings.Split(info.(string), "&&")
for _, val := range ipArr { // 判断是否启用通知
if (ip == val) { if status == "1" {
return true info := isStatus[0]["info"]
ipArr := strings.Split(info.(string), "&&")
for _, val := range ipArr {
if (ip == val) {
isWhite = true
}
} }
} }
}
return false }).Catch(func() {
})
return isWhite
} }
// 上报 WEB // 上报 WEB

View File

@ -29,13 +29,13 @@ func createClient() (*rpc.Client, string, bool) {
rpcAddr := conf.Get("rpc", "addr") rpcAddr := conf.Get("rpc", "addr")
client, conn, err := rpc.Dial("tcp", rpcAddr) client, conn, err := rpc.Dial("tcp", rpcAddr)
ipArr := strings.Split(conn.LocalAddr().String(), ":")
if err != nil { if err != nil {
log.Pr("RPC", "127.0.0.1", "连接 RPC Server 失败") log.Pr("RPC", "127.0.0.1", "连接 RPC Server 失败")
return client, "", false return client, "", false
} }
ipArr := strings.Split(conn.LocalAddr().String(), ":")
return client, ipArr[0], true return client, ipArr[0], true
} }

View File

@ -273,7 +273,6 @@ func DialHTTPPath(network, address, path string) (*Client, error) {
// Dial connects to an RPC server at the specified network address. // Dial connects to an RPC server at the specified network address.
func Dial(network, address string) (*Client, net.Conn, error) { func Dial(network, address string) (*Client, net.Conn, error) {
conn, err := net.Dial(network, address) conn, err := net.Dial(network, address)
conn.LocalAddr()
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }

Binary file not shown.

2
go.mod
View File

@ -16,7 +16,9 @@ require (
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869
github.com/kr/pretty v0.1.0 // indirect github.com/kr/pretty v0.1.0 // indirect
github.com/mattn/go-sqlite3 v1.11.0 github.com/mattn/go-sqlite3 v1.11.0
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 // indirect
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
gopkg.in/ini.v1 v1.46.0
) )

12
go.sum
View File

@ -22,12 +22,16 @@ github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/ipipdotnet/ipdb-go v1.2.0 h1:Afa0qx/SgRevzIK8Qg1TevuD5M28kFLWbzPvU+GQJ08= github.com/ipipdotnet/ipdb-go v1.2.0 h1:Afa0qx/SgRevzIK8Qg1TevuD5M28kFLWbzPvU+GQJ08=
github.com/ipipdotnet/ipdb-go v1.2.0/go.mod h1:6SFLNyXDBF6q99FQvbOZJQCc2rdPrB1V5DSy4S83RSw= github.com/ipipdotnet/ipdb-go v1.2.0/go.mod h1:6SFLNyXDBF6q99FQvbOZJQCc2rdPrB1V5DSy4S83RSw=
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 h1:IPJ3dvxmJ4uczJe5YQdrYB16oTJlGSC/OyZDqUk9xX4= github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 h1:IPJ3dvxmJ4uczJe5YQdrYB16oTJlGSC/OyZDqUk9xX4=
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869/go.mod h1:cJ6Cj7dQo+O6GJNiMx+Pa94qKj+TG8ONdKHgMNIyyag= github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869/go.mod h1:cJ6Cj7dQo+O6GJNiMx+Pa94qKj+TG8ONdKHgMNIyyag=
github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs= github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
@ -44,6 +48,10 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc= github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 h1:WN9BUFbdyOsSH/XohnWpXOlq9NBD5sGAB2FciQMUEe8=
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
@ -51,6 +59,7 @@ github.com/ugorji/go v1.1.4 h1:j4s+tAvLfL3bZyefP2SEWmhBzmuIlH/eqNuPdFPgngw=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c h1:uOCk1iQW6Vc18bnC13MfzScl+wdKBmM9Y9kU7Z83/lw= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c h1:uOCk1iQW6Vc18bnC13MfzScl+wdKBmM9Y9kU7Z83/lw=
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -58,6 +67,7 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpbl
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk= gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk=
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk= gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
@ -68,5 +78,7 @@ gopkg.in/go-playground/validator.v8 v8.18.2 h1:lFB4DoMU6B626w8ny76MV7VX6W2VHct2G
gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y=
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE= gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE=
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw= gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw=
gopkg.in/ini.v1 v1.46.0 h1:VeDZbLYGaupuvIrsYCEOe/L/2Pcs5n7hdO1ZTjporag=
gopkg.in/ini.v1 v1.46.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

View File

@ -1,150 +1 @@
[HFish] 127.0.0.1 - [2019-08-29 11:48:26] "GET /dashboard HTTP/1.1 200 56.607931ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" " [Telnet] 127.0.0.1 - [2019-09-01 19:49:32] 已经连接 []
[GIN] 2019/08/29 - 11:48:26 | 200 | 56.706003ms | 127.0.0.1 | GET /dashboard
[HFish] 127.0.0.1 - [2019-08-29 11:48:26] "GET /get/dashboard/pie_data HTTP/1.1 200 33.972639ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:48:26 | 200 | 34.053451ms | 127.0.0.1 | GET /get/dashboard/pie_data
[HFish] 127.0.0.1 - [2019-08-29 11:48:26] "GET /get/dashboard/data HTTP/1.1 200 123.289456ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:48:26 | 200 | 123.329792ms | 127.0.0.1 | GET /get/dashboard/data
[HFish] 127.0.0.1 - [2019-08-29 11:48:26] "GET /static/favicon.ico HTTP/1.1 200 6.949151ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:48:26 | 200 | 7.003857ms | 127.0.0.1 | GET /static/favicon.ico
[HFish] 127.0.0.1 - [2019-08-29 11:49:13] "GET /dashboard HTTP/1.1 200 48.424607ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:49:13 | 200 | 48.473193ms | 127.0.0.1 | GET /dashboard
[HFish] 127.0.0.1 - [2019-08-29 11:49:13] "GET /get/dashboard/pie_data HTTP/1.1 200 38.905464ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:49:13 | 200 | 39.197664ms | 127.0.0.1 | GET /get/dashboard/pie_data
[HFish] 127.0.0.1 - [2019-08-29 11:49:13] "GET /get/dashboard/data HTTP/1.1 200 120.457531ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:49:13 | 200 | 120.521337ms | 127.0.0.1 | GET /get/dashboard/data
[HFish] 127.0.0.1 - [2019-08-29 11:49:14] "GET /static/favicon.ico HTTP/1.1 200 138.898µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:49:14 | 200 | 178.66µs | 127.0.0.1 | GET /static/favicon.ico
[HFish] 127.0.0.1 - [2019-08-29 11:49:31] "GET /dashboard HTTP/1.1 200 48.672248ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:49:31 | 200 | 48.719661ms | 127.0.0.1 | GET /dashboard
[HFish] 127.0.0.1 - [2019-08-29 11:49:31] "GET /get/dashboard/pie_data HTTP/1.1 200 38.867359ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:49:31 | 200 | 38.949307ms | 127.0.0.1 | GET /get/dashboard/pie_data
[HFish] 127.0.0.1 - [2019-08-29 11:49:31] "GET /get/dashboard/data HTTP/1.1 200 121.560157ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:49:31 | 200 | 121.614088ms | 127.0.0.1 | GET /get/dashboard/data
[HFish] 127.0.0.1 - [2019-08-29 11:49:31] "GET /static/favicon.ico HTTP/1.1 200 148.232µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:49:31 | 200 | 185.387µs | 127.0.0.1 | GET /static/favicon.ico
[HFish] 127.0.0.1 - [2019-08-29 11:49:43] "GET /dashboard HTTP/1.1 200 54.607618ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:49:43 | 200 | 54.678832ms | 127.0.0.1 | GET /dashboard
[HFish] 127.0.0.1 - [2019-08-29 11:49:43] "GET /get/dashboard/pie_data HTTP/1.1 200 38.408528ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:49:43 | 200 | 38.573457ms | 127.0.0.1 | GET /get/dashboard/pie_data
[HFish] 127.0.0.1 - [2019-08-29 11:49:43] "GET /static/favicon.ico HTTP/1.1 200 196.197µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:49:43 | 200 | 240.205µs | 127.0.0.1 | GET /static/favicon.ico
[HFish] 127.0.0.1 - [2019-08-29 11:49:43] "GET /get/dashboard/data HTTP/1.1 200 136.233762ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:49:43 | 200 | 136.345721ms | 127.0.0.1 | GET /get/dashboard/data
[HFish] 127.0.0.1 - [2019-08-29 11:50:01] "GET /dashboard HTTP/1.1 200 63.781477ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:01 | 200 | 63.82231ms | 127.0.0.1 | GET /dashboard
[HFish] 127.0.0.1 - [2019-08-29 11:50:01] "GET /get/dashboard/pie_data HTTP/1.1 200 38.541218ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:01 | 200 | 38.609502ms | 127.0.0.1 | GET /get/dashboard/pie_data
[HFish] 127.0.0.1 - [2019-08-29 11:50:01] "GET /get/dashboard/data HTTP/1.1 200 126.240694ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:01 | 200 | 126.289998ms | 127.0.0.1 | GET /get/dashboard/data
[HFish] 127.0.0.1 - [2019-08-29 11:50:01] "GET /static/favicon.ico HTTP/1.1 200 244.224µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:01 | 200 | 290.792µs | 127.0.0.1 | GET /static/favicon.ico
[HFish] 127.0.0.1 - [2019-08-29 11:50:24] "GET /dashboard HTTP/1.1 200 52.06347ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:24 | 200 | 52.12123ms | 127.0.0.1 | GET /dashboard
[HFish] 127.0.0.1 - [2019-08-29 11:50:24] "GET /get/dashboard/pie_data HTTP/1.1 200 34.237616ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:24 | 200 | 34.305977ms | 127.0.0.1 | GET /get/dashboard/pie_data
[HFish] 127.0.0.1 - [2019-08-29 11:50:24] "GET /get/dashboard/data HTTP/1.1 200 119.912948ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:24 | 200 | 119.967199ms | 127.0.0.1 | GET /get/dashboard/data
[HFish] 127.0.0.1 - [2019-08-29 11:50:24] "GET /static/favicon.ico HTTP/1.1 200 211.779µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:24 | 200 | 296.254µs | 127.0.0.1 | GET /static/favicon.ico
[HFish] 127.0.0.1 - [2019-08-29 11:50:47] "GET /fish HTTP/1.1 200 2.036465ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:47 | 200 | 2.075723ms | 127.0.0.1 | GET /fish
[HFish] 127.0.0.1 - [2019-08-29 11:50:48] "GET /get/fish/list?page=1&pageSize=10&type=all&colony=all&so_text= HTTP/1.1 200 13.331549ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:48 | 200 | 13.379105ms | 127.0.0.1 | GET /get/fish/list?page=1&pageSize=10&type=all&colony=all&so_text=
[HFish] 127.0.0.1 - [2019-08-29 11:50:48] "GET /get/fish/typeList HTTP/1.1 200 16.29758ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:48 | 200 | 16.33465ms | 127.0.0.1 | GET /get/fish/typeList
[HFish] 127.0.0.1 - [2019-08-29 11:50:53] "GET /colony HTTP/1.1 200 2.320802ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:53 | 200 | 2.360461ms | 127.0.0.1 | GET /colony
[HFish] 127.0.0.1 - [2019-08-29 11:50:53] "GET /get/colony/list HTTP/1.1 200 846.728µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:53 | 200 | 893.745µs | 127.0.0.1 | GET /get/colony/list
[HFish] 127.0.0.1 - [2019-08-29 11:50:53] "GET /mail HTTP/1.1 200 2.264141ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:53 | 200 | 2.30848ms | 127.0.0.1 | GET /mail
[HFish] 127.0.0.1 - [2019-08-29 11:50:54] "GET /setting HTTP/1.1 200 2.657589ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:54 | 200 | 2.692373ms | 127.0.0.1 | GET /setting
[HFish] 127.0.0.1 - [2019-08-29 11:50:55] "GET /mail HTTP/1.1 200 2.375849ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:55 | 200 | 2.419995ms | 127.0.0.1 | GET /mail
[HFish] 127.0.0.1 - [2019-08-29 11:50:55] "GET /colony HTTP/1.1 200 1.827612ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:55 | 200 | 1.858955ms | 127.0.0.1 | GET /colony
[HFish] 127.0.0.1 - [2019-08-29 11:50:55] "GET /get/colony/list HTTP/1.1 200 667.354µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:55 | 200 | 699.357µs | 127.0.0.1 | GET /get/colony/list
[HFish] 127.0.0.1 - [2019-08-29 11:50:56] "GET /dashboard HTTP/1.1 200 49.523215ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:56 | 200 | 49.626707ms | 127.0.0.1 | GET /dashboard
[HFish] 127.0.0.1 - [2019-08-29 11:50:56] "GET /get/dashboard/pie_data HTTP/1.1 200 39.782197ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:56 | 200 | 39.842559ms | 127.0.0.1 | GET /get/dashboard/pie_data
[HFish] 127.0.0.1 - [2019-08-29 11:50:56] "GET /get/dashboard/data HTTP/1.1 200 131.732191ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 11:50:56 | 200 | 131.774042ms | 127.0.0.1 | GET /get/dashboard/data
[HFish] 127.0.0.1 - [2019-08-29 12:03:21] "GET /dashboard HTTP/1.1 200 45.901784ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:03:21 | 200 | 45.953822ms | 127.0.0.1 | GET /dashboard
[HFish] 127.0.0.1 - [2019-08-29 12:03:21] "GET /get/dashboard/pie_data HTTP/1.1 200 35.238809ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:03:21 | 200 | 35.40822ms | 127.0.0.1 | GET /get/dashboard/pie_data
[HFish] 127.0.0.1 - [2019-08-29 12:03:21] "GET /get/dashboard/data HTTP/1.1 200 118.05311ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:03:21 | 200 | 118.135936ms | 127.0.0.1 | GET /get/dashboard/data
[HFish] 127.0.0.1 - [2019-08-29 12:03:22] "GET /static/favicon.ico HTTP/1.1 200 350.475µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:03:22 | 200 | 411.505µs | 127.0.0.1 | GET /static/favicon.ico
[HFish] 127.0.0.1 - [2019-08-29 12:34:52] "GET /dashboard HTTP/1.1 200 47.695475ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:34:52 | 200 | 47.75485ms | 127.0.0.1 | GET /dashboard
[HFish] 127.0.0.1 - [2019-08-29 12:34:52] "GET /get/dashboard/pie_data HTTP/1.1 200 35.167838ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:34:52 | 200 | 35.233938ms | 127.0.0.1 | GET /get/dashboard/pie_data
[HFish] 127.0.0.1 - [2019-08-29 12:34:52] "GET /get/dashboard/data HTTP/1.1 200 119.725769ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:34:52 | 200 | 119.782052ms | 127.0.0.1 | GET /get/dashboard/data
[HFish] 127.0.0.1 - [2019-08-29 12:34:52] "GET /static/favicon.ico HTTP/1.1 200 250.852µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:34:52 | 200 | 317.337µs | 127.0.0.1 | GET /static/favicon.ico
[HFish] 127.0.0.1 - [2019-08-29 12:35:04] "GET /fish HTTP/1.1 200 2.264355ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:35:04 | 200 | 2.315725ms | 127.0.0.1 | GET /fish
[HFish] 127.0.0.1 - [2019-08-29 12:35:04] "GET /get/fish/list?page=1&pageSize=10&type=all&colony=all&so_text= HTTP/1.1 200 11.934474ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:35:04 | 200 | 11.991904ms | 127.0.0.1 | GET /get/fish/list?page=1&pageSize=10&type=all&colony=all&so_text=
[HFish] 127.0.0.1 - [2019-08-29 12:35:04] "GET /get/fish/typeList HTTP/1.1 200 16.181181ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:35:04 | 200 | 16.218741ms | 127.0.0.1 | GET /get/fish/typeList
[HFish] 127.0.0.1 - [2019-08-29 12:35:05] "GET /colony HTTP/1.1 200 3.35242ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:35:05 | 200 | 3.421204ms | 127.0.0.1 | GET /colony
[HFish] 127.0.0.1 - [2019-08-29 12:35:05] "GET /get/colony/list HTTP/1.1 200 950.243µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:35:05 | 200 | 1.034932ms | 127.0.0.1 | GET /get/colony/list
[HFish] 127.0.0.1 - [2019-08-29 12:35:31] "GET /colony HTTP/1.1 200 2.187467ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:35:31 | 200 | 2.242165ms | 127.0.0.1 | GET /colony
[HFish] 127.0.0.1 - [2019-08-29 12:35:31] "GET /get/colony/list HTTP/1.1 200 682.642µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:35:31 | 200 | 729.134µs | 127.0.0.1 | GET /get/colony/list
[HFish] 127.0.0.1 - [2019-08-29 12:35:31] "GET /static/favicon.ico HTTP/1.1 200 237.555µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:35:31 | 200 | 315.949µs | 127.0.0.1 | GET /static/favicon.ico
[HFish] 127.0.0.1 - [2019-08-29 12:36:11] "GET /fish HTTP/1.1 200 2.848299ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:11 | 200 | 2.894751ms | 127.0.0.1 | GET /fish
[HFish] 127.0.0.1 - [2019-08-29 12:36:11] "GET /get/fish/list?page=1&pageSize=10&type=all&colony=all&so_text= HTTP/1.1 200 12.15752ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:11 | 200 | 12.202197ms | 127.0.0.1 | GET /get/fish/list?page=1&pageSize=10&type=all&colony=all&so_text=
[HFish] 127.0.0.1 - [2019-08-29 12:36:11] "GET /get/fish/typeList HTTP/1.1 200 16.403223ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:11 | 200 | 16.489681ms | 127.0.0.1 | GET /get/fish/typeList
[HFish] 127.0.0.1 - [2019-08-29 12:36:12] "GET /dashboard HTTP/1.1 200 62.237751ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:12 | 200 | 62.407414ms | 127.0.0.1 | GET /dashboard
[HFish] 127.0.0.1 - [2019-08-29 12:36:12] "GET /get/dashboard/pie_data HTTP/1.1 200 47.988341ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:12 | 200 | 48.043214ms | 127.0.0.1 | GET /get/dashboard/pie_data
[HFish] 127.0.0.1 - [2019-08-29 12:36:12] "GET /get/dashboard/data HTTP/1.1 200 144.323808ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:12 | 200 | 144.419925ms | 127.0.0.1 | GET /get/dashboard/data
[HFish] 127.0.0.1 - [2019-08-29 12:36:40] "GET /fish HTTP/1.1 200 2.14099ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:40 | 200 | 2.184643ms | 127.0.0.1 | GET /fish
[HFish] 127.0.0.1 - [2019-08-29 12:36:41] "GET /get/fish/list?page=1&pageSize=10&type=all&colony=all&so_text= HTTP/1.1 200 11.165127ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:41 | 200 | 11.227681ms | 127.0.0.1 | GET /get/fish/list?page=1&pageSize=10&type=all&colony=all&so_text=
[HFish] 127.0.0.1 - [2019-08-29 12:36:41] "GET /get/fish/typeList HTTP/1.1 200 17.250805ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:41 | 200 | 17.297157ms | 127.0.0.1 | GET /get/fish/typeList
[HFish] 127.0.0.1 - [2019-08-29 12:36:42] "GET /colony HTTP/1.1 200 2.067831ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:42 | 200 | 2.111573ms | 127.0.0.1 | GET /colony
[HFish] 127.0.0.1 - [2019-08-29 12:36:42] "GET /get/colony/list HTTP/1.1 200 4.59552ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:42 | 200 | 4.642691ms | 127.0.0.1 | GET /get/colony/list
[HFish] 127.0.0.1 - [2019-08-29 12:36:42] "GET /mail HTTP/1.1 200 1.595977ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:42 | 200 | 1.64267ms | 127.0.0.1 | GET /mail
[HFish] 127.0.0.1 - [2019-08-29 12:36:43] "GET /setting HTTP/1.1 200 2.626939ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:43 | 200 | 2.726787ms | 127.0.0.1 | GET /setting
[HFish] 127.0.0.1 - [2019-08-29 12:36:43] "GET /mail HTTP/1.1 200 2.923969ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:43 | 200 | 2.969498ms | 127.0.0.1 | GET /mail
[HFish] 127.0.0.1 - [2019-08-29 12:36:44] "GET /colony HTTP/1.1 200 1.731289ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:44 | 200 | 1.773129ms | 127.0.0.1 | GET /colony
[HFish] 127.0.0.1 - [2019-08-29 12:36:44] "GET /get/colony/list HTTP/1.1 200 943.548µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:44 | 200 | 1.005817ms | 127.0.0.1 | GET /get/colony/list
[HFish] 127.0.0.1 - [2019-08-29 12:36:44] "GET /fish HTTP/1.1 200 2.057013ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:44 | 200 | 2.096919ms | 127.0.0.1 | GET /fish
[HFish] 127.0.0.1 - [2019-08-29 12:36:44] "GET /get/fish/list?page=1&pageSize=10&type=all&colony=all&so_text= HTTP/1.1 200 9.483435ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:44 | 200 | 9.527162ms | 127.0.0.1 | GET /get/fish/list?page=1&pageSize=10&type=all&colony=all&so_text=
[HFish] 127.0.0.1 - [2019-08-29 12:36:44] "GET /get/fish/typeList HTTP/1.1 200 14.233813ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:44 | 200 | 14.266098ms | 127.0.0.1 | GET /get/fish/typeList
[HFish] 127.0.0.1 - [2019-08-29 12:36:45] "GET /dashboard HTTP/1.1 200 55.851558ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:45 | 200 | 55.893396ms | 127.0.0.1 | GET /dashboard
[HFish] 127.0.0.1 - [2019-08-29 12:36:45] "GET /get/dashboard/pie_data HTTP/1.1 200 38.606267ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:45 | 200 | 38.662421ms | 127.0.0.1 | GET /get/dashboard/pie_data
[HFish] 127.0.0.1 - [2019-08-29 12:36:45] "GET /get/dashboard/data HTTP/1.1 200 127.992565ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
[GIN] 2019/08/29 - 12:36:45 | 200 | 128.04882ms | 127.0.0.1 | GET /get/dashboard/data

View File

@ -1,119 +1,22 @@
package conf package conf
import ( import (
"bufio" "gopkg.in/ini.v1"
"io" "HFish/utils/log"
"os"
"strings"
) )
const middle = "=HFish=" var cfg *ini.File
type Config struct { func init() {
Mymap map[string]string c, err := ini.Load("./config.ini")
MyNode map[string]string
strcet string
}
func (c *Config) InitConfig(path string) {
c.Mymap = make(map[string]string)
c.MyNode = make(map[string]string)
f, err := os.Open(path)
if err != nil { if err != nil {
panic(err) log.Pr("HFish", "127.0.0.1", "打开配置文件失败", err)
} }
defer f.Close() c.BlockMode = false
cfg = c
r := bufio.NewReader(f)
for {
b, _, err := r.ReadLine()
if err != nil {
if err == io.EOF {
break
}
panic(err)
}
s := strings.TrimSpace(string(b))
if strings.Index(s, "#") == 0 {
continue
}
n1 := strings.Index(s, "[")
n2 := strings.LastIndex(s, "]")
if n1 > -1 && n2 > -1 && n2 > n1+1 {
c.strcet = strings.TrimSpace(s[n1+1: n2])
continue
}
if len(c.strcet) == 0 {
continue
}
index := strings.Index(s, "=")
if index < 0 {
continue
}
frist := strings.TrimSpace(s[:index])
if len(frist) == 0 {
continue
}
second := strings.TrimSpace(s[index+1:])
pos := strings.Index(second, "\t#")
if pos > -1 {
second = second[0:pos]
}
pos = strings.Index(second, " #")
if pos > -1 {
second = second[0:pos]
}
pos = strings.Index(second, "\t//")
if pos > -1 {
second = second[0:pos]
}
pos = strings.Index(second, " //")
if pos > -1 {
second = second[0:pos]
}
if len(second) == 0 {
continue
}
key := c.strcet + middle + frist
c.Mymap[key] = strings.TrimSpace(second)
key = c.strcet + middle + "introduce"
introduce, found := c.Mymap[key]
if !found {
}
key = c.strcet + middle + "mode"
mode, found := c.Mymap[key]
if !found {
}
c.MyNode[c.strcet] = strings.TrimSpace(mode) + "&&" + strings.TrimSpace(introduce)
}
}
func (c Config) read(node, key string) string {
key = node + middle + key
v, found := c.Mymap[key]
if !found {
return ""
}
return strings.TrimSpace(v)
} }
func Get(node string, key string) string { func Get(node string, key string) string {
myConfig := new(Config) val := cfg.Section(node).Key(key).String()
myConfig.InitConfig("./config.ini") return val
r := myConfig.read(node, key)
return r
} }

View File

@ -2,12 +2,49 @@ package file
import ( import (
"HFish/error" "HFish/error"
"fmt"
"os" "os"
"io/ioutil" "io/ioutil"
"HFish/utils/log" "HFish/utils/log"
"HFish/utils/json"
"fmt"
) )
// 防止高并发下 打开过多
var sshMap map[string]string
var telnetMap map[string]string
func init() {
// 把 SSH 命令配置 放到内存
resSsh, errSsh := json.GetSsh()
if errSsh != nil {
log.Pr("HFish", "127.0.0.1", "打开配置文件失败", errSsh)
}
sshCmdList, _ := resSsh.Get("command").Map()
sshMap = make(map[string]string)
for _, value := range sshCmdList {
str := ReadLibs("ssh", value.(string))
sshMap[value.(string)] = str
}
// 把 TELNET 命令配置 放到内存
resTelnet, errTelnet := json.GetSsh()
if errTelnet != nil {
log.Pr("HFish", "127.0.0.1", "打开配置文件失败", errTelnet)
}
telnetCmdList, _ := resTelnet.Get("command").Map()
telnetMap = make(map[string]string)
for _, value := range telnetCmdList {
str := ReadLibs("telnet", value.(string))
telnetMap[value.(string)] = str
}
}
func Output(result string, path string) { func Output(result string, path string) {
if path != "" { if path != "" {
_, err := os.Stat(path) _, err := os.Stat(path)
@ -25,7 +62,7 @@ func Output(result string, path string) {
} }
} }
func ReadLibsText(typex string, name string) string { func ReadLibs(typex string, name string) string {
text, err := ioutil.ReadFile("./libs/" + typex + "/" + name + ".hf") text, err := ioutil.ReadFile("./libs/" + typex + "/" + name + ".hf")
if err != nil { if err != nil {
@ -34,3 +71,28 @@ func ReadLibsText(typex string, name string) string {
return string(text[:]) return string(text[:])
} }
func ReadLibsText(typex string, name string) string {
switch typex {
case "ssh":
text, ok := sshMap[name]
if (ok) {
return text
} else {
return sshMap["default"]
}
case "telnet":
text, ok := telnetMap[name]
if (ok) {
return text
} else {
return telnetMap["default"]
}
default:
return ""
}
return ""
}

View File

@ -2,7 +2,6 @@ package ip
import ( import (
"net/http" "net/http"
"HFish/error"
"io/ioutil" "io/ioutil"
"github.com/axgle/mahonia" "github.com/axgle/mahonia"
"regexp" "regexp"
@ -14,17 +13,21 @@ import (
"github.com/ipipdotnet/ipdb-go" "github.com/ipipdotnet/ipdb-go"
) )
var ipipDB *ipdb.City
func init() {
ipipDB, _ = ipdb.NewCity("./db/ipip.ipdb")
}
// 爬虫 ip138 获取 ip 地理信息 // 爬虫 ip138 获取 ip 地理信息
// ~~~~~~ 暂时废弃,采用 IPIP // ~~~~~~ 暂时废弃,采用 IPIP
func GetIp138(ip string) string { func GetIp138(ip string) string {
result := "" result := ""
try.Try(func() { try.Try(func() {
resp, err := http.Get("http://ip138.com/ips138.asp?ip=" + ip) resp, _ := http.Get("http://ip138.com/ips138.asp?ip=" + ip)
error.Check(err, "请求IP138异常")
defer resp.Body.Close() defer resp.Body.Close()
input, err := ioutil.ReadAll(resp.Body) input, _ := ioutil.ReadAll(resp.Body)
error.Check(err, "读取IP138内容异常")
out := mahonia.NewDecoder("gbk").ConvertString(string(input)) out := mahonia.NewDecoder("gbk").ConvertString(string(input))
@ -72,7 +75,6 @@ func GetLocalIp() string {
// 采用 IPIP 本地库 // 采用 IPIP 本地库
func GetIp(ip string) (string, string, string) { func GetIp(ip string) (string, string, string) {
db, _ := ipdb.NewCity("./db/ipip.ipdb") ipInfo, _ := ipipDB.FindMap(ip, "CN")
ipInfo, _ := db.FindMap(ip, "CN")
return ipInfo["country_name"], ipInfo["region_name"], ipInfo["city_name"] return ipInfo["country_name"], ipInfo["region_name"], ipInfo["city_name"]
} }

View File

@ -1,18 +0,0 @@
package json
import (
"github.com/bitly/go-simplejson"
"HFish/utils/log"
"io/ioutil"
)
func Get(typex string) (*simplejson.Json, error) {
json, err := ioutil.ReadFile("./libs/" + typex + "/config.json")
if err != nil {
log.Pr("HFish", "127.0.0.1", "读取文件失败", err)
}
res, err := simplejson.NewJson(json)
return res, err
}

24
utils/json/ssh.go Normal file
View File

@ -0,0 +1,24 @@
package json
import (
"github.com/bitly/go-simplejson"
"HFish/utils/log"
"io/ioutil"
)
var sshJson []byte
func init() {
file, err := ioutil.ReadFile("./libs/ssh/config.json")
if err != nil {
log.Pr("HFish", "127.0.0.1", "读取文件失败", err)
}
sshJson = file
}
func GetSsh() (*simplejson.Json, error) {
res, err := simplejson.NewJson(sshJson)
return res, err
}

24
utils/json/telnet.go Normal file
View File

@ -0,0 +1,24 @@
package json
import (
"github.com/bitly/go-simplejson"
"HFish/utils/log"
"io/ioutil"
)
var telnetJson []byte
func init() {
file, err := ioutil.ReadFile("./libs/telnet/config.json")
if err != nil {
log.Pr("HFish", "127.0.0.1", "读取文件失败", err)
}
telnetJson = file
}
func GetTelnet() (*simplejson.Json, error) {
res, err := simplejson.NewJson(telnetJson)
return res, err
}