Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use automatic port for UDP send #11

Merged
merged 1 commit into from
Apr 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Build an options struct and create a client:
```rust
use dogstatsd::{Client, Options};

// Binds to a udp socket on 127.0.0.1:8126 for transmitting, and sends to
// 127.0.0.1:8125, the default dogstatsd address.
// Binds to a udp socket on an available ephemeral port on 127.0.0.1 for
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this might have gotten a tad messed up, we're sending to 127.0.0.1:8125, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops, you're absolutely right. I fixed this up and pushed a new commit.

// transmitting, and sends to 127.0.0.1:8125, the default dogstatsd address.
let default_options = Options::default();
let default_client = Client::new(default_options);

Expand Down
13 changes: 7 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
//! ```
//! use dogstatsd::{Client, Options};
//!
//! // Binds to a udp socket on 127.0.0.1:8126 for transmitting, and sends to
//! // 127.0.0.1:8125, the default dogstatsd address.
//! // Binds to a udp socket on an available ephemeral port on 127.0.0.1 for
//! // transmitting, and sends to 127.0.0.1:8125, the default dogstatsd
//! // address.
//! let default_options = Options::default();
//! let default_client = Client::new(default_options);
//!
Expand Down Expand Up @@ -97,7 +98,7 @@ impl Options {
///
/// assert_eq!(
/// Options {
/// from_addr: "127.0.0.1:8126".into(),
/// from_addr: "127.0.0.1:0".into(),
/// to_addr: "127.0.0.1:8125".into(),
/// namespace: String::new(),
/// },
Expand All @@ -106,7 +107,7 @@ impl Options {
/// ```
pub fn default() -> Self {
Options {
from_addr: "127.0.0.1:8126".into(),
from_addr: "127.0.0.1:0".into(),
to_addr: "127.0.0.1:8125".into(),
namespace: String::new(),
}
Expand Down Expand Up @@ -308,7 +309,7 @@ mod tests {
fn test_options_default() {
let options = Options::default();
let expected_options = Options {
from_addr: "127.0.0.1:8126".into(),
from_addr: "127.0.0.1:0".into(),
to_addr: "127.0.0.1:8125".into(),
namespace: String::new(),
};
Expand All @@ -320,7 +321,7 @@ mod tests {
fn test_new() {
let client = Client::new(Options::default());
let expected_client = Client {
from_addr: "127.0.0.1:8126".into(),
from_addr: "127.0.0.1:0".into(),
to_addr: "127.0.0.1:8125".into(),
namespace: String::new(),
};
Expand Down