MCPcopy
hub / github.com/tailscale/tailscale / TestDirectProxyManual

Function TestDirectProxyManual

control/controlclient/controlclient_test.go:230–273  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

228var liveNetworkTest = flag.Bool("live-network-test", false, "run live network tests")
229
230func TestDirectProxyManual(t *testing.T) {
231 if !*liveNetworkTest {
232 t.Skip("skipping without --live-network-test")
233 }
234
235 bus := eventbustest.NewBus(t)
236
237 dialer := &tsdial.Dialer{}
238 dialer.SetNetMon(netmon.NewStatic())
239 dialer.SetBus(bus)
240
241 opts := Options{
242 Persist: persist.Persist{},
243 GetMachinePrivateKey: func() (key.MachinePrivate, error) {
244 return key.NewMachine(), nil
245 },
246 ServerURL: "https://controlplane.tailscale.com",
247 Clock: tstime.StdClock{},
248 Hostinfo: &tailcfg.Hostinfo{
249 BackendLogID: "test-backend-log-id",
250 },
251 DiscoPublicKey: key.NewDisco().Public(),
252 Logf: t.Logf,
253 HealthTracker: health.NewTracker(bus),
254 PopBrowserURL: func(url string) {
255 t.Logf("PopBrowserURL: %q", url)
256 },
257 Dialer: dialer,
258 ControlKnobs: &controlknobs.Knobs{},
259 Bus: bus,
260 }
261 d, err := NewDirect(opts)
262 if err != nil {
263 t.Fatalf("NewDirect: %v", err)
264 }
265 ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
266 defer cancel()
267
268 url, err := d.TryLogin(ctx, LoginEphemeral)
269 if err != nil {
270 t.Fatalf("TryLogin: %v", err)
271 }
272 t.Logf("URL: %q", url)
273}
274
275func TestHTTPSNoProxy(t *testing.T) { testHTTPS(t, false) }
276

Callers

nothing calls this directly

Calls 13

SetNetMonMethod · 0.95
SetBusMethod · 0.95
TryLoginMethod · 0.95
NewBusFunction · 0.92
NewStaticFunction · 0.92
NewMachineFunction · 0.92
NewDiscoFunction · 0.92
NewTrackerFunction · 0.92
NewDirectFunction · 0.85
SkipMethod · 0.65
LogfMethod · 0.65
FatalfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…