diff options
-rw-r--r-- | OnionTransport.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/OnionTransport.hs b/OnionTransport.hs index ce1063d2..968e3e38 100644 --- a/OnionTransport.hs +++ b/OnionTransport.hs | |||
@@ -77,6 +77,11 @@ data OnionMessage (f :: * -> *) | |||
77 | | OnionToRoute PublicKey (Assym (f DataToRoute)) -- destination key, aliased Assym | 77 | | OnionToRoute PublicKey (Assym (f DataToRoute)) -- destination key, aliased Assym |
78 | | OnionToRouteResponse (Assym (f DataToRoute)) | 78 | | OnionToRouteResponse (Assym (f DataToRoute)) |
79 | 79 | ||
80 | deriving instance ( Show (f (AnnounceRequest, Nonce8)) | ||
81 | , Show (f AnnounceResponse) | ||
82 | , Show (f DataToRoute) | ||
83 | ) => Show (OnionMessage f) | ||
84 | |||
80 | data OnionToOwner = OnionToOwner NodeInfo (ReturnPath N3) | 85 | data OnionToOwner = OnionToOwner NodeInfo (ReturnPath N3) |
81 | | OnionToMe SockAddr -- SockAddr is immediate peer in route | 86 | | OnionToMe SockAddr -- SockAddr is immediate peer in route |
82 | deriving Show | 87 | deriving Show |
@@ -228,11 +233,12 @@ instance ( Serialize (ReturnPath n) ) => Serialize (OnionResponse n) where | |||
228 | 233 | ||
229 | 234 | ||
230 | data Addressed a = Addressed { sockAddr :: SockAddr, unaddressed :: a } | 235 | data Addressed a = Addressed { sockAddr :: SockAddr, unaddressed :: a } |
236 | deriving (Eq,Show) | ||
231 | 237 | ||
232 | instance Sized a => Sized (Addressed a) where | 238 | instance Sized a => Sized (Addressed a) where |
233 | size = case size of | 239 | size = case size :: Size a of |
234 | ConstSize n -> ConstSize $ 1{-family-} + 16{-ip-} + 2{-port-} + n | 240 | ConstSize n -> ConstSize $ 1{-family-} + 16{-ip-} + 2{-port-} + n |
235 | VarSize f -> VarSize $ \x -> 1{-family-} + 16{-ip-} + 2{-port-} + f x | 241 | VarSize f -> VarSize $ \x -> 1{-family-} + 16{-ip-} + 2{-port-} + f (unaddressed x) |
236 | 242 | ||
237 | getForwardAddr :: S.Get SockAddr | 243 | getForwardAddr :: S.Get SockAddr |
238 | getForwardAddr = do | 244 | getForwardAddr = do |