summaryrefslogtreecommitdiffhomepage
path: root/Servers.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-09-26 14:11:32 -0400
committerJoey Hess <joeyh@joeyh.name>2016-09-26 14:15:52 -0400
commita1d5de397cd1b12080e4652965591827e6d50c86 (patch)
treeb2385eb31dba6e130cd2af2bd6b298cb0bc7bc0f /Servers.hs
parent2c6a13f5db2671038efbfdcdb9c63f4758bd2e18 (diff)
downloadkeysafe-a1d5de397cd1b12080e4652965591827e6d50c86.tar.gz
Randomize the server list.
May help avoid some correlations. Once there are many servers, will spread the load out amoung them. This commit was sponsored by Ethan Aubin.
Diffstat (limited to 'Servers.hs')
-rw-r--r--Servers.hs22
1 files changed, 15 insertions, 7 deletions
diff --git a/Servers.hs b/Servers.hs
index d12fc56..7edc7af 100644
--- a/Servers.hs
+++ b/Servers.hs
@@ -7,6 +7,7 @@ module Servers where
import Types.Server
import Servant.Client
+import System.Random.Shuffle
serverUrls :: Server -> [BaseUrl]
serverUrls srv = map go (serverAddress srv)
@@ -17,15 +18,22 @@ networkServers :: [Server]
networkServers =
[ Server (ServerName "keysafe.joeyh.name") Alternate
[ServerAddress "vzgrspuxbtnlrtup.onion" 4242]
+ "Provided by Joey Hess. Digital Ocean VPS, located in Indonesia"
- -- Purism server is not yet deployed, but planned.
, Server (ServerName "keysafe.puri.sm") Alternate
[]
+ "Purism server is not yet deployed, but planned."
- -- Unknown yet who will provide this server, but allocate it now
- -- so keysafe can start queuing uploads to it.
- , Server (ServerName "thirdserver") Recommended
- []
- -- [ServerAddress "eqi7glyxe5ravak5.onion" 4242]
- -- -- ^ still being vetted
+ -- Provided by https://faelix.net/
+ -- Marek Isalski
+ , Server (ServerName "thirdserver") Alternate -- still being vetted
+ [ServerAddress "eqi7glyxe5ravak5.onion" 4242]
+ "Provided by Marek Isalski at Faelix. Currently located in UK, but planned move to CH"
]
+
+-- | Shuffles the server list, keeping Recommended first, then
+-- Alternate, and finally Untrusted.
+shuffleServers :: [Server] -> IO [Server]
+shuffleServers l = concat <$> mapM shuf [minBound..maxBound]
+ where
+ shuf sl = shuffleM (filter (\s -> serverLevel s == sl) l)