any-sync/net/streampool/context.go

18 lines
352 B
Go

package streampool
import (
"context"
"github.com/anytypeio/any-sync/net/peer"
)
type streamCtxKey uint
const (
streamCtxKeyStreamId streamCtxKey = iota
)
func streamCtx(ctx context.Context, streamId uint32, peerId string) context.Context {
ctx = peer.CtxWithPeerId(ctx, peerId)
return context.WithValue(ctx, streamCtxKeyStreamId, streamId)
}