WithClientIP adds a client IP address into the context as a value
(ctx context.Context, clientIP string)
| 251 | |
| 252 | // WithClientIP adds a client IP address into the context as a value |
| 253 | func WithClientIP(ctx context.Context, clientIP string) context.Context { |
| 254 | return context.WithValue(ctx, clientIPKey, clientIP) |
| 255 | } |
| 256 | |
| 257 | // ClientIPFromContext retrieves the client IP address or returns false if not present |
| 258 | func ClientIPFromContext(ctx context.Context) (string, bool) { |
no outgoing calls