TCP Proxy server first detection

I have seen couple snippets of code and tried many others but I cannot grasp the concept yet.
I have a TCP proxy which I want it to be able to verify which of the sides sends data first.
I have seen the next example which is for a client always first:
https://forum.golangbridge.org/t/help-on-a-golang-tcp-forward-proxy/7462

But What I want is to be able to know which of the connections send data first ie:

clientConn , err := server.Accept()
serverconn, err:= net.Dial(“tcp”, “someserver:25”)

make sure if which of the above is ready to read first.
I never can know if the remote server will send me a “ehlo” first or it is still testing me so in the case the client is the first to send data I want to peek in it first.
Then if the server sent data first I want to peek in it first and then decide on the right next decision like splice/pipe the connections to each other or to do something else.
The thing is that I do not want to get down to the FD level and was hoping that there is a ready to use example.
I was thinking about using channel but it’s hard for me to think how to implement such a solution.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.