summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2015-04-01 15:39:00 -0400
committerjoe <joe@jerkface.net>2015-04-01 15:39:00 -0400
commit1c73ec7dff361ea3ea4d2b8f641de93412668f5b (patch)
tree04ed73ba8f1286dbcdb645d93503bec9375ab734 /src/Network
parentaeaabf8b0a9a3942eb665b62e7ae8f97ada69fdf (diff)
Allow specifying NodeId as hexadecimal string.
Diffstat (limited to 'src/Network')
-rw-r--r--src/Network/BitTorrent/Address.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Network/BitTorrent/Address.hs b/src/Network/BitTorrent/Address.hs
index 3159fab0..9f9340d1 100644
--- a/src/Network/BitTorrent/Address.hs
+++ b/src/Network/BitTorrent/Address.hs
@@ -643,7 +643,8 @@ instance Serialize NodeId where
643-- | ASCII encoded. 643-- | ASCII encoded.
644instance IsString NodeId where 644instance IsString NodeId where
645 fromString str 645 fromString str
646 | L.length str == nodeIdSize = NodeId (fromString str) 646 | L.length str == nodeIdSize = NodeId (fromString str)
647 | L.length str == 2 * nodeIdSize = NodeId (fst $ Base16.decode $ fromString str)
647 | otherwise = error "fromString: invalid NodeId length" 648 | otherwise = error "fromString: invalid NodeId length"
648 {-# INLINE fromString #-} 649 {-# INLINE fromString #-}
649 650