cmd/tailscale: document pump().

Signed-off-by: David Anderson <dave@natulte.net>
pull/54/head
David Anderson 5 years ago
parent 47820db381
commit 4796f6fd67

@ -3,7 +3,7 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// The tailscale command is the Tailscale command-line client. It interacts // The tailscale command is the Tailscale command-line client. It interacts
// with the tailscaled client daemon. // with the tailscaled node agent.
package main // import "tailscale.com/cmd/tailscale" package main // import "tailscale.com/cmd/tailscale"
import ( import (
@ -25,11 +25,12 @@ import (
"tailscale.com/safesocket" "tailscale.com/safesocket"
) )
func pump(ctx context.Context, bc *ipn.BackendClient, c net.Conn) { // pump receives backend messages on conn and pushes them into bc.
func pump(ctx context.Context, bc *ipn.BackendClient, conn net.Conn) {
defer log.Printf("Control connection done.\n") defer log.Printf("Control connection done.\n")
defer c.Close() defer conn.Close()
for ctx.Err() == nil { for ctx.Err() == nil {
msg, err := ipn.ReadMsg(c) msg, err := ipn.ReadMsg(conn)
if err != nil { if err != nil {
log.Printf("ReadMsg: %v\n", err) log.Printf("ReadMsg: %v\n", err)
break break
@ -43,6 +44,7 @@ func main() {
if err != nil { if err != nil {
log.Printf("fixConsoleOutput: %v\n", err) log.Printf("fixConsoleOutput: %v\n", err)
} }
config := getopt.StringLong("config", 'f', "", "path to config file") config := getopt.StringLong("config", 'f', "", "path to config file")
server := getopt.StringLong("server", 's', "https://login.tailscale.com", "URL to tailcontrol server") server := getopt.StringLong("server", 's', "https://login.tailscale.com", "URL to tailcontrol server")
nuroutes := getopt.BoolLong("no-single-routes", 'N', "disallow (non-subnet) routes to single nodes") nuroutes := getopt.BoolLong("no-single-routes", 'N', "disallow (non-subnet) routes to single nodes")

Loading…
Cancel
Save