FromContext retrieves the state from the given context.Context.
(ctx context.Context)
| 233 | |
| 234 | // FromContext retrieves the state from the given context.Context. |
| 235 | func RealIP(ctx context.Context) *RealIPState { |
| 236 | state, ok := ctx.Value(ctxKey{}).(*RealIPState) |
| 237 | if !ok { |
| 238 | return nil |
| 239 | } |
| 240 | return state |
| 241 | } |
| 242 | |
| 243 | // ParseRealIPConfig takes a raw string array of headers and origins |
| 244 | // to produce a config. |
no test coverage detected