Skip to content

Conversation

@NicsTr
Copy link

@NicsTr NicsTr commented Feb 6, 2025

During the last few days, I worked on trying to implement an adapter for Read/Write traits from embedded-io (nostd, noalloc). The goal is to be able to take an object that is Read+Write (like a TCPSocket) and turn it into an object that is still Read+Write but that uses Noise under the hood. Ultimately, I want to also implement AsyncRead/AsyncWrite.

I don't know if such a feature would be of interest to be included here. Let me know if you have any feedback or suggestion, and feel free to close this PR if it is out of scope of this project.

(Right now, this PR is just a PoC and is missing at least some thorough testing.)

@jmlepisto
Copy link
Owner

Thanks for the PR! I really do like the idea behind this and can see the possible use cases. I'd be happy to include this if you get everything working fine and can include proper tests and an usage example. Cool stuff!

@NicsTr
Copy link
Author

NicsTr commented Feb 14, 2025

I have reached a first draft version I'm fairly satisfied with. I have included a simple test and a very minimal example to show how I expect the adapter to be used.

I will begin using this interface in a private project of mine, to see how it behaves in a more realistic context.

There is still some TODOs left in comments, some of which require changes in other parts of the code. For example, in order to avoid constructing a Read (respectively Write) object that will fail inevitably when trying to call ::read() (respectively ::write()), I think it could be a good idea to add marker traits to mark one-way transport states (and even handshakers).

@jmlepisto
Copy link
Owner

Thanks a lot for the updates. I'll be sure to review this as soon as I can :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants