-
Notifications
You must be signed in to change notification settings - Fork 160
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
snet: Simplify the api #3136
Comments
Instead of timeout being in the config struct it should be passed in as a parameter in form of a context. |
@scrye I up-vote this issue. Touching the snet pkg was very confusing because of all the different APIs. |
I agree, I've discussed it with @sustrik as well. A lot of the APIs are no longer needed (bind addresses, path managers, multiple network constructors), and some of the semantics are unclear. The documentation is also lacking. I feel like after a few rounds of removing stuff, we can have something that is as straightforward as the standard library After cleaning up the addresses this is definitely something that we need to do, and once we do that, we should start moving down the parser stack and clean stuff down there too. |
Regarding the suggestions in the first comment, we might be able to simplify even further. Type by type breakdown below. Note that sometimes the following yet-to-be-implemented address types are used:
type NetworkCurrent API:
Simplified API:
type SCIONNetwork (implements Network)Current API:
Suggested API:
type PacketDispatcherServiceCurrent API:
Suggested API:
type ConnCurrent API:
Suggested API: Delete completely. type PacketConnRenamed to type SCIONConnRenamed to Remove methods type SCIONPacketRenamed to type SCIONPacketInfoRenamed to type SCIONPacketConnShould be renamed to something that isn't as confusing (right now this clashes with |
This is great, even just cleaning up the names will be a very nice improvement! 🚀 @scrye Under "type Network", it might be even nicer if the One alternative approach to this interface with a |
@matzf Re taking Regarding the |
- Remove bind - Use a single method Listen / Dial - Use {s}net.UDPAddr as arguments - Improve naming of arguments Contributes scionproto#3136
#3521 is a step towards the new |
- snet.PacketDispatcherService now has a context aware Register method. - snet.Network's Listen and Dial now both take a context. Contributes #3136
One thing I've observed while working with this (partially implemented) new API is that scion/go/lib/infra/messenger/addr.go Lines 138 to 139 in 8e6d4db
Proposal: Would it be feasible to integrate |
Remove snet.Addr, and constructors for snet.SVCAddr and snet.UDPAddr, instead use the struct directly. Contributes #3136
related #3675 |
As a part of this story, we need to have |
- Rename UDPAddrFromString to ParseUDPAddr - Rename SCIONPacket to Packet, SCIONPacketInfo to PacketInfo - Remove snet.Conn interface, rename SCIONConn to Conn This breaks the API. Contributes scionproto#3136 Closes scionproto#3675
- Rename UDPAddrFromString to ParseUDPAddr - Rename SCIONPacket to Packet, SCIONPacketInfo to PacketInfo - Remove snet.Conn interface, rename SCIONConn to Conn This breaks the API. Contributes scionproto#3136 Closes scionproto#3675
- Rename UDPAddrFromString to ParseUDPAddr - Rename SCIONPacket to Packet, SCIONPacketInfo to PacketInfo - Remove snet.Conn interface, rename SCIONConn to Conn This breaks the API. Contributes scionproto#3136 Closes scionproto#3675
This is outdated by now. The current API is much simpler than what we had when this issue was created, but there is still room for cleaning it up further. We'll tackle those in smaller issues. |
There are a number of places where snet's API has multiple similar functions where it would be simpler to use and understand if there was one:
Proposal: it would be a lot simpler to use config structs for each of these cases.
For SCIONNetwork constructors:
For Dial*:
And for Listen*:
The text was updated successfully, but these errors were encountered: