File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,29 @@ func NewStdioTransport() *StdioTransport {
103103 return & StdioTransport {}
104104}
105105
106+ // A StdioTransport is a [Transport] that communicates over stdin/stdout using
107+ // newline-delimited JSON.
108+ type IOTransport struct {
109+ reader io.ReadCloser
110+ writer io.WriteCloser
111+ }
112+
113+ // Connect implements the [Transport] interface.
114+ func (t * IOTransport ) Connect (context.Context ) (Connection , error ) {
115+ return newIOConn (rwc {t .reader , t .writer }), nil
116+ }
117+
118+ // NewIOTransport constructs a transport that communicates over
119+ // io.ReadCloser and io.WriteCloser.
120+ //
121+ //go:fix inline
122+ func NewIOTransport (reader io.ReadCloser , writer io.WriteCloser ) * IOTransport {
123+ return & IOTransport {
124+ reader : reader ,
125+ writer : writer ,
126+ }
127+ }
128+
106129// An InMemoryTransport is a [Transport] that communicates over an in-memory
107130// network connection, using newline-delimited JSON.
108131type InMemoryTransport struct {
You can’t perform that action at this time.
0 commit comments