homepage: http://github.com/micxjo/hs-multiaddr
changelog-type: ''
hash: 198ee32f0151bc59544cfebe0b9b2ca5ce7a06acca9406ccc774377b763d1c98
test-bench-deps:
  multiaddr: ! '>=0.1.0 && <0.2'
  base: ! '>=4.7 && <5'
  text: ! '>=1.2.2.0 && <1.3'
  tasty-quickcheck: ! '>=0.8.4 && <0.9'
  tasty-hunit: ! '>=0.9.2 && <0.10'
  tasty: ! '>=0.11.0.2 && <0.12'
maintainer: Micxjo Funkcio <micxjo@fastmail.com>
synopsis: A network address format
changelog: ''
basic-deps:
  cereal: ! '>=0.5.1.0 && <0.6'
  bytestring: ! '>=0.10.6.0 && <0.11'
  base: ! '>=4.7 && <5'
  text: ! '>=1.2.2.0 && <1.3'
  hashable: ! '>=1.2.4.0 && <1.3'
  attoparsec: ! '>=0.13.0.1 && <0.14'
  errors: ! '>=2.1.2 && <2.2'
all-versions:
- '0.1.0'
author: Micxjo Funkcio <micxjo@fastmail.com>
latest: '0.1.0'
description-type: markdown
description: ! '# hs-multiaddr


  [![Build Status](https://travis-ci.org/micxjo/hs-multiaddr.svg?branch=master)](https://travis-ci.org/micxjo/hs-multiaddr)


  A [multiaddr](https://github.com/jbenet/multiaddr) implementation in Haskell. Multiaddr
  is a self-describing network address format supporting a variety of protocols, with
  both string and binary representations.


  ## Installation


  Just clone and ``stack build``. Will be uploaded to Hackage soon!


  ## Usage


  ```haskell

  import Network.Multiaddr


  let Just somewhere = readMultiaddr "/ip4/8.8.8.8/tcp/80"

  protocolNames somewhere -- ["ip4", "tcp"]


  -- Encapsulation

  -- Multiaddr is a monoid, `encapsulate` is just an alias for (<>)

  let Just proxy = readMultiaddr "/ip6/::1/tcp/443"

  let proxied = proxy `encapsulate` somewhere


  toText proxied -- "/ip6/::1/tcp/443/ip4/8.8.8.8/tcp/80"

  hasIPv6 proxied -- True


  -- Grab an individual part of the address

  parts proxied !! 2  -- "/ip4/8.8.8.8"


  -- Encode into a ByteString

  let bytes = encode proxied


  -- Decode and get back the original!

  let Just decoded = decode bytes

  decoded == proxied -- True

  ```

'
license-name: BSD3

Update from Hackage at 2016-02-10T04:41:02+0000
Update from Hackage at 2016-02-10T04:41:02+0000
