carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package instancectl
2
3import (
4 "context"
5 "net"
6 "net/http"
7)
8
9type requestConnKey struct{}
10
11func RequestConn(ctx context.Context) net.Conn {
12 c, _ := ctx.Value(requestConnKey{}).(net.Conn)
13 return c
14}
15func requestConnContext(ctx context.Context, c net.Conn) context.Context {
16 return context.WithValue(ctx, requestConnKey{}, c)
17}
18
19// RunWithClaim serves the claim verbs through handler and, when
20// heldRelease is not nil, the moves held-release route through it (the
21// host passes it only with both flags on; nil leaves the route absent).
22func RunWithClaim(args []string, handler, heldRelease http.Handler, hostApp func(string) (string, string, error)) {
23 runWithClaim(args, handler, heldRelease, hostApp)
24}
25