working on documentation
This commit is contained in:
@@ -10,7 +10,9 @@ import System.Process ( ProcessHandle )
|
||||
|
||||
import Data.Aeson ( FromJSON )
|
||||
|
||||
import Error (IOEitherError)
|
||||
import Error
|
||||
( IOEitherError
|
||||
)
|
||||
|
||||
import JSON
|
||||
( IPAdressTable
|
||||
@@ -40,8 +42,19 @@ data P2PRCapi = MkP2PRCapi
|
||||
}
|
||||
|
||||
|
||||
data MapPortRequest
|
||||
= MkMapPortRequest Int String
|
||||
{- |
|
||||
|
||||
__Example:__
|
||||
|
||||
@
|
||||
port = 'MkMapPortRequest' 8080 \"jose.akilan.io\"
|
||||
@
|
||||
|
||||
-}
|
||||
data MapPortRequest =
|
||||
MkMapPortRequest
|
||||
Int -- ^ TCP socket number
|
||||
String -- ^ Network domain name
|
||||
|
||||
|
||||
getP2prcAPI :: IOEitherError P2PRCapi
|
||||
|
||||
@@ -8,9 +8,9 @@ import System.Process
|
||||
, ProcessHandle
|
||||
)
|
||||
|
||||
import System.Exit ( ExitCode(ExitFailure) )
|
||||
|
||||
import Data.Aeson
|
||||
import System.Exit
|
||||
( ExitCode(ExitFailure)
|
||||
)
|
||||
|
||||
import Error
|
||||
( IOEitherError
|
||||
@@ -18,6 +18,11 @@ import Error
|
||||
, assignError
|
||||
)
|
||||
|
||||
import Data.Aeson
|
||||
( FromJSON
|
||||
, eitherDecode
|
||||
)
|
||||
|
||||
import qualified Data.Text as T
|
||||
|
||||
import qualified Data.ByteString.Lazy.Char8 as LBC8
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
module Environment ( cleanEnvironment ) where
|
||||
module Environment
|
||||
( cleanEnvironment
|
||||
)
|
||||
where
|
||||
|
||||
|
||||
import System.Directory
|
||||
|
||||
@@ -1,13 +1,24 @@
|
||||
module Error where
|
||||
module Error
|
||||
( Error(..)
|
||||
, IOEitherError
|
||||
, assignError
|
||||
) where
|
||||
|
||||
|
||||
-- ^ Error type for the application
|
||||
data Error
|
||||
= MkUnknownError String
|
||||
| MkErrorSpawningProcess String
|
||||
| MkSystemError Int String String
|
||||
= MkUnknownError
|
||||
String -- ^ error message
|
||||
| MkErrorSpawningProcess
|
||||
String -- ^ error message
|
||||
| MkSystemError
|
||||
Int -- ^ System error code
|
||||
String -- ^ String1
|
||||
String -- ^ String2
|
||||
deriving Show
|
||||
|
||||
type IOEitherError a = IO (Either Error a)
|
||||
-- ^ Type synonym for an IO action with either returns an Error or a parsed value
|
||||
type IOEitherError a = IO ( Either Error a)
|
||||
|
||||
assignError :: String -> Error
|
||||
assignError = MkUnknownError
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
This helper module exports the main functions and data type definitions necessary to get started with the P2PRC api.
|
||||
|
||||
A minimal application will require the import of "runP2PRC" function that accepts a "MapPortRequest" value that exposes a specific port number and associates it with a domain name in the internet.
|
||||
A minimal application will require the import of 'runP2PRC' function that accepts a 'MapPortRequest' value that exposes a specific port number and associates it with a domain name in the internet.
|
||||
|
||||
This is a small template to get quickly get started with this interface. We assume the user has already an application listening on the tcp socket "8080".
|
||||
|
||||
@@ -35,14 +35,15 @@ This is a small template to get quickly get started with this interface. We assu
|
||||
|
||||
|
||||
module P2PRC
|
||||
( MapPortRequest(..)
|
||||
( getP2prcAPI
|
||||
, runP2PRC
|
||||
, MapPortRequest(..)
|
||||
, P2PRCapi
|
||||
, IPAdressTable
|
||||
, MapPortResponse
|
||||
, P2prcConfig
|
||||
, Error
|
||||
, IOEitherError
|
||||
, getP2prcAPI
|
||||
, runP2PRC
|
||||
)
|
||||
where
|
||||
|
||||
@@ -64,4 +65,9 @@ import API
|
||||
)
|
||||
|
||||
|
||||
import Error (IOEitherError)
|
||||
import Error
|
||||
( Error
|
||||
, IOEitherError
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user