What I want
I want to get client's IP in my TCP server and use it to whitelist/bind actions, detect regions (for language and currency), etc.
How I approached it
I'm using TornadoWeb framework for python to set up my tcp server.
It contains TCPServer.handler_stream(stream: IOStream, address: tuple[str, int])
from where i can get a hand on client's IP address. It's all good when running with host network (i.e. exposing my ports directly)
Problem
If launched multiple tasks (containers) in docker swarm, and therefore use docker's load balancer, client's IP address gets replaced with docker's inner one.
Question
How do i configure docker swarm or another load balancer to somehow send real client's ip to my server?
I'm not particularly bound to one piece of software or another, nor do i know which is better, the only thing I wouldn't consider - is using Kubernetes (not now at least), so any suggestion on software rather than configuration are also welcome!
Client and server can be altered, so other techniques I could use regardless of protocol itself will also be useful. However, something like using HTTPs requests to gather IP address via X-Forwarded-For or X-Real-IP headers is possible, but i'd like to refrain myself from it.