hwormhole-0.2.0.1: magic-wormhole client

Safe HaskellNone
LanguageHaskell2010

Transit.Internal.Messages

Description

The JSON messages are derived from these Message types.

Synopsis

Documentation

data TransitMsg Source #

Transit, Answer and Error Message from Client to Client

Constructors

Error Text 
Answer Ack

Answer message is sent on a successful transfer

Transit

Transit message

Instances
Eq TransitMsg Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

(==) :: TransitMsg -> TransitMsg -> Bool

(/=) :: TransitMsg -> TransitMsg -> Bool

Show TransitMsg Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

showsPrec :: Int -> TransitMsg -> ShowS

show :: TransitMsg -> String

showList :: [TransitMsg] -> ShowS

Generic TransitMsg Source # 
Instance details

Defined in Transit.Internal.Messages

Associated Types

type Rep TransitMsg :: * -> *

Methods

from :: TransitMsg -> Rep TransitMsg x

to :: Rep TransitMsg x -> TransitMsg

FromJSON TransitMsg Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

parseJSON :: Value -> Parser TransitMsg

parseJSONList :: Value -> Parser [TransitMsg]

ToJSON TransitMsg Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

toJSON :: TransitMsg -> Value

toEncoding :: TransitMsg -> Encoding

toJSONList :: [TransitMsg] -> Value

toEncodingList :: [TransitMsg] -> Encoding

type Rep TransitMsg Source # 
Instance details

Defined in Transit.Internal.Messages

type Rep TransitMsg = D1 (MetaData "TransitMsg" "Transit.Internal.Messages" "hwormhole-0.2.0.1-inplace" False) (C1 (MetaCons "Error" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) :+: (C1 (MetaCons "Answer" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Ack)) :+: C1 (MetaCons "Transit" PrefixI True) (S1 (MetaSel (Just "abilitiesV1") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Ability]) :*: S1 (MetaSel (Just "hintsV1") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Set ConnectionHint)))))

newtype Ability Source #

A newtype specifically for generating Ability JSON messages

Constructors

Ability 

Fields

Instances
Eq Ability Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

(==) :: Ability -> Ability -> Bool

(/=) :: Ability -> Ability -> Bool

Show Ability Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

showsPrec :: Int -> Ability -> ShowS

show :: Ability -> String

showList :: [Ability] -> ShowS

Generic Ability Source # 
Instance details

Defined in Transit.Internal.Messages

Associated Types

type Rep Ability :: * -> *

Methods

from :: Ability -> Rep Ability x

to :: Rep Ability x -> Ability

FromJSON Ability Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

parseJSON :: Value -> Parser Ability

parseJSONList :: Value -> Parser [Ability]

ToJSON Ability Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

toJSON :: Ability -> Value

toEncoding :: Ability -> Encoding

toJSONList :: [Ability] -> Value

toEncodingList :: [Ability] -> Encoding

type Rep Ability Source # 
Instance details

Defined in Transit.Internal.Messages

type Rep Ability = D1 (MetaData "Ability" "Transit.Internal.Messages" "hwormhole-0.2.0.1-inplace" True) (C1 (MetaCons "Ability" PrefixI True) (S1 (MetaSel (Just "atype") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 AbilityV1)))

data AbilityV1 Source #

Type to represent the abilities

Constructors

DirectTcpV1

Can send directly via TCP

RelayV1

Can relay via a relay server

Instances
Eq AbilityV1 Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

(==) :: AbilityV1 -> AbilityV1 -> Bool

(/=) :: AbilityV1 -> AbilityV1 -> Bool

Show AbilityV1 Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

showsPrec :: Int -> AbilityV1 -> ShowS

show :: AbilityV1 -> String

showList :: [AbilityV1] -> ShowS

Generic AbilityV1 Source # 
Instance details

Defined in Transit.Internal.Messages

Associated Types

type Rep AbilityV1 :: * -> *

Methods

from :: AbilityV1 -> Rep AbilityV1 x

to :: Rep AbilityV1 x -> AbilityV1

FromJSON AbilityV1 Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

parseJSON :: Value -> Parser AbilityV1

parseJSONList :: Value -> Parser [AbilityV1]

ToJSON AbilityV1 Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

toJSON :: AbilityV1 -> Value

toEncoding :: AbilityV1 -> Encoding

toJSONList :: [AbilityV1] -> Value

toEncodingList :: [AbilityV1] -> Encoding

type Rep AbilityV1 Source # 
Instance details

Defined in Transit.Internal.Messages

type Rep AbilityV1 = D1 (MetaData "AbilityV1" "Transit.Internal.Messages" "hwormhole-0.2.0.1-inplace" False) (C1 (MetaCons "DirectTcpV1" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "RelayV1" PrefixI False) (U1 :: * -> *))

data Hint Source #

Hints are messages that specify ways that the client can connect to the peer.

Constructors

Hint 

Fields

Instances
Eq Hint Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

(==) :: Hint -> Hint -> Bool

(/=) :: Hint -> Hint -> Bool

Ord Hint Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

compare :: Hint -> Hint -> Ordering

(<) :: Hint -> Hint -> Bool

(<=) :: Hint -> Hint -> Bool

(>) :: Hint -> Hint -> Bool

(>=) :: Hint -> Hint -> Bool

max :: Hint -> Hint -> Hint

min :: Hint -> Hint -> Hint

Show Hint Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

showsPrec :: Int -> Hint -> ShowS

show :: Hint -> String

showList :: [Hint] -> ShowS

Generic Hint Source # 
Instance details

