|
9 | 9 | Repository containing an implementation of STUN (RFC5389/RFC8489) protocol writing in
|
10 | 10 | the [Rust programming language](https://www.rust-lang.org/).
|
11 | 11 |
|
| 12 | +## Goals |
| 13 | + |
| 14 | +- Efficiency: |
| 15 | + - zero-copy parsing |
| 16 | + - no copies until the message is written. |
| 17 | +- Support externally defined attributes easily. Only 3 traits required for an |
| 18 | + implementation, two of which are `From` and `TryFrom`. |
| 19 | + |
12 | 20 | ## Relevant standards
|
13 | 21 |
|
| 22 | + - [RFC5245](https://tools.ietf.org/html/rfc5245): |
| 23 | + Interactive Connectivity Establishment (ICE): A Protocol for Network Address |
| 24 | + Translator (NAT) Traversal for Offer/Answer Protocols |
14 | 25 | - [RFC5389](https://tools.ietf.org/html/rfc5389):
|
15 | 26 | Session Traversal Utilities for NAT (STUN)
|
| 27 | + - [RFC5766](https://tools.ietf.org/html/rfc5766): |
| 28 | + Traversal Using Relays around NAT (TURN): Relay Extensions to Session |
| 29 | + Traversal Utilities for NAT (STUN) |
| 30 | + - [RFC5769](https://tools.ietf.org/html/rfc5769): |
| 31 | + Test Vectors for Session Traversal Utilities for NAT (STUN) |
| 32 | + - [RFC6156](https://tools.ietf.org/html/rfc6156): |
| 33 | + Traversal Using Relays around NAT (TURN) Extension for IPv6 |
| 34 | + - [RFC8445](https://tools.ietf.org/html/rfc8445): |
| 35 | + Interactive Connectivity Establishment (ICE): A Protocol for Network Address |
| 36 | + Translator (NAT) Traversal |
16 | 37 | - [RFC8489](https://tools.ietf.org/html/rfc8489):
|
17 | 38 | Session Traversal Utilities for NAT (STUN)
|
| 39 | + - [RFC8656](https://tools.ietf.org/html/rfc8656): |
| 40 | + Traversal Using Relays around NAT (TURN): Relay Extensions to Session |
| 41 | + Traversal Utilities for NAT (STUN) |
18 | 42 |
|
19 |
| -# Examples |
| 43 | +## Examples |
20 | 44 |
|
21 | 45 | Have a look at the documentation at the crate root for some examples
|
| 46 | + |
| 47 | +## Why not use `stun_codec`, `stun-format`, `stun-rs`, or 'insert crate here'? |
| 48 | + |
| 49 | +Existing STUN crates suffer from one of a few of shortcomings. |
| 50 | + |
| 51 | +1. Encoding attributes as enum's rather than as a trait. Using a trait for |
| 52 | + attributes allows external code to implement their own attributes and is thus |
| 53 | + not limited to what the crate implements. A trait-based approach also allows |
| 54 | + us to add attribute implementations without requiring breaking semver. |
| 55 | + `rust-stun-coder` and `stun-format` fall into this category. While we do aim |
| 56 | + to eventually support all the STUN attributes currently defined by the IANA |
| 57 | + and in various RFCs, we are also not going to force a user to use our |
| 58 | + implementations (except for integrity and fingerprint attributes). |
| 59 | +2. Non-zero copy parsing. i.e. taking some input data and making no copies |
| 60 | + unless a specific attribute implement is required. This is not usually a big |
| 61 | + deal with most STUN messages but can become an issue with TURN usage and high |
| 62 | + bitrates transfers. Our goal is to perform no copies of the data unless |
| 63 | + necessary. `stun-format`, `stun_codec`, `stun-rs` fail this design goal. The |
| 64 | + only other implementation I could find was `turn-rs` which contains a very |
| 65 | + small STUN implementation that is only enough for TURN usage. |
| 66 | +3. Overly complicated with macros and additional traits. It shouldn't be |
| 67 | + necessary to implement STUN with complicated macros or `decoder`/`encoder` |
| 68 | + traits for messages and attributes. STUN is a relatively simple byte codec |
| 69 | + and does not require a complicated implementation. `stun-rs`, `stun_codec`, |
| 70 | + currently this design goal. |
0 commit comments