-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Adding Echo#ListenerNetwork as configuration #1667
Adding Echo#ListenerNetwork as configuration #1667
Conversation
Now Echo could be configured to Listen on tcp supported networks of net.Listen Go standard library (tcp, tcp4, tcp6)
Codecov Report
@@ Coverage Diff @@
## master #1667 +/- ##
==========================================
+ Coverage 84.98% 85.21% +0.22%
==========================================
Files 29 29
Lines 1958 1961 +3
==========================================
+ Hits 1664 1671 +7
+ Misses 187 184 -3
+ Partials 107 106 -1
Continue to review full report at Codecov.
|
func newListener(address string) (*tcpKeepAliveListener, error) { | ||
l, err := net.Listen("tcp", address) | ||
func newListener(address, network string) (*tcpKeepAliveListener, error) { | ||
if network != "tcp" && network != "tcp4" && network != "tcp6" { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it in that way because, later on (line 887) the result of net.Listen is cast as a net.TCPListener. Then that is wrapped in tcpKeepAliveListener, which in Accept() calls AcceptTCP()
In other words, I took the safe route because I'm still not well versed on Echo internals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I answered this some days ago, but I forgot to publish it 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other options are "unix" or "unixpacket", I guess those options doesn't fit here
https://golang.org/pkg/net/#Listen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reasonable. Thank you.
Now Echo could be configured to Listen on tcp supported networks of net.Listen Go standard library (tcp, tcp4, tcp6)
This fix #1658