ioconn
--
import "vimagination.zapto.org/ioconn"
Package ioconn allows any combination of an io.Reader, io.Writer and io.Closer
to become a net.Conn.
Usage
var (
ErrTimeout = errors.New("timeout occurred")
)
Errors.
type Addr
type Addr struct {
Net, Str string
}
Addr is a simple implementation of the net.Addr interface.
func (Addr) Network
func (a Addr) Network() string
Network returns the Net string.
func (Addr) String
func (a Addr) String() string
String returns the Str string.
type CloserFunc
type CloserFunc func() error
CloserFunc is a func that implements the io.Closer interface allowing a closure
or other function to be io.Closer.
func (CloserFunc) Close
func (c CloserFunc) Close() error
Close simply calls the CloserFunc func.
type Conn
type Conn struct {
io.Reader
io.Writer
io.Closer
Local, Remote net.Addr
ReadDeadline, WriteDeadline time.Time
}
Conn implements a net.Conn.
func (*Conn) LocalAddr
func (c *Conn) LocalAddr() net.Addr
LocalAddr returns the Local Address.
func (*Conn) Read
func (c *Conn) Read(p []byte) (int, error)
Read implements the io.Reader interface.
func (*Conn) RemoteAddr
func (c *Conn) RemoteAddr() net.Addr
RemoteAddr returns the Remote Address.
func (*Conn) SetDeadline
func (c *Conn) SetDeadline(t time.Time) error
SetDeadline implements the Conn SetDeadline method.
func (*Conn) SetReadDeadline
func (c *Conn) SetReadDeadline(t time.Time) error
SetReadDeadline implements the Conn SetReadDeadline method.
func (*Conn) SetWriteDeadline
func (c *Conn) SetWriteDeadline(t time.Time) error
SetWriteDeadline implements the Conn SetWriteDeadline method.
func (*Conn) Write
func (c *Conn) Write(p []byte) (int, error)
Write implements the io.Writer interface.
type FileAddr
type FileAddr string
FileAddr is a net.Addr that represents a file. Should be a full path.
func (FileAddr) Network
func (f FileAddr) Network() string
Network always returns "file".
func (FileAddr) String
func (f FileAddr) String() string
String returns file://path.