Add SSH Key Management
This commit is contained in:
parent
ef76844922
commit
bcd1805001
62 changed files with 1004 additions and 188 deletions
14
pkg/httpx/wrap.go
Normal file
14
pkg/httpx/wrap.go
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package httpx
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// WithContextWrapper generates a new handler that wraps the context of each request with the wrapper function.
|
||||
func WithContextWrapper(handler http.Handler, wrapper func(context.Context) context.Context) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
r = r.WithContext(wrapper(r.Context()))
|
||||
handler.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue