mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-05-10 01:56:56 +00:00
64 lines
2.5 KiB
Markdown
64 lines
2.5 KiB
Markdown
|
# rust-multiaddr
|
||
|
|
||
|
[](http://ipn.io)
|
||
|
[](https://github.com/multiformats/multiformats)
|
||
|
[](https://webchat.freenode.net/?channels=%23ipfs)
|
||
|
[](https://travis-ci.org/multiformats/rust-multiaddr)
|
||
|
[](https://codecov.io/github/multiformats/rust-multiaddr?branch=master)
|
||
|
[](https://docs.rs/crate/multiaddr)
|
||
|
[](https://crates.io/crates/multiaddr)
|
||
|
[](https://github.com/RichardLitt/standard-readme)
|
||
|
|
||
|
|
||
|
> [multiaddr](https://github.com/multiformats/multiaddr) implementation in Rust.
|
||
|
|
||
|
## Table of Contents
|
||
|
|
||
|
- [Install](#install)
|
||
|
- [Usage](#usage)
|
||
|
- [Maintainers](#maintainers)
|
||
|
- [Contribute](#contribute)
|
||
|
- [License](#license)
|
||
|
|
||
|
## Install
|
||
|
|
||
|
First add this to your `Cargo.toml`
|
||
|
|
||
|
```toml
|
||
|
[dependencies]
|
||
|
multiaddr = "*"
|
||
|
```
|
||
|
|
||
|
then run `cargo build`.
|
||
|
|
||
|
## Usage
|
||
|
|
||
|
```rust
|
||
|
extern crate multiaddr;
|
||
|
|
||
|
use multiaddr::{Multiaddr, ToMultiaddr};
|
||
|
|
||
|
let address = "/ip4/127.0.0.1/udp/1234".parse::<Multiaddr>().unwrap();
|
||
|
// or directly from a string
|
||
|
let other = "/ip4/127.0.0.1".to_multiaddr().unwrap();
|
||
|
|
||
|
assert_eq!(address.to_string(), "/ip4/127.0.0.1/udp/1234");
|
||
|
assert_eq!(other.to_string(), "/ip4/127.0.0.1");
|
||
|
```
|
||
|
|
||
|
## Maintainers
|
||
|
|
||
|
Captain: [@dignifiedquire](https://github.com/dignifiedquire).
|
||
|
|
||
|
## Contribute
|
||
|
|
||
|
Contributions welcome. Please check out [the issues](https://github.com/multiformats/rust-multiaddr/issues).
|
||
|
|
||
|
Check out our [contributing document](https://github.com/multiformats/multiformats/blob/master/contributing.md) 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](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
|
||
|
|
||
|
Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.
|
||
|
|
||
|
## License
|
||
|
|
||
|
[MIT](LICENSE) © 2015-2017 Friedel Ziegelmeyer
|