go back to provided http server

This commit is contained in:
a 2022-10-25 04:05:28 -05:00
parent a828aa9e46
commit 5ce1b785fa
3 changed files with 5 additions and 18 deletions

View File

@ -4,7 +4,6 @@ import (
"log" "log"
"net/http" "net/http"
"os" "os"
"path"
"strings" "strings"
"time" "time"
@ -34,20 +33,7 @@ func main() {
r.Use(middleware.Recoverer) r.Use(middleware.Recoverer)
r.Use(middleware.SetHeader("Access-Control-Allow-Origin", "*")) r.Use(middleware.SetHeader("Access-Control-Allow-Origin", "*"))
r.HandleFunc("/signatures/{hash}", func(w http.ResponseWriter, r *http.Request) { r.Handle("/signatures/{hash}", &sigs.HttpServer{})
lookup := path.Base(r.URL.Path)
if len(lookup) > 8 {
http.Error(w, "bad path", 400)
return
}
sig := sigs.Hex(lookup)
if sig == "" {
http.Error(w, "not found", 404)
return
}
w.WriteHeader(http.StatusOK)
w.Write([]byte(sig))
})
FileServer(r, "/", filesDir) FileServer(r, "/", filesDir)

2
go.mod
View File

@ -5,6 +5,7 @@ go 1.19
replace github.com/tendermint/tendermint => github.com/bnb-chain/tendermint v0.31.12 replace github.com/tendermint/tendermint => github.com/bnb-chain/tendermint v0.31.12
require ( require (
gfx.cafe/open/4bytes v0.0.0-20221025085909-a307043c1e5e
github.com/RoaringBitmap/roaring v1.2.1 github.com/RoaringBitmap/roaring v1.2.1
github.com/go-chi/chi/v5 v5.0.7 github.com/go-chi/chi/v5 v5.0.7
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d
@ -20,7 +21,6 @@ require (
require ( require (
crawshaw.io/sqlite v0.3.3-0.20210127221821-98b1f83c5508 // indirect crawshaw.io/sqlite v0.3.3-0.20210127221821-98b1f83c5508 // indirect
gfx.cafe/open/4bytes v0.0.0-20221025060640-c4301cc087ee // indirect
github.com/VictoriaMetrics/fastcache v1.12.0 // indirect github.com/VictoriaMetrics/fastcache v1.12.0 // indirect
github.com/VictoriaMetrics/metrics v1.22.2 // indirect github.com/VictoriaMetrics/metrics v1.22.2 // indirect
github.com/ajwerner/btree v0.0.0-20211221152037-f427b3e689c0 // indirect github.com/ajwerner/btree v0.0.0-20211221152037-f427b3e689c0 // indirect

5
go.sum
View File

@ -6,8 +6,8 @@ crawshaw.io/sqlite v0.3.2/go.mod h1:igAO5JulrQ1DbdZdtVq48mnZUBAPOeFzer7VhDWNtW4=
crawshaw.io/sqlite v0.3.3-0.20210127221821-98b1f83c5508 h1:fILCBBFnjnrQ0whVJlGhfv1E/QiaFDNtGFBObEVRnYg= crawshaw.io/sqlite v0.3.3-0.20210127221821-98b1f83c5508 h1:fILCBBFnjnrQ0whVJlGhfv1E/QiaFDNtGFBObEVRnYg=
crawshaw.io/sqlite v0.3.3-0.20210127221821-98b1f83c5508/go.mod h1:igAO5JulrQ1DbdZdtVq48mnZUBAPOeFzer7VhDWNtW4= crawshaw.io/sqlite v0.3.3-0.20210127221821-98b1f83c5508/go.mod h1:igAO5JulrQ1DbdZdtVq48mnZUBAPOeFzer7VhDWNtW4=
filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU= filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU=
gfx.cafe/open/4bytes v0.0.0-20221025060640-c4301cc087ee h1:Wbz69Iw7rhp7UbCNeHs8lSkUoha9cHwvXz9gVZvD+Fg= gfx.cafe/open/4bytes v0.0.0-20221025085909-a307043c1e5e h1:Fl+QPNlTOVAxKqSEdut5fH+/To4TPE8kg8weQ3LGzUY=
gfx.cafe/open/4bytes v0.0.0-20221025060640-c4301cc087ee/go.mod h1:2KCpg7z6U0ePqyX//YkaYEP9aJnmU5HoB6cnXVLR/d0= gfx.cafe/open/4bytes v0.0.0-20221025085909-a307043c1e5e/go.mod h1:C0vwSYhh1b/ckPTkpq0kDXk32vU4DT5QuQwYLxO6W2c=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
@ -475,6 +475,7 @@ github.com/openacid/must v0.1.3/go.mod h1:luPiXCuJlEo3UUFQngVQokV0MPGryeYvtCbQPs
github.com/openacid/slim v0.5.11 h1:LIN8ktjSV5/0h9Wai9o30jpzQPPIYZmaRExmt9nGkPU= github.com/openacid/slim v0.5.11 h1:LIN8ktjSV5/0h9Wai9o30jpzQPPIYZmaRExmt9nGkPU=
github.com/openacid/slim v0.5.11/go.mod h1:ddlyrp5csrPL30DlLp/SjgP4bdgCnmaCmmv4my407VI= github.com/openacid/slim v0.5.11/go.mod h1:ddlyrp5csrPL30DlLp/SjgP4bdgCnmaCmmv4my407VI=
github.com/openacid/tablewriter v0.0.0-20190429071406-b14f71081b86/go.mod h1:iJAvCLjVGFyZOV2Oh123q4PMcoBv2qQLEvjlVIM9E2E= github.com/openacid/tablewriter v0.0.0-20190429071406-b14f71081b86/go.mod h1:iJAvCLjVGFyZOV2Oh123q4PMcoBv2qQLEvjlVIM9E2E=
github.com/openacid/testkeys v0.1.6 h1:vuQZu/NM6nJo0OKUcaFNtm76Rnv3fMIIXrjp0gFX7FM=
github.com/openacid/testkeys v0.1.6/go.mod h1:MfA7cACzBpbiwekivj8StqX0WIRmqlMsci1c37CA3Do= github.com/openacid/testkeys v0.1.6/go.mod h1:MfA7cACzBpbiwekivj8StqX0WIRmqlMsci1c37CA3Do=
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis=
github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=