Skip to content
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

Try Generics #19

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Try Generics #19

wants to merge 2 commits into from

Conversation

fortuna
Copy link
Contributor

@fortuna fortuna commented May 23, 2023

No description provided.

@fortuna fortuna requested a review from jyyi1 May 23, 2023 14:46
// Connect establishes a connection with the endpoint, returning the connection.
Connect(ctx context.Context) (StreamConn, error)
}
type StreamEndpoint = Endpoint[StreamConn]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is better:

Suggested change
type StreamEndpoint = Endpoint[StreamConn]
type StreamEndpoint interface {
Endpoint[StreamConn]
}

@@ -21,10 +21,7 @@ import (
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if I should define

type PacketConn interface {
  net.Conn
}

That would be a parallel to StreamConn and allow us to expand in the future, if needed.

It would, however, be confusing with net.PacketConn. Perhaps it makes sense to call it DatagramConn or DgramConn, to mirror posix sockets.

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.

None yet

1 participant