コード例 #1
0
// 配置运行参数
func setConf(req map[string]interface{}) bool {
	if tn := util.Atoui(req["threadNum"]); tn == 0 {
		app.LogicApp.SetAppConf("threadNum", 1)
	} else {
		app.LogicApp.SetAppConf("threadNum", tn)
	}

	app.LogicApp.
		SetAppConf("Pausetime", [2]uint{(util.Atoui(req["baseSleeptime"])), util.Atoui(req["randomSleepPeriod"])}).
		SetAppConf("OutType", util.Atoa(req["output"])).
		SetAppConf("DockerCap", util.Atoui(req["dockerCap"])).
		SetAppConf("MaxPage", util.Atoi(req["maxPage"])).
		SetAppConf("Keywords", util.Atoa(req["keywords"])).
		SetAppConf("DeduplicationTarget", req["deduplicationTarget"])

	var inheritDeduplication bool
	if req["inheritDeduplication"] == "true" {
		inheritDeduplication = true
	}
	app.LogicApp.SetAppConf("InheritDeduplication", inheritDeduplication)

	if !setSpiderQueue(req) {
		return false
	}
	return true
}
コード例 #2
0
ファイル: websocketController.go プロジェクト: sinuos/pholcus
// 配置运行参数
func setConf(req map[string]interface{}) bool {
	if tn := util.Atoui(req["threadNum"]); tn == 0 {
		logicApp.SetThreadNum(1)
	} else {
		logicApp.SetThreadNum(tn)
	}
	logicApp.SetPausetime([2]uint{(util.Atoui(req["baseSleeptime"])), util.Atoui(req["randomSleepPeriod"])})
	logicApp.SetOutType(util.Atoa(req["output"]))
	logicApp.SetDockerCap(util.Atoui(req["dockerCap"])) //分段转储容器容量
	// 选填项
	logicApp.SetMaxPage(util.Atoi(req["maxPage"]))
	if !setSpiderQueue(req) {
		return false
	}
	return true
}
コード例 #3
0
// 配置运行参数
func setConf(req map[string]interface{}) bool {
	if tn := util.Atoui(req["threadNum"]); tn == 0 {
		logicApp.SetAppConf("threadNum", 1)
	} else {
		logicApp.SetAppConf("threadNum", tn)
	}

	logicApp.
		SetAppConf("Pausetime", [2]uint{(util.Atoui(req["baseSleeptime"])), util.Atoui(req["randomSleepPeriod"])}).
		SetAppConf("OutType", util.Atoa(req["output"])).
		SetAppConf("DockerCap", util.Atoui(req["dockerCap"])).
		SetAppConf("MaxPage", util.Atoi(req["maxPage"])).
		SetAppConf("Keywords", util.Atoa(req["keywords"]))

	if !setSpiderQueue(req) {
		return false
	}
	return true
}