Defined in Transit.Internal.Messages

Associated Types

type Rep Hint :: * -> *

Methods

from :: Hint -> Rep Hint x

to :: Rep Hint x -> Hint

FromJSON Hint Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

parseJSON :: Value -> Parser Hint

parseJSONList :: Value -> Parser [Hint]

ToJSON Hint Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

toJSON :: Hint -> Value

toEncoding :: Hint -> Encoding

toJSONList :: [Hint] -> Value

toEncodingList :: [Hint] -> Encoding

type Rep Hint Source # 
Instance details

Defined in Transit.Internal.Messages

type Rep Hint = D1 (MetaData "Hint" "Transit.Internal.Messages" "hwormhole-0.2.0.1-inplace" False) (C1 (MetaCons "Hint" PrefixI True) ((S1 (MetaSel (Just "ctype") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 AbilityV1) :*: S1 (MetaSel (Just "priority") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Double)) :*: (S1 (MetaSel (Just "hostname") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text) :*: S1 (MetaSel (Just "port") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Word16))))

data ConnectionHint Source #

Connection Hint is currently a direct hint or a relay hint

Constructors

Direct Hint

Direct Hint

Relay

Relay hint

Fields

Instances
Eq ConnectionHint Source # 
Instance details

Defined in Transit.Internal.Messages

Ord ConnectionHint Source # 
Instance details

Defined in Transit.Internal.Messages

Show ConnectionHint Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

showsPrec :: Int -> ConnectionHint -> ShowS

show :: ConnectionHint -> String

showList :: [ConnectionHint] -> ShowS

Generic ConnectionHint Source # 
Instance details

Defined in Transit.Internal.Messages

Associated Types

type Rep ConnectionHint :: * -> *

FromJSON ConnectionHint Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

parseJSON :: Value -> Parser ConnectionHint

parseJSONList :: Value -> Parser [ConnectionHint]

ToJSON ConnectionHint Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

toJSON :: ConnectionHint -> Value

toEncoding :: ConnectionHint -> Encoding

toJSONList :: [ConnectionHint] -> Value

toEncodingList :: [ConnectionHint] -> Encoding

type Rep ConnectionHint Source # 
Instance details

Defined in Transit.Internal.Messages

type Rep ConnectionHint = D1 (MetaData "ConnectionHint" "Transit.Internal.Messages" "hwormhole-0.2.0.1-inplace" False) (C1 (MetaCons "Direct" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Hint)) :+: C1 (MetaCons "Relay" PrefixI True) (S1 (MetaSel (Just "rtype") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 AbilityV1) :*: S1 (MetaSel (Just "hints") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Hint])))

data Ack Source #

Ack message type

Constructors

FileAck Text

File Ack

MessageAck Text

Message Ack

Instances
Eq Ack Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

(==) :: Ack -> Ack -> Bool

(/=) :: Ack -> Ack -> Bool

Show Ack Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

showsPrec :: Int -> Ack -> ShowS

show :: Ack -> String

showList :: [Ack] -> ShowS

Generic Ack Source # 
Instance details

Defined in Transit.Internal.Messages

Associated Types

type Rep Ack :: * -> *

Methods

from :: Ack -> Rep Ack x

to :: Rep Ack x -> Ack

FromJSON Ack Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

parseJSON :: Value -> Parser Ack

parseJSONList :: Value -> Parser [Ack]

ToJSON Ack Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

toJSON :: Ack -> Value

toEncoding :: Ack -> Encoding

toJSONList :: [Ack] -> Value

toEncodingList :: [Ack] -> Encoding

type Rep Ack Source # 
Instance details

Defined in Transit.Internal.Messages

type Rep Ack = D1 (MetaData "Ack" "Transit.Internal.Messages" "hwormhole-0.2.0.1-inplace" False) (C1 (MetaCons "FileAck" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) :+: C1 (MetaCons "MessageAck" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

data TransitAck Source #

Message sent by the receiver of the file to the sender

Constructors

TransitAck

expected sha256 sum of the transfered file

Fields

  • ack :: Text

    "ack" is "ok" implies a successful transfer

  • sha256 :: Text
     
Instances
Eq TransitAck Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

(==) :: TransitAck -> TransitAck -> Bool

(/=) :: TransitAck -> TransitAck -> Bool

Show TransitAck Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

showsPrec :: Int -> TransitAck -> ShowS

show :: TransitAck -> String

showList :: [TransitAck] -> ShowS

Generic TransitAck Source # 
Instance details

Defined in Transit.Internal.Messages

Associated Types

type Rep TransitAck :: * -> *

Methods

from :: TransitAck -> Rep TransitAck x

to :: Rep TransitAck x -> TransitAck

FromJSON TransitAck Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

parseJSON :: Value -> Parser TransitAck

parseJSONList :: Value -> Parser [TransitAck]

ToJSON TransitAck Source # 
Instance details

Defined in Transit.Internal.Messages

Methods

toJSON :: TransitAck -> Value

toEncoding :: TransitAck -> Encoding

toJSONList :: [TransitAck] -> Value

toEncodingList :: [TransitAck] -> Encoding

type Rep TransitAck Source # 
Instance details

Defined in Transit.Internal.Messages

type Rep TransitAck = D1 (MetaData "TransitAck" "Transit.Internal.Messages" "hwormhole-0.2.0.1-inplace" False) (C1 (MetaCons "TransitAck" PrefixI True) (S1 (MetaSel (Just "ack") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text) :*: S1 (MetaSel (Just "sha256") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))