How to get tcp socket option in a Phoenix web app

I am working on a Phoenix web app. The incoming requests are actually redirected by IPTABLES. Right now I want to know the original destination before iptables redir the connection. For a normal tcp app with c/c++, I can call getsockopt with SO_ORIGINAL_DST.

I’m wondering if possible to get the underlying gen_tcp (through ranch_transport??) and then calling getsocketopt to it. Any advise?