MCPcopy
hub / github.com/tailscale/tailscale / Start

Method Start

control/controlhttp/http_test.go:350–371  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

348}
349
350func (s *socksProxy) Start(t *testing.T) (url string) {
351 t.Helper()
352 s.Lock()
353 defer s.Unlock()
354 ln, err := net.Listen("tcp", "127.0.0.1:0")
355 if err != nil {
356 t.Fatalf("listening for SOCKS server: %v", err)
357 }
358 s.ln = ln
359 s.clientConnAddrs = map[string]bool{}
360 s.proxy.Logf = func(format string, a ...any) {
361 s.Lock()
362 defer s.Unlock()
363 if s.closed {
364 return
365 }
366 t.Logf(format, a...)
367 }
368 s.proxy.Dialer = s.dialAndRecord
369 go s.proxy.Serve(ln)
370 return fmt.Sprintf("socks5://%s", ln.Addr().String())
371}
372
373func (s *socksProxy) Close() {
374 s.Lock()

Callers

nothing calls this directly

Calls 9

HelperMethod · 0.65
LockMethod · 0.65
UnlockMethod · 0.65
ListenMethod · 0.65
FatalfMethod · 0.65
LogfMethod · 0.65
StringMethod · 0.65
ServeMethod · 0.45
AddrMethod · 0.45

Tested by

no test coverage detected