完成从安装到运行的mock
parent
81a89f53c1
commit
904e468550
|
|
@ -0,0 +1,3 @@
|
||||||
|
FROM ikuiki/vscode-remote-go
|
||||||
|
|
||||||
|
ENV GOPROXY=https://goproxy.io
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"name": "chaos-fake",
|
||||||
|
"dockerFile": "Dockerfile",
|
||||||
|
"extensions": [
|
||||||
|
"ms-vscode.go",
|
||||||
|
"yzhang.markdown-all-in-one",
|
||||||
|
"davidanson.vscode-markdownlint",
|
||||||
|
"wmaurer.change-case",
|
||||||
|
"asuka.insertnumbers"
|
||||||
|
],
|
||||||
|
"runArgs": [
|
||||||
|
"--cap-add=SYS_PTRACE",
|
||||||
|
"--security-opt",
|
||||||
|
"seccomp=unconfined"
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"go.gopath": "/go"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
module chaos-fake
|
||||||
|
|
||||||
|
go 1.12
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/BurntSushi/toml v0.3.1 // indirect
|
||||||
|
github.com/Joker/jade v1.0.0 // indirect
|
||||||
|
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398 // indirect
|
||||||
|
github.com/aymerick/raymond v2.0.2+incompatible // indirect
|
||||||
|
github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 // indirect
|
||||||
|
github.com/fatih/structs v1.1.0 // indirect
|
||||||
|
github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4 // indirect
|
||||||
|
github.com/gorilla/schema v1.1.0 // indirect
|
||||||
|
github.com/iris-contrib/blackfriday v2.0.0+incompatible // indirect
|
||||||
|
github.com/iris-contrib/formBinder v5.0.0+incompatible // indirect
|
||||||
|
github.com/iris-contrib/go.uuid v2.0.0+incompatible // indirect
|
||||||
|
github.com/json-iterator/go v1.1.6 // indirect
|
||||||
|
github.com/kataras/golog v0.0.0-20190624001437-99c81de45f40 // indirect
|
||||||
|
github.com/kataras/iris v11.1.1+incompatible
|
||||||
|
github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d // indirect
|
||||||
|
github.com/klauspost/compress v1.7.4 // indirect
|
||||||
|
github.com/klauspost/cpuid v1.2.1 // indirect
|
||||||
|
github.com/microcosm-cc/bluemonday v1.0.2 // indirect
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
|
github.com/modern-go/reflect2 v1.0.1 // indirect
|
||||||
|
github.com/ryanuber/columnize v2.1.0+incompatible // indirect
|
||||||
|
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
|
||||||
|
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 // indirect
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||||
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
github.com/Joker/hpp v0.0.0-20180418125244-6893e659854a/go.mod h1:MzD2WMdSxvbHw5fM/OXOFily/lipJWRc9C1px0Mt0ZE=
|
||||||
|
github.com/Joker/jade v1.0.0 h1:lOCEPvTAtWfLpSZYMOv/g44MGQFAolbKh2khHHGu0Kc=
|
||||||
|
github.com/Joker/jade v1.0.0/go.mod h1:efZIdO0py/LtcJRSa/j2WEklMSAw84WV0zZVMxNToB8=
|
||||||
|
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398 h1:WDC6ySpJzbxGWFh4aMxFFC28wwGp5pEuoTtvA4q/qQ4=
|
||||||
|
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0=
|
||||||
|
github.com/aymerick/raymond v2.0.2+incompatible h1:VEp3GpgdAnv9B2GFyTvqgcKvY+mfKMjPOA3SbKLtnU0=
|
||||||
|
github.com/aymerick/raymond v2.0.2+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
|
||||||
|
github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 h1:clC1lXBpe2kTj2VHdaIu9ajZQe4kcEY9j0NsnDDBZ3o=
|
||||||
|
github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM=
|
||||||
|
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
|
||||||
|
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
|
||||||
|
github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4 h1:GY1+t5Dr9OKADM64SYnQjw/w99HMYvQ0A8/JoUkxVmc=
|
||||||
|
github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4/go.mod h1:T9YF2M40nIgbVgp3rreNmTged+9HrbNTIQf1PsaIiTA=
|
||||||
|
github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98=
|
||||||
|
github.com/gorilla/schema v1.1.0 h1:CamqUDOFUBqzrvxuz2vEwo8+SUdwsluFh7IlzJh30LY=
|
||||||
|
github.com/gorilla/schema v1.1.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU=
|
||||||
|
github.com/iris-contrib/blackfriday v2.0.0+incompatible h1:o5sHQHHm0ToHUlAJSTjW9UWicjJSDDauOOQ2AHuIVp4=
|
||||||
|
github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI=
|
||||||
|
github.com/iris-contrib/formBinder v5.0.0+incompatible h1:jL+H+cCSEV8yzLwVbBI+tLRN/PpVatZtUZGK9ldi3bU=
|
||||||
|
github.com/iris-contrib/formBinder v5.0.0+incompatible/go.mod h1:i8kTYUOEstd/S8TG0ChTXQdf4ermA/e8vJX0+QruD9w=
|
||||||
|
github.com/iris-contrib/go.uuid v2.0.0+incompatible h1:XZubAYg61/JwnJNbZilGjf3b3pB80+OQg2qf6c8BfWE=
|
||||||
|
github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0=
|
||||||
|
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/juju/errors v0.0.0-20181118221551-089d3ea4e4d5 h1:rhqTjzJlm7EbkELJDKMTU7udov+Se0xZkWmugr6zGok=
|
||||||
|
github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q=
|
||||||
|
github.com/juju/loggo v0.0.0-20180524022052-584905176618/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U=
|
||||||
|
github.com/juju/testing v0.0.0-20180920084828-472a3e8b2073/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA=
|
||||||
|
github.com/kataras/golog v0.0.0-20190624001437-99c81de45f40 h1:Q/QxpyNBtfkhXE68tnEA4yyqm77eh/3YOjOw875VbBY=
|
||||||
|
github.com/kataras/golog v0.0.0-20190624001437-99c81de45f40/go.mod h1:PcaEvfvhGsqwXZ6S3CgCbmjcp+4UDUh2MIfF2ZEul8M=
|
||||||
|
github.com/kataras/iris v11.1.1+incompatible h1:c2iRKvKLpTYMXKdVB8YP/+A67NtZFt9kFFy+ZwBhWD0=
|
||||||
|
github.com/kataras/iris v11.1.1+incompatible/go.mod h1:ki9XPua5SyAJbIxDdsssxevgGrbpBmmvoQmo/A0IodY=
|
||||||
|
github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d h1:V5Rs9ztEWdp58oayPq/ulmlqJJZeJP6pP79uP3qjcao=
|
||||||
|
github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d/go.mod h1:NV88laa9UiiDuX9AhMbDPkGYSPugBOV6yTZB1l2K9Z0=
|
||||||
|
github.com/klauspost/compress v1.7.4 h1:4UqAIzZ1Ns2epCTyJ1d2xMWvxtX+FNSCYWeOFogK9nc=
|
||||||
|
github.com/klauspost/compress v1.7.4/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||||
|
github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w=
|
||||||
|
github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||||
|
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/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw=
|
||||||
|
github.com/microcosm-cc/bluemonday v1.0.2 h1:5lPfLTTAvAbtS0VqT+94yOtFnGfUWYyx0+iToC3Os3s=
|
||||||
|
github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
|
||||||
|
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
|
github.com/ryanuber/columnize v2.1.0+incompatible h1:j1Wcmh8OrK4Q7GXY+V7SVSY8nUWQxHW5TkBe7YUl+2s=
|
||||||
|
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
|
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
|
||||||
|
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc=
|
||||||
|
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/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-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
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/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
|
@ -0,0 +1,137 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/kataras/iris"
|
||||||
|
"github.com/kataras/iris/middleware/logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
app := iris.New()
|
||||||
|
|
||||||
|
// log必须在错误容器上方,否则会失效
|
||||||
|
app.Use(logger.New(logger.DefaultConfig()))
|
||||||
|
|
||||||
|
app.OnErrorCode(iris.StatusNotFound, func(ctx iris.Context) {
|
||||||
|
ctx.Application().Logger().Infof("%s %s Notfound", ctx.Method(), ctx.Path())
|
||||||
|
})
|
||||||
|
|
||||||
|
app.Any("/ServerV60", func(ctx iris.Context) {
|
||||||
|
switch ctx.FormValue("fn") {
|
||||||
|
case "clonelog": // 关键:是否可以开启模拟的app
|
||||||
|
ctx.JSON(map[string]interface{}{
|
||||||
|
"msg": "",
|
||||||
|
})
|
||||||
|
return
|
||||||
|
case "apkplug": // 关键:是否启用机型模拟等功能
|
||||||
|
ctx.JSON(map[string]interface{}{
|
||||||
|
"err": "",
|
||||||
|
"d": 0,
|
||||||
|
"l": 0,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
case "it":
|
||||||
|
ctx.JSON(map[string]interface{}{
|
||||||
|
"err": "",
|
||||||
|
"kf": "客服QQ:2023828192",
|
||||||
|
"pay": 1,
|
||||||
|
"pays": 1,
|
||||||
|
"xwPay": 0,
|
||||||
|
"zfbPay": 1,
|
||||||
|
"hp": 0,
|
||||||
|
"hb": 1,
|
||||||
|
"pm": 0,
|
||||||
|
"sa": 1,
|
||||||
|
"savip": 1,
|
||||||
|
"son": 1,
|
||||||
|
"nv": 120,
|
||||||
|
"jgs": false,
|
||||||
|
"jgr": false,
|
||||||
|
"zd": 0,
|
||||||
|
"zdd": 0,
|
||||||
|
"qt": 0,
|
||||||
|
"yz": "W2e8ajuM2KLM0ULzptXILw==",
|
||||||
|
"au": "http://chaos.91ishare.cn/active_detail.html?t=12",
|
||||||
|
"au1": "http://chaos.91ishare.cn/active_detail_new.html?t=12",
|
||||||
|
"adp": "111",
|
||||||
|
"os": []interface{}{
|
||||||
|
map[string]interface{}{
|
||||||
|
"i": 202,
|
||||||
|
"n": "11.0稳定版",
|
||||||
|
"d": "1、解决部分APP分身兼容性问题<br/>2、插件完全免费使用",
|
||||||
|
"t": 0,
|
||||||
|
"u": "http://dkplat.cn-gd.ufileos.com/res_202",
|
||||||
|
"tv": "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"rgps": "http://chaos.91ishare.cn/",
|
||||||
|
"gdd": 4,
|
||||||
|
"gdl": 4,
|
||||||
|
"st": 1563965353230,
|
||||||
|
"ud": 16273595,
|
||||||
|
"m": "13286138576",
|
||||||
|
"et": 0,
|
||||||
|
"iv": 0,
|
||||||
|
"fk": 0,
|
||||||
|
"fc": 0,
|
||||||
|
"wk": 1,
|
||||||
|
"tk": "hZgFmltcBo7yACnSFyWu8U49f1CpBlD0pG2m6ne4jrg=",
|
||||||
|
"pt": 0,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
default:
|
||||||
|
ctx.StatusCode(iris.StatusNotFound)
|
||||||
|
ctx.WriteString("fn Not Found")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
app.Any("/update/config.json", func(ctx iris.Context) {
|
||||||
|
ctx.JSON(map[string]interface{}{
|
||||||
|
"url": "",
|
||||||
|
"verName": 7.7,
|
||||||
|
"verCode": 77,
|
||||||
|
"s": 0,
|
||||||
|
"desc": "test",
|
||||||
|
"v": 77,
|
||||||
|
"bt1": "",
|
||||||
|
"bt2": "",
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
app.Any("/update/kefu.json", func(ctx iris.Context) {
|
||||||
|
ctx.JSON(map[string]interface{}{
|
||||||
|
"s": 0,
|
||||||
|
"st": "",
|
||||||
|
"et": "",
|
||||||
|
"t": "",
|
||||||
|
"d": "s",
|
||||||
|
"act": "",
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
app.Any("/ServerV64", func(ctx iris.Context) {
|
||||||
|
switch ctx.FormValue("fn") {
|
||||||
|
case "at":
|
||||||
|
ctx.JSON(map[string]interface{}{
|
||||||
|
"l": []interface{}{},
|
||||||
|
"err": 0,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
case "is":
|
||||||
|
ctx.JSON(map[string]interface{}{
|
||||||
|
"is": false,
|
||||||
|
"err": "",
|
||||||
|
})
|
||||||
|
return
|
||||||
|
default:
|
||||||
|
ctx.StatusCode(iris.StatusNotFound)
|
||||||
|
ctx.WriteString("Not Found")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
app.Any("/active_detail.html", func(ctx iris.Context) {
|
||||||
|
ctx.WriteString("<!DOCTYPE html><html><head><title>活动详情</title></head><body>活动</body></html>")
|
||||||
|
})
|
||||||
|
app.Run(iris.Addr(":8081"))
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue