-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose socket info in new_session
#60
Conversation
Hi @wiktor-k! Thanks for opening this one. After having a play around with this, I think we have two options here:
Personally I think the first option is probably easier for the sake of extensibility, but does lead users to have to do some type wrangling. What do you think? |
2125223
to
b495ec6
Compare
Okay, phew, check out the latest iteration of changes here. I hope I found an "option 3" :) So, under this new scheme there's no Agent (only The client gives us the ListeningSocket and a SessionFactory which produces Sessions for that type of socket. This way the implementation receives concrete objects, as shown in the key_storage example (the Listener there is a UnixListener on Unix and NamedPipeListener for Windows, it's a bit confusing). This way there's no need for dynamic casts and no need for enums. The only downside is that if the client wants to support all types of sockets (tcp, unix, named pipes) they need to provide 3 implementations of the SocketFactory but there's a blanket implementation for Default, so as, you can see in the README not much changes. (I'm also thinking about adding blanked implementation for types implementing Clone as it'd simplify key_storage example). Happy to hear your input! Thanks for providing me with the motivation to do all these adjustments, code examples and comments - they really are invaluable 🙇 . Sorry for the delays but I'm procrastinating a bit while I should be looking for a Rust job 😃 |
4147ac4
to
ba45d7d
Compare
Okay folks, I've refactored it a bit and just renamed I've also rebased this on top of the OpenPGP Card example and added a new fresh example which accesses and displays the underlying socket info (with peer info in case of a unix socket). I've changed the blanked implementation from Default to Clone since based on the examples it seems Sessions are most frequently cloned from each other. It doesn't have to be like that and the new example illustrates how to do it manually. If you don't mind I'd be happy if you too a look @jcspencer and @baloo 🙏 |
Hi @wiktor-k, sorry for the delay in reviewing this! This looks fantastic, and the way you've structured it should (hopefully) minimize the changes required to existing agent implementations. Looks good to me! |
No worries, glad you were able to take a look! Frankly, I didn't want to proceed without your blessing but I've been writing a couple of examples and it all becomes harder and harder to keep in sync 😅 (I'll rebase, clean and merge early next week) |
Fixes: #55 Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
ba45d7d
to
8c3fb5b
Compare
This is not yet ready and may need a couple of tweaks... so... I'm handing it over to @jcspencer :)