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

net: document where service names come from? #31249

Open
TomitaSilvestruSC opened this Issue Apr 4, 2019 · 3 comments

Comments

Projects
None yet
7 participants
@TomitaSilvestruSC
Copy link

commented Apr 4, 2019

Found in net/http/server.go:

type Server struct {
	Addr    string  // TCP address to listen on, ":http" if empty

What is this ":http" exactly? Presumably an alias, but I can't find any concrete documentation to know what it resolves to.

Addr string // TCP address to listen on, ":http" if empty

@bradfitz

This comment has been minimized.

Copy link
Member

commented Apr 4, 2019

https://golang.org/pkg/net/#Listen references
https://golang.org/pkg/net/#Dial which says "The port must be a literal port number or a service name."

Perhaps we should mention that comes from /etc/services (or equivalent, depending on OS).

@bradfitz bradfitz changed the title What is ":http"? net: document where service names come from? Apr 4, 2019

@bradfitz bradfitz added the help wanted label Apr 4, 2019

@bradfitz bradfitz added this to the Go1.13 milestone Apr 4, 2019

@agnivade agnivade added the Suggested label Apr 4, 2019

@cuonglm

This comment has been minimized.

Copy link
Contributor

commented Apr 4, 2019

@bradfitz How about mention that service name is defined in RFC 6335, and assigned by IANA

For each OS:

  • *nix: /etc/services
  • Windows: %WINDIR%\system32\drivers\etc\services
  • Plan 9: /lib/ndb/{local,global}

Document each OS seems too much details.

@andybons andybons added the NeedsFix label Apr 4, 2019

@luka-zitnik

This comment has been minimized.

Copy link

commented Apr 5, 2019

Is there missing a description of the address format in general? -- Empty host or port, port "0", square brackets for ipv6 addresses, ... As a reader of the comment I would also be interested in what does using the service name effectively means -- will it be port 80 or a dynamically assigned port from the 80** range?

Can we do something like this?

type Server struct {

	// TCP address to listen on, ":http" (all IP addresses,
	// default http port) if empty
	// See package net for description of the address format
	Addr string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.