Raw
 1package origin
 2
 3import (
 4	"context"
 5	"net/netip"
 6)
 7
 8type Client struct {
 9	Addr      netip.Addr
10	UserAgent string
11}
12
13type key struct{}
14
15func With(ctx context.Context, c Client) context.Context {
16	return context.WithValue(ctx, key{}, c)
17}
18
19func Of(ctx context.Context) Client {
20	c, _ := ctx.Value(key{}).(Client)
21	return c
22}