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

Function testServerWithOpts

ssh/tailssh/tailssh_integration_test.go:784–815  ·  view source on GitHub ↗
(t *testing.T, opts testServerOpts)

Source from the content-addressed store, hash-verified

782}
783
784func testServerWithOpts(t *testing.T, opts testServerOpts) string {
785 t.Helper()
786 srv := &server{
787 lb: &testBackend{
788 localUser: opts.username,
789 forceV1Behavior: opts.forceV1Behavior,
790 allowSendEnv: opts.allowSendEnv,
791 allowLocalPortForwarding: opts.allowLocalPortForwarding,
792 allowRemotePortForwarding: opts.allowRemotePortForwarding,
793 },
794 logf: log.Printf,
795 tailscaledPath: os.Getenv("TAILSCALED_PATH"),
796 timeNow: time.Now,
797 }
798
799 l, err := net.Listen("tcp", "127.0.0.1:0")
800 if err != nil {
801 t.Fatal(err)
802 }
803 t.Cleanup(func() { l.Close() })
804
805 go func() {
806 for {
807 conn, err := l.Accept()
808 if err == nil {
809 go srv.HandleSSHConn(&addressFakingConn{conn})
810 }
811 }
812 }()
813
814 return l.Addr().String()
815}
816
817func testSession(t *testing.T, forceV1Behavior bool, allowSendEnv bool, sendEnv map[string]string) *session {
818 cl := testClient(t, forceV1Behavior, allowSendEnv)

Callers 4

TestLocalUnixForwardingFunction · 0.85
TestUnixForwardingDeniedFunction · 0.85

Calls 9

HandleSSHConnMethod · 0.95
HelperMethod · 0.65
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…