#async-std #nat #udp #stun #p2p #bindings

stun-client

This is a simple async_std based asynchronous STUN client library

4 releases

0.1.4 Jul 17, 2023
0.1.2 May 28, 2021
0.1.1 May 10, 2021
0.1.0 May 3, 2021

#2752 in Asynchronous

Download history 2/week @ 2025-01-30 19/week @ 2025-02-06 3/week @ 2025-02-27 3/week @ 2025-03-27 25/week @ 2025-04-03 28/week @ 2025-04-10 47/week @ 2025-04-17 20/week @ 2025-04-24 24/week @ 2025-05-01 10/week @ 2025-05-08 3/week @ 2025-05-15

57 downloads per month

MIT license

37KB
748 lines

This is a simple async_std based asynchronous STUN client library. At the moment only some features of RFC8489 are implemented and only simple binding requests are possible.

It also supports the OTHER-ADDRESS and CHANGE-REQUEST attributes for RFC5780 -based NAT Behavior Discovery

Example

use async_std::task;
use stun_client::*;

task::block_on(async {
    let mut client = Client::new("0.0.0.0:0", None).await.unwrap();
    let res = client
        .binding_request("stun.l.google.com:19302", None)
        .await
        .unwrap();
    let class = res.get_class();
    match class {
        Class::SuccessResponse => {
            let xor_mapped_addr = Attribute::get_xor_mapped_address(&res);
            println!("XOR-MAPPED-ADDRESS: {}", xor_mapped_addr.unwrap());
        },
        _ => panic!("error"),
    }
});

test

stun-client

This is a simple async_std based asynchronous STUN client library. At the moment only some features of RFC8489 are implemented and only simple binding requests are possible.

It also supports the OTHER-ADDRESS and CHANGE-REQUEST attributes for RFC5780 -based NAT Behavior Discovery.

Install

Documentation

Examples

Dependencies

~9–20MB
~291K SLoC