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

Adding Echo#ListenerNetwork as configuration #1667

Merged
merged 2 commits into from
Dec 12, 2020

Conversation

pafuent
Copy link
Contributor

@pafuent pafuent commented Nov 5, 2020

Now Echo could be configured to Listen on tcp supported networks of net.Listen Go standard library (tcp, tcp4, tcp6)
This fix #1658

Now Echo could be configured to Listen on tcp supported networks of
net.Listen Go standard library (tcp, tcp4, tcp6)
@codecov
Copy link

codecov bot commented Nov 5, 2020

Codecov Report

Merging #1667 (78fe222) into master (6caec30) will increase coverage by 0.22%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
echo.go 86.39% <100.00%> (+1.63%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6caec30...78fe222. Read the comment docs.

@pafuent pafuent mentioned this pull request Nov 5, 2020
3 tasks
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.

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 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.

Copy link
Contributor Author

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 😞

Copy link
Contributor Author

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Reasonable. Thank you.

@pafuent pafuent self-assigned this Nov 26, 2020
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.

ipv4 vs ipv6
3 participants