/kotlin-multiaddr

Composable and future-proof network addresses https://github.com/multiformats/multiaddr

Primary LanguageKotlin

kotlin-multiaddr

multiaddr implementation in kotlin

Multiaddr is a standard way to represent addresses that:

  • Support any standard network protocols.
  • Self-describe (include protocols).
  • Have a binary packed format.
  • Have a nice string representation.
  • Encapsulate well.

Install

Maven

<dependency>
  <groupId>io.ipfs.multiformats</groupId>
  <artifactId>kotlin-multiaddr</artifactId>
  <version>1.0.0</version>
  <type>pom</type>
</dependency>

Gradle

compile 'io.ipfs.multiformats:kotlin-multiaddr:1.0.0'

Usage

//encapsulate
val md1 = Multiaddr("/ip4/127.0.0.1/udp/1234")
val md2 = Multiaddr("/udp/5678")
val str = md1.encapsulate(md2).toString()

//decapsulate
val md1 = Multiaddr("/ip4/127.0.0.1/udp/5678/ip4/127.0.0.1/udp/1234/udp/1234")
val md2 = Multiaddr("/ip4/127.0.0.1")
val str = md1.decapsulate(md2).toString()

Maintainers

Captain: @changjiashuai.

Contribute

Contributions welcome. Please check out the issues.

Check out our contributing document for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS Code of Conduct.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT © 2016 Protocol Labs Inc.