MCPcopy Index your code
hub / github.com/SenseUnit/dumbproxy / StdIOHandler

Function StdIOHandler

handler/stdio.go:14–25  ·  view source on GitHub ↗
(d HandlerDialer, logger *clog.CondLogger, forward ForwardFunc)

Source from the content-addressed store, hash-verified

12)
13
14func StdIOHandler(d HandlerDialer, logger *clog.CondLogger, forward ForwardFunc) func(context.Context, dialer.ReadPipe, dialer.WritePipe, string) error {
15 return func(ctx context.Context, reader dialer.ReadPipe, writer dialer.WritePipe, dstAddress string) error {
16 logger.Debug("Request: %v => %v %q %v %v %v", "<stdio>", "<stdio>", "", "STDIO", "CONNECT", dstAddress)
17 target, err := d.DialContext(ctx, "tcp", dstAddress)
18 if err != nil {
19 return fmt.Errorf("connect to %q failed: %w", dstAddress, err)
20 }
21 defer target.Close()
22
23 return forward(ctx, "", dialer.NewPipeConn(reader, writer, nil), target, "tcp", dstAddress)
24 }
25}
26
27type DummyAddress struct {
28 network string

Callers 1

runFunction · 0.92

Calls 5

NewPipeConnFunction · 0.92
ErrorfMethod · 0.80
DialContextMethod · 0.65
CloseMethod · 0.65
DebugMethod · 0.45

Tested by

no test coverage detected