J
J
jajabin2019-09-19 22:41:42
linux
jajabin, 2019-09-19 22:41:42

How to forward tcp connection through reverse proxy and store tcp session?

There is such a scheme.
5d83d83d93ca2216015995.png
As can be seen from the scheme, the problem lies in the large delay over the satellite channel. If with client requests via http \ http's and data caching, I found enough material to study and write a proxy server, then I found very little for tcp connections, I'm interested in the question of how to forward a tcp or udp connection initially without knowing where the client will contact ? my suggestion is to use the gopacket package to grab the address and port protocol where to send the connection, as well as how to store these same sessions when reconnecting, I roughly understand that a cache is needed, but what exactly should be stored in it? tell me what to read and where to go.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Tikhonov, 2019-09-20
@jajabin

how to forward tcp or udp connection initially without knowing where the client will contact?

For tcp - no way. A TCP connection is characterized by a quadruple (src_ip, src_port, dst_ip, dst_port). Without knowing where the client will contact, you can’t get a four, which means you can’t send it.
UDP is generally a connectionless protocol. Each message (datagram) is forwarded independently of the previous/following ones.
The cache stores frequently accessed data.
Set a big keepalive and socket timeout.
In general, I did not understand what the problem described in the question is. If you are writing a reverse proxy, read about how the *upstream directives work in nginx - maybe the mess will decrease.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question