{-# OPTIONS_HADDOCK prune #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE PatternSynonyms #-}
module Lightning.Protocol.BOLT4.Types (
OnionPacket(..)
, HopPayload(..)
, ShortChannelId(..)
, PaymentData(..)
, TlvRecord(..)
, FailureMessage(..)
, FailureCode(..)
, pattern BADONION
, pattern PERM
, pattern NODE
, pattern UPDATE
, pattern InvalidRealm
, pattern TemporaryNodeFailure
, pattern PermanentNodeFailure
, pattern RequiredNodeFeatureMissing
, pattern InvalidOnionVersion
, pattern InvalidOnionHmac
, pattern InvalidOnionKey
, pattern TemporaryChannelFailure
, pattern PermanentChannelFailure
, pattern AmountBelowMinimum
, pattern FeeInsufficient
, pattern IncorrectCltvExpiry
, pattern ExpiryTooSoon
, pattern IncorrectOrUnknownPaymentDetails
, pattern FinalIncorrectCltvExpiry
, pattern FinalIncorrectHtlcAmount
, pattern ChannelDisabled
, pattern ExpiryTooFar
, pattern InvalidOnionPayload
, pattern MppTimeout
, ProcessResult(..)
, ForwardInfo(..)
, ReceiveInfo(..)
, onionPacketSize
, hopPayloadsSize
, hmacSize
, pubkeySize
, versionByte
, maxPayloadSize
) where
import Data.Bits ((.&.), (.|.))
import qualified Data.ByteString as BS
import Data.Word (Word8, Word16, Word32, Word64)
import GHC.Generics (Generic)
data OnionPacket = OnionPacket
{ OnionPacket -> Word8
opVersion :: {-# UNPACK #-} !Word8
, OnionPacket -> ByteString
opEphemeralKey :: !BS.ByteString
, OnionPacket -> ByteString
opHopPayloads :: !BS.ByteString
, OnionPacket -> ByteString
opHmac :: !BS.ByteString
} deriving (OnionPacket -> OnionPacket -> Bool
(OnionPacket -> OnionPacket -> Bool)
-> (OnionPacket -> OnionPacket -> Bool) -> Eq OnionPacket
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: OnionPacket -> OnionPacket -> Bool
== :: OnionPacket -> OnionPacket -> Bool
$c/= :: OnionPacket -> OnionPacket -> Bool
/= :: OnionPacket -> OnionPacket -> Bool
Eq, Int -> OnionPacket -> ShowS
[OnionPacket] -> ShowS
OnionPacket -> String
(Int -> OnionPacket -> ShowS)
-> (OnionPacket -> String)
-> ([OnionPacket] -> ShowS)
-> Show OnionPacket
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OnionPacket -> ShowS
showsPrec :: Int -> OnionPacket -> ShowS
$cshow :: OnionPacket -> String
show :: OnionPacket -> String
$cshowList :: [OnionPacket] -> ShowS
showList :: [OnionPacket] -> ShowS
Show, (forall x. OnionPacket -> Rep OnionPacket x)
-> (forall x. Rep OnionPacket x -> OnionPacket)
-> Generic OnionPacket
forall x. Rep OnionPacket x -> OnionPacket
forall x. OnionPacket -> Rep OnionPacket x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. OnionPacket -> Rep OnionPacket x
from :: forall x. OnionPacket -> Rep OnionPacket x
$cto :: forall x. Rep OnionPacket x -> OnionPacket
to :: forall x. Rep OnionPacket x -> OnionPacket
Generic)
data HopPayload = HopPayload
{ HopPayload -> Maybe Word64
hpAmtToForward :: !(Maybe Word64)
, HopPayload -> Maybe Word32
hpOutgoingCltv :: !(Maybe Word32)
, HopPayload -> Maybe ShortChannelId
hpShortChannelId :: !(Maybe ShortChannelId)
, HopPayload -> Maybe PaymentData
hpPaymentData :: !(Maybe PaymentData)
, HopPayload -> Maybe ByteString
hpEncryptedData :: !(Maybe BS.ByteString)
, HopPayload -> Maybe ByteString
hpCurrentPathKey :: !(Maybe BS.ByteString)
, HopPayload -> [TlvRecord]
hpUnknownTlvs :: ![TlvRecord]
} deriving (HopPayload -> HopPayload -> Bool
(HopPayload -> HopPayload -> Bool)
-> (HopPayload -> HopPayload -> Bool) -> Eq HopPayload
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: HopPayload -> HopPayload -> Bool
== :: HopPayload -> HopPayload -> Bool
$c/= :: HopPayload -> HopPayload -> Bool
/= :: HopPayload -> HopPayload -> Bool
Eq, Int -> HopPayload -> ShowS
[HopPayload] -> ShowS
HopPayload -> String
(Int -> HopPayload -> ShowS)
-> (HopPayload -> String)
-> ([HopPayload] -> ShowS)
-> Show HopPayload
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> HopPayload -> ShowS
showsPrec :: Int -> HopPayload -> ShowS
$cshow :: HopPayload -> String
show :: HopPayload -> String
$cshowList :: [HopPayload] -> ShowS
showList :: [HopPayload] -> ShowS
Show, (forall x. HopPayload -> Rep HopPayload x)
-> (forall x. Rep HopPayload x -> HopPayload) -> Generic HopPayload
forall x. Rep HopPayload x -> HopPayload
forall x. HopPayload -> Rep HopPayload x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. HopPayload -> Rep HopPayload x
from :: forall x. HopPayload -> Rep HopPayload x
$cto :: forall x. Rep HopPayload x -> HopPayload
to :: forall x. Rep HopPayload x -> HopPayload
Generic)
data ShortChannelId = ShortChannelId
{ ShortChannelId -> Word32
sciBlockHeight :: {-# UNPACK #-} !Word32
, ShortChannelId -> Word32
sciTxIndex :: {-# UNPACK #-} !Word32
, ShortChannelId -> Word16
sciOutputIndex :: {-# UNPACK #-} !Word16
} deriving (ShortChannelId -> ShortChannelId -> Bool
(ShortChannelId -> ShortChannelId -> Bool)
-> (ShortChannelId -> ShortChannelId -> Bool) -> Eq ShortChannelId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ShortChannelId -> ShortChannelId -> Bool
== :: ShortChannelId -> ShortChannelId -> Bool
$c/= :: ShortChannelId -> ShortChannelId -> Bool
/= :: ShortChannelId -> ShortChannelId -> Bool
Eq, Int -> ShortChannelId -> ShowS
[ShortChannelId] -> ShowS
ShortChannelId -> String
(Int -> ShortChannelId -> ShowS)
-> (ShortChannelId -> String)
-> ([ShortChannelId] -> ShowS)
-> Show ShortChannelId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ShortChannelId -> ShowS
showsPrec :: Int -> ShortChannelId -> ShowS
$cshow :: ShortChannelId -> String
show :: ShortChannelId -> String
$cshowList :: [ShortChannelId] -> ShowS
showList :: [ShortChannelId] -> ShowS
Show, (forall x. ShortChannelId -> Rep ShortChannelId x)
-> (forall x. Rep ShortChannelId x -> ShortChannelId)
-> Generic ShortChannelId
forall x. Rep ShortChannelId x -> ShortChannelId
forall x. ShortChannelId -> Rep ShortChannelId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ShortChannelId -> Rep ShortChannelId x
from :: forall x. ShortChannelId -> Rep ShortChannelId x
$cto :: forall x. Rep ShortChannelId x -> ShortChannelId
to :: forall x. Rep ShortChannelId x -> ShortChannelId
Generic)
data PaymentData = PaymentData
{ PaymentData -> ByteString
pdPaymentSecret :: !BS.ByteString
, PaymentData -> Word64
pdTotalMsat :: {-# UNPACK #-} !Word64
} deriving (PaymentData -> PaymentData -> Bool
(PaymentData -> PaymentData -> Bool)
-> (PaymentData -> PaymentData -> Bool) -> Eq PaymentData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PaymentData -> PaymentData -> Bool
== :: PaymentData -> PaymentData -> Bool
$c/= :: PaymentData -> PaymentData -> Bool
/= :: PaymentData -> PaymentData -> Bool
Eq, Int -> PaymentData -> ShowS
[PaymentData] -> ShowS
PaymentData -> String
(Int -> PaymentData -> ShowS)
-> (PaymentData -> String)
-> ([PaymentData] -> ShowS)
-> Show PaymentData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PaymentData -> ShowS
showsPrec :: Int -> PaymentData -> ShowS
$cshow :: PaymentData -> String
show :: PaymentData -> String
$cshowList :: [PaymentData] -> ShowS
showList :: [PaymentData] -> ShowS
Show, (forall x. PaymentData -> Rep PaymentData x)
-> (forall x. Rep PaymentData x -> PaymentData)
-> Generic PaymentData
forall x. Rep PaymentData x -> PaymentData
forall x. PaymentData -> Rep PaymentData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PaymentData -> Rep PaymentData x
from :: forall x. PaymentData -> Rep PaymentData x
$cto :: forall x. Rep PaymentData x -> PaymentData
to :: forall x. Rep PaymentData x -> PaymentData
Generic)
data TlvRecord = TlvRecord
{ TlvRecord -> Word64
tlvType :: {-# UNPACK #-} !Word64
, TlvRecord -> ByteString
tlvValue :: !BS.ByteString
} deriving (TlvRecord -> TlvRecord -> Bool
(TlvRecord -> TlvRecord -> Bool)
-> (TlvRecord -> TlvRecord -> Bool) -> Eq TlvRecord
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TlvRecord -> TlvRecord -> Bool
== :: TlvRecord -> TlvRecord -> Bool
$c/= :: TlvRecord -> TlvRecord -> Bool
/= :: TlvRecord -> TlvRecord -> Bool
Eq, Int -> TlvRecord -> ShowS
[TlvRecord] -> ShowS
TlvRecord -> String
(Int -> TlvRecord -> ShowS)
-> (TlvRecord -> String)
-> ([TlvRecord] -> ShowS)
-> Show TlvRecord
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TlvRecord -> ShowS
showsPrec :: Int -> TlvRecord -> ShowS
$cshow :: TlvRecord -> String
show :: TlvRecord -> String
$cshowList :: [TlvRecord] -> ShowS
showList :: [TlvRecord] -> ShowS
Show, (forall x. TlvRecord -> Rep TlvRecord x)
-> (forall x. Rep TlvRecord x -> TlvRecord) -> Generic TlvRecord
forall x. Rep TlvRecord x -> TlvRecord
forall x. TlvRecord -> Rep TlvRecord x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TlvRecord -> Rep TlvRecord x
from :: forall x. TlvRecord -> Rep TlvRecord x
$cto :: forall x. Rep TlvRecord x -> TlvRecord
to :: forall x. Rep TlvRecord x -> TlvRecord
Generic)
data FailureMessage = FailureMessage
{ FailureMessage -> FailureCode
fmCode :: {-# UNPACK #-} !FailureCode
, FailureMessage -> ByteString
fmData :: !BS.ByteString
, FailureMessage -> [TlvRecord]
fmTlvs :: ![TlvRecord]
} deriving (FailureMessage -> FailureMessage -> Bool
(FailureMessage -> FailureMessage -> Bool)
-> (FailureMessage -> FailureMessage -> Bool) -> Eq FailureMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FailureMessage -> FailureMessage -> Bool
== :: FailureMessage -> FailureMessage -> Bool
$c/= :: FailureMessage -> FailureMessage -> Bool
/= :: FailureMessage -> FailureMessage -> Bool
Eq, Int -> FailureMessage -> ShowS
[FailureMessage] -> ShowS
FailureMessage -> String
(Int -> FailureMessage -> ShowS)
-> (FailureMessage -> String)
-> ([FailureMessage] -> ShowS)
-> Show FailureMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FailureMessage -> ShowS
showsPrec :: Int -> FailureMessage -> ShowS
$cshow :: FailureMessage -> String
show :: FailureMessage -> String
$cshowList :: [FailureMessage] -> ShowS
showList :: [FailureMessage] -> ShowS
Show, (forall x. FailureMessage -> Rep FailureMessage x)
-> (forall x. Rep FailureMessage x -> FailureMessage)
-> Generic FailureMessage
forall x. Rep FailureMessage x -> FailureMessage
forall x. FailureMessage -> Rep FailureMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FailureMessage -> Rep FailureMessage x
from :: forall x. FailureMessage -> Rep FailureMessage x
$cto :: forall x. Rep FailureMessage x -> FailureMessage
to :: forall x. Rep FailureMessage x -> FailureMessage
Generic)
newtype FailureCode = FailureCode Word16
deriving (FailureCode -> FailureCode -> Bool
(FailureCode -> FailureCode -> Bool)
-> (FailureCode -> FailureCode -> Bool) -> Eq FailureCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FailureCode -> FailureCode -> Bool
== :: FailureCode -> FailureCode -> Bool
$c/= :: FailureCode -> FailureCode -> Bool
/= :: FailureCode -> FailureCode -> Bool
Eq, Int -> FailureCode -> ShowS
[FailureCode] -> ShowS
FailureCode -> String
(Int -> FailureCode -> ShowS)
-> (FailureCode -> String)
-> ([FailureCode] -> ShowS)
-> Show FailureCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FailureCode -> ShowS
showsPrec :: Int -> FailureCode -> ShowS
$cshow :: FailureCode -> String
show :: FailureCode -> String
$cshowList :: [FailureCode] -> ShowS
showList :: [FailureCode] -> ShowS
Show)
pattern BADONION :: Word16
pattern $mBADONION :: forall {r}. Word16 -> ((# #) -> r) -> ((# #) -> r) -> r
$bBADONION :: Word16
BADONION = 0x8000
pattern PERM :: Word16
pattern $mPERM :: forall {r}. Word16 -> ((# #) -> r) -> ((# #) -> r) -> r
$bPERM :: Word16
PERM = 0x4000
pattern NODE :: Word16
pattern $mNODE :: forall {r}. Word16 -> ((# #) -> r) -> ((# #) -> r) -> r
$bNODE :: Word16
NODE = 0x2000
pattern UPDATE :: Word16
pattern $mUPDATE :: forall {r}. Word16 -> ((# #) -> r) -> ((# #) -> r) -> r
$bUPDATE :: Word16
UPDATE = 0x1000
pattern InvalidRealm :: FailureCode
pattern $mInvalidRealm :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bInvalidRealm :: FailureCode
InvalidRealm = FailureCode 0x4001
pattern TemporaryNodeFailure :: FailureCode
pattern $mTemporaryNodeFailure :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bTemporaryNodeFailure :: FailureCode
TemporaryNodeFailure = FailureCode 0x2002
pattern PermanentNodeFailure :: FailureCode
pattern $mPermanentNodeFailure :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bPermanentNodeFailure :: FailureCode
PermanentNodeFailure = FailureCode 0x6002
pattern RequiredNodeFeatureMissing :: FailureCode
pattern $mRequiredNodeFeatureMissing :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bRequiredNodeFeatureMissing :: FailureCode
RequiredNodeFeatureMissing = FailureCode 0x6003
pattern InvalidOnionVersion :: FailureCode
pattern $mInvalidOnionVersion :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bInvalidOnionVersion :: FailureCode
InvalidOnionVersion = FailureCode 0xC004
pattern InvalidOnionHmac :: FailureCode
pattern $mInvalidOnionHmac :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bInvalidOnionHmac :: FailureCode
InvalidOnionHmac = FailureCode 0xC005
pattern InvalidOnionKey :: FailureCode
pattern $mInvalidOnionKey :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bInvalidOnionKey :: FailureCode
InvalidOnionKey = FailureCode 0xC006
pattern TemporaryChannelFailure :: FailureCode
pattern $mTemporaryChannelFailure :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bTemporaryChannelFailure :: FailureCode
TemporaryChannelFailure = FailureCode 0x1007
pattern PermanentChannelFailure :: FailureCode
pattern $mPermanentChannelFailure :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bPermanentChannelFailure :: FailureCode
PermanentChannelFailure = FailureCode 0x4008
pattern AmountBelowMinimum :: FailureCode
pattern $mAmountBelowMinimum :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bAmountBelowMinimum :: FailureCode
AmountBelowMinimum = FailureCode 0x100B
pattern FeeInsufficient :: FailureCode
pattern $mFeeInsufficient :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bFeeInsufficient :: FailureCode
FeeInsufficient = FailureCode 0x100C
pattern IncorrectCltvExpiry :: FailureCode
pattern $mIncorrectCltvExpiry :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bIncorrectCltvExpiry :: FailureCode
IncorrectCltvExpiry = FailureCode 0x100D
pattern ExpiryTooSoon :: FailureCode
pattern $mExpiryTooSoon :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bExpiryTooSoon :: FailureCode
ExpiryTooSoon = FailureCode 0x100E
pattern IncorrectOrUnknownPaymentDetails :: FailureCode
pattern $mIncorrectOrUnknownPaymentDetails :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bIncorrectOrUnknownPaymentDetails :: FailureCode
IncorrectOrUnknownPaymentDetails = FailureCode 0x400F
pattern FinalIncorrectCltvExpiry :: FailureCode
pattern $mFinalIncorrectCltvExpiry :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bFinalIncorrectCltvExpiry :: FailureCode
FinalIncorrectCltvExpiry = FailureCode 18
pattern FinalIncorrectHtlcAmount :: FailureCode
pattern $mFinalIncorrectHtlcAmount :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bFinalIncorrectHtlcAmount :: FailureCode
FinalIncorrectHtlcAmount = FailureCode 19
pattern ChannelDisabled :: FailureCode
pattern $mChannelDisabled :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bChannelDisabled :: FailureCode
ChannelDisabled = FailureCode 0x1014
pattern ExpiryTooFar :: FailureCode
pattern $mExpiryTooFar :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bExpiryTooFar :: FailureCode
ExpiryTooFar = FailureCode 21
pattern InvalidOnionPayload :: FailureCode
pattern $mInvalidOnionPayload :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bInvalidOnionPayload :: FailureCode
InvalidOnionPayload = FailureCode 0x4016
pattern MppTimeout :: FailureCode
pattern $mMppTimeout :: forall {r}. FailureCode -> ((# #) -> r) -> ((# #) -> r) -> r
$bMppTimeout :: FailureCode
MppTimeout = FailureCode 23
data ProcessResult
= Forward !ForwardInfo
| Receive !ReceiveInfo
deriving (ProcessResult -> ProcessResult -> Bool
(ProcessResult -> ProcessResult -> Bool)
-> (ProcessResult -> ProcessResult -> Bool) -> Eq ProcessResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ProcessResult -> ProcessResult -> Bool
== :: ProcessResult -> ProcessResult -> Bool
$c/= :: ProcessResult -> ProcessResult -> Bool
/= :: ProcessResult -> ProcessResult -> Bool
Eq, Int -> ProcessResult -> ShowS
[ProcessResult] -> ShowS
ProcessResult -> String
(Int -> ProcessResult -> ShowS)
-> (ProcessResult -> String)
-> ([ProcessResult] -> ShowS)
-> Show ProcessResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ProcessResult -> ShowS
showsPrec :: Int -> ProcessResult -> ShowS
$cshow :: ProcessResult -> String
show :: ProcessResult -> String
$cshowList :: [ProcessResult] -> ShowS
showList :: [ProcessResult] -> ShowS
Show, (forall x. ProcessResult -> Rep ProcessResult x)
-> (forall x. Rep ProcessResult x -> ProcessResult)
-> Generic ProcessResult
forall x. Rep ProcessResult x -> ProcessResult
forall x. ProcessResult -> Rep ProcessResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ProcessResult -> Rep ProcessResult x
from :: forall x. ProcessResult -> Rep ProcessResult x
$cto :: forall x. Rep ProcessResult x -> ProcessResult
to :: forall x. Rep ProcessResult x -> ProcessResult
Generic)
data ForwardInfo = ForwardInfo
{ ForwardInfo -> OnionPacket
fiNextPacket :: !OnionPacket
, ForwardInfo -> HopPayload
fiPayload :: !HopPayload
, ForwardInfo -> ByteString
fiSharedSecret :: !BS.ByteString
} deriving (ForwardInfo -> ForwardInfo -> Bool
(ForwardInfo -> ForwardInfo -> Bool)
-> (ForwardInfo -> ForwardInfo -> Bool) -> Eq ForwardInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ForwardInfo -> ForwardInfo -> Bool
== :: ForwardInfo -> ForwardInfo -> Bool
$c/= :: ForwardInfo -> ForwardInfo -> Bool
/= :: ForwardInfo -> ForwardInfo -> Bool
Eq, Int -> ForwardInfo -> ShowS
[ForwardInfo] -> ShowS
ForwardInfo -> String
(Int -> ForwardInfo -> ShowS)
-> (ForwardInfo -> String)
-> ([ForwardInfo] -> ShowS)
-> Show ForwardInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ForwardInfo -> ShowS
showsPrec :: Int -> ForwardInfo -> ShowS
$cshow :: ForwardInfo -> String
show :: ForwardInfo -> String
$cshowList :: [ForwardInfo] -> ShowS
showList :: [ForwardInfo] -> ShowS
Show, (forall x. ForwardInfo -> Rep ForwardInfo x)
-> (forall x. Rep ForwardInfo x -> ForwardInfo)
-> Generic ForwardInfo
forall x. Rep ForwardInfo x -> ForwardInfo
forall x. ForwardInfo -> Rep ForwardInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ForwardInfo -> Rep ForwardInfo x
from :: forall x. ForwardInfo -> Rep ForwardInfo x
$cto :: forall x. Rep ForwardInfo x -> ForwardInfo
to :: forall x. Rep ForwardInfo x -> ForwardInfo
Generic)
data ReceiveInfo = ReceiveInfo
{ ReceiveInfo -> HopPayload
riPayload :: !HopPayload
, ReceiveInfo -> ByteString
riSharedSecret :: !BS.ByteString
} deriving (ReceiveInfo -> ReceiveInfo -> Bool
(ReceiveInfo -> ReceiveInfo -> Bool)
-> (ReceiveInfo -> ReceiveInfo -> Bool) -> Eq ReceiveInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReceiveInfo -> ReceiveInfo -> Bool
== :: ReceiveInfo -> ReceiveInfo -> Bool
$c/= :: ReceiveInfo -> ReceiveInfo -> Bool
/= :: ReceiveInfo -> ReceiveInfo -> Bool
Eq, Int -> ReceiveInfo -> ShowS
[ReceiveInfo] -> ShowS
ReceiveInfo -> String
(Int -> ReceiveInfo -> ShowS)
-> (ReceiveInfo -> String)
-> ([ReceiveInfo] -> ShowS)
-> Show ReceiveInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReceiveInfo -> ShowS
showsPrec :: Int -> ReceiveInfo -> ShowS
$cshow :: ReceiveInfo -> String
show :: ReceiveInfo -> String
$cshowList :: [ReceiveInfo] -> ShowS
showList :: [ReceiveInfo] -> ShowS
Show, (forall x. ReceiveInfo -> Rep ReceiveInfo x)
-> (forall x. Rep ReceiveInfo x -> ReceiveInfo)
-> Generic ReceiveInfo
forall x. Rep ReceiveInfo x -> ReceiveInfo
forall x. ReceiveInfo -> Rep ReceiveInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ReceiveInfo -> Rep ReceiveInfo x
from :: forall x. ReceiveInfo -> Rep ReceiveInfo x
$cto :: forall x. Rep ReceiveInfo x -> ReceiveInfo
to :: forall x. Rep ReceiveInfo x -> ReceiveInfo
Generic)
onionPacketSize :: Int
onionPacketSize :: Int
onionPacketSize = Int
1366
{-# INLINE onionPacketSize #-}
hopPayloadsSize :: Int
hopPayloadsSize :: Int
hopPayloadsSize = Int
1300
{-# INLINE hopPayloadsSize #-}
hmacSize :: Int
hmacSize :: Int
hmacSize = Int
32
{-# INLINE hmacSize #-}
pubkeySize :: Int
pubkeySize :: Int
pubkeySize = Int
33
{-# INLINE pubkeySize #-}
versionByte :: Word8
versionByte :: Word8
versionByte = Word8
0x00
{-# INLINE versionByte #-}
maxPayloadSize :: Int
maxPayloadSize :: Int
maxPayloadSize = Int
hopPayloadsSize Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
hmacSize Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1
{-# INLINE maxPayloadSize #-}
_useBits :: Word16
_useBits :: Word16
_useBits = Word16
BADONION Word16 -> Word16 -> Word16
forall a. Bits a => a -> a -> a
.&. Word16
PERM Word16 -> Word16 -> Word16
forall a. Bits a => a -> a -> a
.|. Word16
NODE Word16 -> Word16 -> Word16
forall a. Bits a => a -> a -> a
.|. Word16
UPDATE