diff options
author | Keith Packard <keithp@keithp.com> | 2018-10-06 19:33:51 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2018-10-06 19:48:41 -0700 |
commit | e7c0bcd945f8365e86e99b9d450f3a3389fa0e66 (patch) | |
tree | e2f2945b50004313000e2d063f0c00486ce11513 /map-server/altos-mapd/AltosMapdServer.java | |
parent | c7b1f3c6722ae59d09a888084075664446ff2768 (diff) |
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 <keithp@keithp.com>
Diffstat (limited to 'map-server/altos-mapd/AltosMapdServer.java')
-rw-r--r-- | map-server/altos-mapd/AltosMapdServer.java | 21 |
1 files changed, 4 insertions, 17 deletions
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()); } } |