started on auth

This commit is contained in:
Joey Hess 2024-07-09 17:30:55 -04:00
parent b5b3d8cde2
commit 08371c3745
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
6 changed files with 76 additions and 16 deletions

View file

@ -26,12 +26,14 @@ import Control.Concurrent.STM
data P2PHttpServerState = P2PHttpServerState
{ acquireP2PConnection :: AcquireP2PConnection
, getServerMode :: GetServerMode
, openLocks :: TMVar (M.Map LockID Locker)
}
mkP2PHttpServerState :: AcquireP2PConnection -> IO P2PHttpServerState
mkP2PHttpServerState acquireconn = P2PHttpServerState
mkP2PHttpServerState :: AcquireP2PConnection -> GetServerMode -> IO P2PHttpServerState
mkP2PHttpServerState acquireconn getservermode = P2PHttpServerState
<$> pure acquireconn
<*> pure getservermode
<*> newTMVarIO mempty
withP2PConnection
@ -61,6 +63,8 @@ withP2PConnection apiver st cu su bypass connaction = do
, connectionServerMode = P2P.ServeReadWrite -- XXX auth
}
type GetServerMode = IsSecure -> Maybe BasicAuthData -> Maybe P2P.ServerMode
data ConnectionParams = ConnectionParams
{ connectionProtocolVersion :: P2P.ProtocolVersion
, connectionServerUUID :: UUID