ShadowJonathan / DusTLS

Pure-Rust DTLS
Apache License 2.0
11 stars 1 forks source link

API Design #1

Open ShadowJonathan opened 2 years ago

ShadowJonathan commented 2 years ago

This is a draft for the API design I currently have in mind, i'm currently thinking of 5 main objects;


These objects basically give an entirely hands-off buffer-based black-box approach to DTLS connection handling, with the application being who needs to handle underlying UdpSocket multiplexing, routing, buffering, and more.

This is to ensure this encryption layer can work over any kind of channel that is unreliable, unordered, but framed, this last guarantee is the most important one, and i'm not sure how to encode that into the IO. Rust doesn't give standard traits or libraries that "understand" a connections "framed-ness". Though luckily objects like UdpSocket don't provide Write + Read at all, and instead require manual polling of the recv and send functions, so i think it's plenty okay to leave that functionality to a wrapping connection manager (such as tokio-rustls is to rustls)

ShadowJonathan commented 2 years ago

The handshakers would probably want to decrease their MTU every time it retransmits, and store this suggestion value for the connection to use.

Though, i'll also want to make that MTU variable available to be altered on the connection objects, if the application discovers it can send bigger datagram packets then the connection objects are currently doing.

Also, i'd like a better name for the connection objects, "connection" is probably the wrong word, maybe "session"?

ShadowJonathan commented 2 years ago

Also, i'd like a better name for the connection objects, "connection" is probably the wrong word, maybe "session"?

Draft 43 of DTLS v1.3 seems to define some terminology, I think it's best to have the names follow from these terms.