How to properly use X-Forwarded-For in v2?

Hello,

in v1, useXForwardedFor is an option of the whitelisting system:

in v2, the whitelisting system is a middleware:

Note, in v1 the X-Forwarded-* headers are "trusted" by default, but in v2 they are not "trusted" by default, because it can be a security issue.