MCPcopy Index your code
hub / github.com/tailscale/tailscale / testServer

Function testServer

ssh/tailssh/tailssh_integration_test.go:750–774  ·  view source on GitHub ↗
(t *testing.T, username string, forceV1Behavior bool, allowSendEnv bool)

Source from the content-addressed store, hash-verified

748}
749
750func testServer(t *testing.T, username string, forceV1Behavior bool, allowSendEnv bool) string {
751 srv := &server{
752 lb: &testBackend{localUser: username, forceV1Behavior: forceV1Behavior, allowSendEnv: allowSendEnv},
753 logf: log.Printf,
754 tailscaledPath: os.Getenv("TAILSCALED_PATH"),
755 timeNow: time.Now,
756 }
757
758 l, err := net.Listen("tcp", "127.0.0.1:0")
759 if err != nil {
760 t.Fatal(err)
761 }
762 t.Cleanup(func() { l.Close() })
763
764 go func() {
765 for {
766 conn, err := l.Accept()
767 if err == nil {
768 go srv.HandleSSHConn(&addressFakingConn{conn})
769 }
770 }
771 }()
772
773 return l.Addr().String()
774}
775
776type testServerOpts struct {
777 username string

Callers 3

TestSSHAgentForwardingFunction · 0.70
TestIntegrationParamikoFunction · 0.70
testClientFunction · 0.70

Calls 8

HandleSSHConnMethod · 0.95
ListenMethod · 0.65
FatalMethod · 0.65
CleanupMethod · 0.65
CloseMethod · 0.65
AcceptMethod · 0.65
StringMethod · 0.65
AddrMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…