Documentation
¶
Overview ¶
Package stdio provides a Transport implementation that uses standard input/output.
Package stdio provides a Transport implementation that uses standard input/output.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StdioTransport ¶
type StdioTransport struct {
// contains filtered or unexported fields
}
StdioTransport implements the Transport interface using standard input/output. It reads messages from stdin and writes messages to stdout.
func NewStdioTransport ¶
func NewStdioTransport() *StdioTransport
NewStdioTransport creates a new StdioTransport with default options.
func NewStdioTransportWithOptions ¶
func NewStdioTransportWithOptions(opts types.TransportOptions) *StdioTransport
NewStdioTransportWithOptions creates a new StdioTransport with the specified options.
func NewStdioTransportWithReadWriter ¶
func NewStdioTransportWithReadWriter(reader io.Reader, writer io.Writer, opts types.TransportOptions) *StdioTransport
NewStdioTransportWithReadWriter creates a new StdioTransport using the provided reader/writer.
func (*StdioTransport) Close ¶
func (t *StdioTransport) Close() error
Close attempts to close the underlying reader/writer if they implement io.Closer.
func (*StdioTransport) Receive ¶
func (t *StdioTransport) Receive() ([]byte, error)
Receive reads the next newline-delimited message from the underlying reader (stdin). It blocks until a message is received or an error occurs.
func (*StdioTransport) ReceiveWithContext ¶
func (t *StdioTransport) ReceiveWithContext(ctx context.Context) ([]byte, error)
ReceiveWithContext reads a message from stdin with context support. It runs the blocking read loop in a goroutine and uses select to wait for the result, an error, or context cancellation.
func (*StdioTransport) Send ¶
func (t *StdioTransport) Send(data []byte) error
Send writes a message to the underlying writer (stdout). It ensures the message ends with a newline and handles locking and flushing.
type StdioTransportFactory ¶
type StdioTransportFactory struct {
// contains filtered or unexported fields
}
StdioTransportFactory creates StdioTransport instances.
func NewStdioTransportFactory ¶
func NewStdioTransportFactory() *StdioTransportFactory
NewStdioTransportFactory creates a new StdioTransportFactory with default options.
func NewStdioTransportFactoryWithOptions ¶
func NewStdioTransportFactoryWithOptions(opts types.TransportOptions) *StdioTransportFactory
NewStdioTransportFactoryWithOptions creates a new StdioTransportFactory with the specified default options.
func (*StdioTransportFactory) NewTransport ¶
func (f *StdioTransportFactory) NewTransport() (types.Transport, error)
NewTransport creates a new StdioTransport with the factory's default options.
func (*StdioTransportFactory) NewTransportWithOptions ¶
func (f *StdioTransportFactory) NewTransportWithOptions(opts types.TransportOptions) (types.Transport, error)
NewTransportWithOptions creates a new StdioTransport with the specified options, potentially overriding the factory's defaults (though current implementation just uses provided opts).