mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 05:57:03 +09:00
17 lines
351 B
Go
17 lines
351 B
Go
package streampool
|
|
|
|
import (
|
|
"context"
|
|
"github.com/anyproto/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)
|
|
}
|