MCPcopy
hub / github.com/xjasonlyu/tun2socks / DialContext

Method DialContext

proxy/http.go:37–50  ·  view source on GitHub ↗
(ctx context.Context, metadata *M.Metadata)

Source from the content-addressed store, hash-verified

35}
36
37func (h *HTTP) DialContext(ctx context.Context, metadata *M.Metadata) (c net.Conn, err error) {
38 c, err = dialer.DialContext(ctx, "tcp", h.Addr())
39 if err != nil {
40 return nil, fmt.Errorf("connect to %s: %w", h.Addr(), err)
41 }
42 setKeepAlive(c)
43
44 defer func(c net.Conn) {
45 safeConnClose(c, err)
46 }(c)
47
48 err = h.shakeHand(metadata, c)
49 return
50}
51
52func (h *HTTP) shakeHand(metadata *M.Metadata, rw io.ReadWriter) error {
53 addr := metadata.DestinationAddress()

Callers

nothing calls this directly

Calls 5

shakeHandMethod · 0.95
DialContextFunction · 0.92
setKeepAliveFunction · 0.85
safeConnCloseFunction · 0.85
AddrMethod · 0.65

Tested by

no test coverage detected