network-anonymous-i2p-0.9.1: Haskell API for I2P anonymous networking

Safe HaskellNone
LanguageHaskell2010

Network.Anonymous.I2P.Protocol

Description

Protocol description

Defines functions that handle the advancing of the SAMv3 protocol.

Warning: This function is used internally by I2P and using these functions directly is unsupported. The interface of these functions might change at any time without prior notice.

Synopsis

Documentation

connect

Arguments

:: forall (m :: * -> *). (MonadIO m, MonadMask m) 
=> HostName

Server hostname.

-> ServiceName

Server service port.

-> ((Socket, SockAddr) -> m r)

Computation taking the communication socket and the server address.

-> m r 

Connect to a TCP server and use the connection.

The connection socket is closed when done or in case of exceptions.

If you prefer to acquire and close the socket yourself, then use connectSock and closeSock.

version Source

Arguments

:: (MonadIO m, MonadMask m) 
=> Socket

Our connection with SAM bridge

-> m [Integer]

Version agreed upon, stores as a list of integers; for example, [3,1] means version 3.1

Announces ourselves with SAM bridge and negotiates protocol version

Defaults to protocol version 3.1, which is the only one we support at the moment.

versionWithConstraint Source

Arguments

:: (MonadIO m, MonadMask m) 
=> ([Integer], [Integer])

Min/max version we want to agree on, stored as a list of integers. For example, ([3,0], [3,1]) means min version 3.0, max version 3.1

-> Socket

Our connection with SAM bridge

-> m [Integer]

Version agreed upon, stores as a list of integers; for example, [3,1] means version 3.1

Performs same handshake as version, but with an explicit min/max supported version provided.

createDestination :: (MonadIO m, MonadMask m) => Maybe SignatureType -> Socket -> m (PrivateDestination, PublicDestination) Source

Creates a new I2P public/private destination pair

createSession Source

Arguments

:: (MonadIO m, MonadMask m) 
=> SocketType

I2P socket type to create

-> Socket

Our connection with SAM bridge

-> m (String, PrivateDestination, PublicDestination)

Our session id and our private destination key

Create a session with default parameters provided.

createSessionWith Source

Arguments

:: (MonadIO m, MonadMask m, Acceptable d, Destination d) 
=> Maybe String

Session id to use. If none is provided, a new unique session id is created.

-> d

Destination to use.

-> SocketType

I2P socket type to create

-> Socket

Our connection with SAM bridge

-> m String

Our session id

Create a session, and explicitly provide all parameters to use

acceptStream Source

Arguments

:: (MonadIO m, MonadMask m) 
=> String

Our session id

-> Socket

Our connection with SAM bridge

-> m (Socket, PublicDestination)

Returns as soon as connection has been accepted

For VirtualStream sockets, accepts one new connection

connectStream Source

Arguments

:: (MonadIO m, MonadMask m, Connectable d, Destination d) 
=> String

Our session id

-> d

Destination we wish to connect to

-> Socket

Our connection with SAM bridge

-> m ()

Returning state

For VirtualStream sockets, establishes connection with a remote

sendDatagram Source

Arguments

:: (MonadIO m, MonadMask m, Connectable d, Destination d) 
=> String

Our session id

-> d

Destination we wish to send message to

-> ByteString

Message we wish to send

-> m ()

Returning state

For DatagramRepliable and DatagramAnonymous, send a message

receiveDatagram Source

Arguments

:: (MonadIO m, MonadMask m) 
=> Socket

Our connection with SAM bridge

-> m (ByteString, Maybe PublicDestination)

Received buffer, possibly with a reply destination

For DatagramRepliable and DatagramAnonymous, receive a message