-
Notifications
You must be signed in to change notification settings - Fork 83
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
Server - store list of established connections. #6
Comments
@diltram I tried to make my telnet package feel like Go's built-in Thus, my telnet.Server struct is meant to feel like the http.Server struct. The It is the (non-exported) (Well, that and the |
@diltram Why do you want access to the underlying TCP connection? What are you trying to do? (If I understood what you are trying to accomplish, it might make it easier to figure out how to best design this.) |
@diltram Actually... the Go built-in Could implement something similar to that for my telnet package. It would make it so my telnet package still feels like |
@diltram So, what I'm thinking is something like this:
But... me understanding why you want to get access to the underlying So... what did you need to use from
|
I did an experiment modifying these two files:
I allowed for the setting of nett.Conn on telnet.Context, and set it inside server.go. If you are interested, I'll do a PR with what I've described, which should allow closing #6 and #7, after shipping what I'm currently working on. |
One use case would be to gracefully notify clients that connections are going to be closed. |
Hi! I'm trying to use your library in my project.
I'm working on Telnet Chat and I'm using ShellHandler for that.
The issue which I have is that Server doesn't provide access to new connections in any way.
I was thinking about copying your code for ListenAndServe, Serve and handle methods to my project as implementations of some supertype which will embed telnet.Server but it require a lot of code to be copied. What do you think will be the best choice to solve that?
How do you feel about changing handle method into exported?
Then I would have to implement only ListenAndServer and Serve methods in my own struct.
Another way is just to implement that functionality directly in go-telnet, are you OK with merging change like that?
A third way is to add current connection into a context which then is provided into Handler.
I have own handler which I'm using so that will also solve my issue. Also, it makes sense to add into context current conn, for example, if someone will do other things based on the source of the connection.
To be honest that 3rd option makes the most sense for me. Doesn't require a lot of changes and provides the biggest value added.
The text was updated successfully, but these errors were encountered: