From e7c0bcd945f8365e86e99b9d450f3a3389fa0e66 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 6 Oct 2018 19:33:51 -0700 Subject: altos-mapd: Add geo-fencing for map requests. Add port and key arguments Map requests are now limited to a region within 17km of any registered launch site. The --port argument allows the listen port to be changed. The --key argument provides the name of a file containing the Google maps API key. Signed-off-by: Keith Packard --- map-server/altos-mapd/AltosMapdServer.java | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'map-server/altos-mapd/AltosMapdServer.java') diff --git a/map-server/altos-mapd/AltosMapdServer.java b/map-server/altos-mapd/AltosMapdServer.java index 68b427f0..749edbc7 100644 --- a/map-server/altos-mapd/AltosMapdServer.java +++ b/map-server/altos-mapd/AltosMapdServer.java @@ -15,23 +15,10 @@ package altosmapd; import java.net.*; +import java.io.*; -public class AltosMapdServer { - ServerSocket socket; - - public Socket accept() { - try { - return socket.accept(); - } catch (Exception e) { - return null; - } - } - - public AltosMapdServer(int port) { - try { - socket = new ServerSocket(port, 5, InetAddress.getLoopbackAddress()); - } catch (Exception e) { - socket = null; - } +public class AltosMapdServer extends ServerSocket { + public AltosMapdServer(int port) throws IOException { + super(port, 5, InetAddress.getLoopbackAddress()); } } -- cgit v1.2.3