开发者

Can traffic to multiple services on the same port be identified and re-directed? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 5 years ago.

Improve this question

Think of the following services on one box:

  • SOCKS proxy
  • HTTP proxy
  • SSH service
  • VPN service

I have found a case where it would be beneficial to run all of these services on the same box (save on high server costs with low usage), but they all need to listen on port 80 (network security restrictions require it).

I'm a proficient Java developer. What I am brainstorming is whether it's realistic to consider a simple Java app listening on port 80, determining which service a new connection is bound for, and then redirecting traffic from that connection to a local port where the service is listening.

Is t开发者_如何学运维here something in the initial packets after the connection that I would be able to queue off of to determine the appropriate service?

Creative thoughts are most welcome.


I don't know the structure of all of those protocols, but I would think that the easiest way to find the answer to your question would be to simply write a program that listens on port 80 and writes the initial data to log files, and then connect with each of the above protocols and see if there are obvious patterns.

Running a network analyser on either the server or the client like WireShark would also work, and you don't have to write any code.

Once you know the patterns, you probably should look up the protocol documentation to verify whether it is really reliable.


I agree with Luke's answer, and I think that such a creature is within the realm of possibility. Other factors to consider:

  • If the server receives heavy traffic, there may be some performance impact to running this java redirection service, especially if your heuristics for determining the appropriate destination service are complex.
  • For the HTTP service, you may want the java redirector to issue something like a 301 Moved Permanently to the new port.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