From 55f8d90dee37f7d5b6dac3b4f4b53761d6aed201 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 5 Sep 2018 11:15:33 -0400 Subject: [PATCH] remove Utlity.SRV, no longer used --- Utility/SRV.hs | 52 ------------------------------------------------- git-annex.cabal | 1 - 2 files changed, 53 deletions(-) delete mode 100644 Utility/SRV.hs diff --git a/Utility/SRV.hs b/Utility/SRV.hs deleted file mode 100644 index df81f49a57..0000000000 --- a/Utility/SRV.hs +++ /dev/null @@ -1,52 +0,0 @@ -{- SRV record lookup - - - - Copyright 2012 Joey Hess - - - - License: BSD-2-clause - -} - -module Utility.SRV ( - mkSRVTcp, - mkSRV, - lookupSRV, - HostPort, -) where - -import Data.Function -import Data.List -import Network -import qualified Network.DNS.Lookup as DNS -import Network.DNS.Resolver -import qualified Data.ByteString.UTF8 as B8 - -newtype SRV = SRV String - deriving (Show, Eq) - -type HostPort = (HostName, PortID) - -type PriorityWeight = (Int, Int) -- sort by priority first, then weight - -mkSRV :: String -> String -> HostName -> SRV -mkSRV transport protocol host = SRV $ concat - ["_", protocol, "._", transport, ".", host] - -mkSRVTcp :: String -> HostName -> SRV -mkSRVTcp = mkSRV "tcp" - -{- Returns an ordered list, with highest priority hosts first. - - - - On error, returns an empty list. -} -lookupSRV :: SRV -> IO [HostPort] -lookupSRV (SRV srv) = do - seed <- makeResolvSeed defaultResolvConf - r <- withResolver seed $ flip DNS.lookupSRV $ B8.fromString srv - return $ either (const []) use r - where - use = orderHosts . map tohosts - tohosts (priority, weight, port, hostname) = - ( (fromIntegral priority, fromIntegral weight) - , (B8.toString hostname, PortNumber $ fromIntegral port) - ) - -orderHosts :: [(PriorityWeight, HostPort)] -> [HostPort] -orderHosts = map snd . sortBy (compare `on` fst) diff --git a/git-annex.cabal b/git-annex.cabal index 16bd3195b2..4350136da4 100644 --- a/git-annex.cabal +++ b/git-annex.cabal @@ -1066,7 +1066,6 @@ Executable git-annex Utility.Process.Transcript Utility.QuickCheck Utility.Rsync - Utility.SRV Utility.SafeCommand Utility.Scheduled Utility.Scheduled.QuickCheck