stun_client/lib.rs
1//! This is a simple async_std based asynchronous STUN client library.
2//! At the moment only some features of [RFC8489](https://tools.ietf.org/html/rfc8489) are implemented and only simple binding requests are possible.
3//!
4//! It also supports the OTHER-ADDRESS and CHANGE-REQUEST attributes for [RFC5780](https://tools.ietf.org/html/rfc5780) -based NAT Behavior Discovery
5//!
6//! ## Example
7//!
8//! ```
9//! use async_std::task;
10//! use stun_client::*;
11//!
12//! task::block_on(async {
13//! let mut client = Client::new("0.0.0.0:0", None).await.unwrap();
14//! let res = client
15//! .binding_request("stun.l.google.com:19302", None)
16//! .await
17//! .unwrap();
18//! let class = res.get_class();
19//! match class {
20//! Class::SuccessResponse => {
21//! let xor_mapped_addr = Attribute::get_xor_mapped_address(&res);
22//! println!("XOR-MAPPED-ADDRESS: {}", xor_mapped_addr.unwrap());
23//! },
24//! _ => panic!("error"),
25//! }
26//! });
27//! ```
28
29mod client;
30mod error;
31mod message;
32pub mod nat_behavior_discovery;
33
34pub use client::*;
35pub use error::*;
36pub use message::*;