connection

package
v0.0.0-...-e49a3f0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

an adapter for representing WebSocket connection as a net.Conn some caveats apply: https://github.com/gorilla/websocket/issues/441

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnectionListener

func NewConnectionListener(
	connType ConnType,
	url string,
	connChan chan<- net.Conn,
	listeningChann chan<- bool,
)

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

func NewWsConnAdapter

func NewWsConnAdapter(conn *websocket.Conn) *Adapter

func (*Adapter) Close

func (a *Adapter) Close() error

func (*Adapter) LocalAddr

func (a *Adapter) LocalAddr() net.Addr

func (*Adapter) Read

func (a *Adapter) Read(b []byte) (int, error)

func (*Adapter) RemoteAddr

func (a *Adapter) RemoteAddr() net.Addr

func (*Adapter) SetDeadline

func (a *Adapter) SetDeadline(t time.Time) error

func (*Adapter) SetReadDeadline

func (a *Adapter) SetReadDeadline(t time.Time) error

func (*Adapter) SetWriteDeadline

func (a *Adapter) SetWriteDeadline(t time.Time) error

func (*Adapter) Write

func (a *Adapter) Write(b []byte) (int, error)

type ConnType

type ConnType string
const (
	ConnStdio ConnType = "stdio"
	ConnWs    ConnType = "ws"
	ConnTCP   ConnType = "tcp"
)

type Stdio

type Stdio struct {
	// contains filtered or unexported fields
}

func NewDefaultStdio

func NewDefaultStdio() *Stdio

func NewStdio

func NewStdio(in io.ReadCloser, out io.WriteCloser) *Stdio

func (*Stdio) Close

func (s *Stdio) Close() error

Close implements io.Closer interface.

func (Stdio) LocalAddr

func (s Stdio) LocalAddr() net.Addr

LocalAddr implements net.Conn interface.

func (Stdio) Network

func (Stdio) Network() string

Network implements net.Addr interface.

func (*Stdio) Read

func (s *Stdio) Read(b []byte) (int, error)

Read implements io.Reader interface.

func (Stdio) RemoteAddr

func (s Stdio) RemoteAddr() net.Addr

RemoteAddr implements net.Conn interface.

func (Stdio) SetDeadline

func (Stdio) SetDeadline(t time.Time) error

SetDeadline implements net.Conn interface.

func (Stdio) SetReadDeadline

func (Stdio) SetReadDeadline(t time.Time) error

SetReadDeadline implements net.Conn interface.

func (Stdio) SetWriteDeadline

func (Stdio) SetWriteDeadline(t time.Time) error

SetWriteDeadline implements net.Conn interface.

func (Stdio) String

func (Stdio) String() string

String implements net.Addr interface.

func (*Stdio) Write

func (s *Stdio) Write(b []byte) (int, error)

Write implements io.Writer interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL