This commit is contained in:
eson
2020-11-27 15:57:24 +08:00
parent 9e2d9d5abc
commit f330daf242
11 changed files with 84 additions and 30 deletions

View File

@@ -7,7 +7,7 @@ import (
"gopkg.in/yaml.v2"
)
var config = &Config{}
var config = &LocalConfig{}
func init() {
f, err := os.Open("config.yaml")
@@ -21,8 +21,8 @@ func init() {
}
}
// Config 本地yaml配置对象
type Config struct {
// LocalConfig 本地yaml配置对象
type LocalConfig struct {
Server struct {
URI string `yaml:"uri"`
} `yaml:"server"`
@@ -41,3 +41,8 @@ func initChromeProxy() {
panic(err)
}
}
// ChromeConfig chrome的配置, 包括代理
type ChromeConfig struct {
PacScript string
}

View File

@@ -3,7 +3,7 @@ module git.nonolive.co/eson.hsm/proxyserver
go 1.15
require (
github.com/474420502/focus v0.12.0
github.com/474420502/focus v0.13.1
github.com/474420502/requests v1.10.1
github.com/bwmarrin/snowflake v0.3.0
github.com/gin-gonic/gin v1.6.3

View File

@@ -1,6 +1,10 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/474420502/focus v0.12.0 h1:+icbmj7IEOefvTegHt5EpcHt6WFbe2miIrceUJx2Evo=
github.com/474420502/focus v0.12.0/go.mod h1:d0PMjtMxFz1a9HIhwyFPkWa+JF+0LgOrEUfd8iZka6s=
github.com/474420502/focus v0.13.0 h1:68G0txM38EinNitcfpP0752k8tF4JRJ0r1mmdH6FoGc=
github.com/474420502/focus v0.13.0/go.mod h1:d0PMjtMxFz1a9HIhwyFPkWa+JF+0LgOrEUfd8iZka6s=
github.com/474420502/focus v0.13.1 h1:HwJCqY60eqRAkwKtIefJib1ofBfcvVh5ZTU2xE8Gmkk=
github.com/474420502/focus v0.13.1/go.mod h1:SrqNq63qSx53TkvVWOuHTbTSvAQTNO8ZUrufXm0Ncq8=
github.com/474420502/requests v1.10.0 h1:Oz7+Nx+1iuJJUjbBH3cVmkDVosF2tyq5d72TMAoQH8I=
github.com/474420502/requests v1.10.0/go.mod h1:SB8/RIUVWF3AGotuq/mATUwAjXzzlV7iWaBNM3+c06c=
github.com/474420502/requests v1.10.1 h1:k5qK8ZWPIdrG0EurJuK2hhoYFbJ9GJTe0xvrzESMFLo=
@@ -127,6 +131,7 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=

View File

@@ -42,10 +42,9 @@ func init() {
task := engine.Group("/task")
task.GET("/get", GetTask)
task.POST("/put", PutTask)
task.POST("/content", ContentTask)
task.POST("/error", ErrorTask)
task.GET("/config", GetConfig)
task.GET("/ready", ReadyTask)
task.POST("/ack", AckTask)
@@ -174,6 +173,11 @@ func ReadyTask(c *gin.Context) {
c.JSON(http.StatusOK, Response{Code: 404, Message: fmt.Sprintf("taskid: %s is not found", tid)})
}
// GetConfig 获取任务配置
func GetConfig(c *gin.Context) {
}
// ErrorTask 任务错误无法完成
func ErrorTask(c *gin.Context) {
tid := c.PostForm("taskid")