Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirecting an ip in Java

For the past few weeks, I have been scouring the internet, the minds of computer programmers, and just a few random people over the situation I am looking to overcome. Basically, what I am trying to do it write a AntiJoinBot "plugin" (if you will) for the popular game Minecraft. This would be like all others in respect that it blocks IPs based on if they are using a proxy or not, but this AntiJoinBot is running on a different VPS than the actual server.

This is the best graph I can make of the situation (it's not that good):

(non-minecraft server) Connection -> Proxy check -> Redirect to the server -> Minecraft

The only problem is, I need to be able to redirect the IP and close the connection so that the player's real IP is the one that would connect to the server. If the connection is not able to be closed, it would cause real problems due to some of the plugins we are running.

If you have a solution or a better way to do this, please help me.

like image 374
Enosis Avatar asked Apr 02 '13 22:04

Enosis


People also ask

How to redirect a web page in Java?

In Java web development, to redirect the users to another page, you can call the following method on the HttpServletResponse object response: response.sendRedirect(String location) Technically, the server sends a HTTP status code 302 (Moved Temporarily) to the client. Then the client performs URL redirection to the specified location.

How to send redirect from Java Servlet?

How to send redirect from Java Servlet. In Java web development, to redirect the users to another page, you can call the following method on the HttpServletResponse object response: response.sendRedirect(String location) Technically, the server sends a HTTP status code 302 (Moved Temporarily) to the client.

How do I redirect visitors to another URL using JavaScript?

With a few lines of JavaScript code, you can redirect visitors to another URL. The recommended function is window.location.replace (). A little bit of background information: a JavaScript redirect is a client-side redirect that instructs browsers to load another URL. An example of what a JavaScript redirect to our homepage looks like:

What is the location in the sendredirect () method in Java?

The location in the sendRedirect () method can be a relative path or a completely different URL in absolute path. For example, in a Java servlet’s doGet ()/doPost () method: This statement redirects the client to the login.jsp page relative to the application’s context path. But this redirects to a page relative to the server’s context root:


1 Answers

Redirection of connections along the lines that you want requires support from the (application) protocol. TCP/IP does not support it. AFAIK, SOCKS does not support it either. Unless the Minecraft application protocol (and by implication, Minecraft clients and servers) include support for redirection, you are out of luck.

(FWIW - that's how HTTP redirection works. HTTP has a "protocol element" that allows the server to tell the client to redirect, and where to redirect to. The client then resends the original request to a new address.)

But that doesn't mean that you can't deal with the pests. It just means that the redirection approach is not viable. Try a custom proxy or an IP filter / redirector instead.

like image 123
Stephen C Avatar answered Oct 16 '22 02:10

Stephen C