代码拉取完成,页面将自动刷新
同步操作将从 awake1t/linglong 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package main
import (
"fmt"
"github.com/fvbock/endless"
"linglong/global"
"linglong/models"
"linglong/pkg/jobs"
"linglong/pkg/setting"
"linglong/routers"
v1 "linglong/routers/api/v1"
"log"
"strings"
"syscall"
"time"
)
func init() {
err := setupSetting()
if err != nil {
log.Fatalf("init.setupSetting err: %v", err)
}
jobs.InitJobs()
}
func main() {
endless.DefaultReadTimeOut = global.ServerSetting.ReadTimeout
endless.DefaultWriteTimeOut = global.ServerSetting.WriteTimeout
endless.DefaultMaxHeaderBytes = 1 << 20
endPoint := fmt.Sprintf(":%d", global.ServerSetting.HttpPort)
server := endless.NewServer(endPoint, routers.InitRouter())
server.BeforeBegin = func(add string) {
log.Printf("Actual pid is %d", syscall.Getpid())
}
//启动一个无限循环扫描的masscan+nmap端口识别
go func() {
defer func() {
if err := recover(); err != nil {
fmt.Println("masscan 运行错误:", err)
}
}()
i := 1
for {
start := time.Now()
v1.InitMasscan()
end := time.Now()
log.Printf("masscan完成第 %d 轮扫描 耗时: %s\n", i, end.Sub(start))
i++
time.Sleep(10 * time.Second)
}
}()
err := server.ListenAndServe()
if err != nil {
log.Printf("Server err: %v", err)
}
}
func setupSetting() error {
s, err := setting.NewSetting(strings.Split("configs/", ",")...)
if err != nil {
return err
}
err = s.ReadSection("Server", &global.ServerSetting)
if err != nil {
return err
}
err = s.ReadSection("App", &global.AppSetting)
if err != nil {
return err
}
err = s.ReadSection("Database", &global.DatabaseSetting)
if err != nil {
return err
}
err = s.ReadSection("Masscan", &global.MasscanSetting)
if err != nil {
return err
}
global.AppSetting.DefaultContextTimeout *= time.Second
//global.JWTSetting.Expire *= time.Second
global.ServerSetting.ReadTimeout *= time.Second
global.ServerSetting.WriteTimeout *= time.Second
models.Setup()
return nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。