aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/sctx
diff options
context:
space:
mode:
Diffstat (limited to 'swarm/sctx')
-rw-r--r--swarm/sctx/sctx.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/swarm/sctx/sctx.go b/swarm/sctx/sctx.go
index 8619f6e19..bed2b1145 100644
--- a/swarm/sctx/sctx.go
+++ b/swarm/sctx/sctx.go
@@ -1,7 +1,22 @@
package sctx
+import "context"
+
type ContextKey int
const (
HTTPRequestIDKey ContextKey = iota
+ requestHostKey
)
+
+func SetHost(ctx context.Context, domain string) context.Context {
+ return context.WithValue(ctx, requestHostKey, domain)
+}
+
+func GetHost(ctx context.Context) string {
+ v, ok := ctx.Value(requestHostKey).(string)
+ if ok {
+ return v
+ }
+ return ""
+}