MCPcopy
hub / github.com/tailscale/tailscale / defaultPort

Function defaultPort

cmd/tailscaled/tailscaled.go:109–119  ·  view source on GitHub ↗

defaultPort returns the default UDP port to listen on for disco+wireguard. By default it returns 0, to pick one randomly from the kernel. If the environment variable PORT is set, that's used instead. The PORT environment variable is chosen to match what the Linux systemd unit uses, to make documenta

()

Source from the content-addressed store, hash-verified

107// The PORT environment variable is chosen to match what the Linux systemd
108// unit uses, to make documentation more consistent.
109func defaultPort() uint16 {
110 if s := envknob.String("PORT"); s != "" {
111 if p, err := strconv.ParseUint(s, 10, 16); err == nil {
112 return uint16(p)
113 }
114 }
115 if envknob.GOOS() == "windows" {
116 return 41641
117 }
118 return 0
119}
120
121var args struct {
122 // tunname is a /dev/net/tun tunnel name ("tailscale0"), the

Callers 1

mainFunction · 0.85

Calls 2

StringFunction · 0.92
GOOSFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…