-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'mxinden/master' into parity-multiaddr
- Loading branch information
Showing
8 changed files
with
79 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
target | ||
Cargo.lock | ||
*.rs.bk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
[package] | ||
name = "parity-multiaddr" | ||
edition = "2018" | ||
authors = ["dignifiedquire <[email protected]>", "Parity Technologies <[email protected]>"] | ||
description = "Implementation of the multiaddr format" | ||
homepage = "https://github.com/libp2p/rust-libp2p" | ||
edition = "2018" | ||
homepage = "https://github.com/multiformats/rust-multiaddr" | ||
keywords = ["multiaddr", "ipfs"] | ||
license = "MIT" | ||
name = "multiaddr" | ||
readme = "README.md" | ||
version = "0.11.2" | ||
|
||
[features] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# rust-multiaddr | ||
|
||
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) | ||
[![](https://img.shields.io/badge/project-multiformats-blue.svg?style=flat-square)](https://github.com/multiformats/multiformats) | ||
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23ipfs) | ||
[![Travis CI](https://img.shields.io/travis/multiformats/rust-multiaddr.svg?style=flat-square&branch=master)](https://travis-ci.org/multiformats/rust-multiaddr) | ||
[![codecov.io](https://img.shields.io/codecov/c/github/multiformats/rust-multiaddr.svg?style=flat-square&branch=master)](https://codecov.io/github/multiformats/rust-multiaddr?branch=master) | ||
[![](https://img.shields.io/badge/rust-docs-blue.svg?style=flat-square)](https://docs.rs/crate/multiaddr) | ||
[![crates.io](https://img.shields.io/badge/crates.io-v0.2.0-orange.svg?style=flat-square )](https://crates.io/crates/multiaddr) | ||
[![](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ use std::{error, fmt, iter, net::IpAddr}; | |
/// # Example | ||
/// | ||
/// ``` | ||
/// let addr = parity_multiaddr::from_url("ws://127.0.0.1:8080/").unwrap(); | ||
/// let addr = multiaddr::from_url("ws://127.0.0.1:8080/").unwrap(); | ||
/// assert_eq!(addr, "/ip4/127.0.0.1/tcp/8080/ws".parse().unwrap()); | ||
/// ``` | ||
/// | ||
|
@@ -41,8 +41,8 @@ pub fn from_url(url: &str) -> std::result::Result<Multiaddr, FromUrlErr> { | |
/// | ||
/// ``` | ||
/// let addr = "ws://user:[email protected]:8080/"; | ||
/// assert!(parity_multiaddr::from_url(addr).is_err()); | ||
/// assert!(parity_multiaddr::from_url_lossy(addr).is_ok()); | ||
/// assert!(multiaddr::from_url(addr).is_err()); | ||
/// assert!(multiaddr::from_url_lossy(addr).is_ok()); | ||
/// ``` | ||
/// | ||
pub fn from_url_lossy(url: &str) -> std::result::Result<Multiaddr, FromUrlErr> { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters