other proxies like Squid or frox can detect the destination address
from the IP header with
getsockopt(fd, SOL_IP, SO_ORIGINAL_DST, ... )
This is for a transparent proxy mode. Means: The users dont have to
change their local configurations in the ftp program, browser,
mail program, ...
The POP or FTP protocol do not tell you the destination - normally.
The only chance would be to change the username to "username@server.."
But sometimes the username is "username@mydomain.." and the
POP server is pop.bigfirm.com. Delegate connects to mydomain.com.
There is no POP server listening. It does not work.
The analyse of the IP header is the only chance to get the real
Would it be possible for you to implement such transparent proxy
mode feature for ftp, pop, imap?