This commit is contained in:
ston1th 2023-03-21 01:00:13 +01:00
commit 05a68df896
15 changed files with 158 additions and 135 deletions

View file

@ -18,15 +18,6 @@ func local(h types.CtxHandler) types.CtxHandler {
h(ctx)
return
}
//addr, err := netip.ParseAddr(ip)
//if err != nil {
// ctx.Err(types.ErrForbidden)
// return
//}
//if addr.IsLoopback() {
// h(ctx)
// return
//}
ctx.Err(types.ErrForbidden)
}
}

View file

@ -17,43 +17,43 @@ const (
var Routes = []types.Route{
{
healthz,
healthzHandler,
[]string{"GET"},
Path: healthz,
Handler: healthzHandler,
Methods: []string{"GET"},
},
{
schema.KeyPath,
local(keyListHandler),
[]string{"GET"},
Path: schema.KeyPath,
Handler: local(keyListHandler),
Methods: []string{"GET"},
},
{
schema.KeyPath,
local(newHandler),
[]string{"POST"},
Path: schema.KeyPath,
Handler: local(newHandler),
Methods: []string{"POST"},
},
{
keyID,
keyHandler,
[]string{"GET"},
Path: keyID,
Handler: keyHandler,
Methods: []string{"GET"},
},
{
keyReqID,
keyHandler,
[]string{"GET"},
Path: keyReqID,
Handler: keyHandler,
Methods: []string{"GET"},
},
{
keyID,
local(keyHandler),
[]string{"DELETE"},
Path: keyID,
Handler: local(keyHandler),
Methods: []string{"DELETE"},
},
{
schema.ReqPath,
local(reqListHandler),
[]string{"GET"},
Path: schema.ReqPath,
Handler: local(reqListHandler),
Methods: []string{"GET"},
},
{
reqID,
local(reqHandler),
[]string{"PUT", "DELETE"},
Path: reqID,
Handler: local(reqHandler),
Methods: []string{"PUT", "DELETE"},
},
}