codec

package
v0.0.0-...-09e4489 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2020 License: Apache-2.0, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CarrierConn

type CarrierConn interface {
	RemoteAddr() net.Addr
	Read() (chunk []byte, err error)
	Write(chunk []byte) (err error)
	Close() (err error)
}

type CarrierListener

type CarrierListener interface {
	Addr() net.Addr
	Accept() CarrierConn
}

type CarrierTransport

type CarrierTransport interface {
	Listen(addr net.Addr) CarrierListener
	Dial(addr net.Addr) (CarrierConn, error)
}

type ChunkCodec

type ChunkCodec struct{}

ChunkCodec

func (ChunkCodec) NewDecoder

func (ChunkCodec) NewDecoder() Decoder

func (ChunkCodec) NewEncoder

func (ChunkCodec) NewEncoder() Encoder

type ChunkDecoder

type ChunkDecoder struct{}

ChunkDecoder

func (ChunkDecoder) Decode

func (ChunkDecoder) Decode(r []byte, v interface{}) error

type ChunkEncoder

type ChunkEncoder struct{}

ChunkEncoder

func (ChunkEncoder) Encode

func (ChunkEncoder) Encode(v interface{}) ([]byte, error)

type Codec

type Codec interface {
	NewEncoder() Encoder
	NewDecoder() Decoder
}

Codec

type Conn

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

func NewConn

func NewConn(carrier CarrierConn, codec Codec) *Conn

func (*Conn) Close

func (c *Conn) Close() (err error)

func (*Conn) Read

func (c *Conn) Read(v interface{}) (err error)

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

func (*Conn) String

func (c *Conn) String() string

func (*Conn) Write

func (c *Conn) Write(v interface{}) (err error)

type Decoder

type Decoder interface {
	Decode([]byte, interface{}) error
}

Decoder

type Encoder

type Encoder interface {
	Encode(interface{}) ([]byte, error)
}

Encoder

type GobCodec

type GobCodec struct{}

GobCodec

func (GobCodec) NewDecoder

func (GobCodec) NewDecoder() Decoder

func (GobCodec) NewEncoder

func (GobCodec) NewEncoder() Encoder

type GobDecoder

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

GobDecoder

func NewGobDecoder

func NewGobDecoder() *GobDecoder

func (*GobDecoder) Decode

func (g *GobDecoder) Decode(p []byte, v interface{}) error

type GobEncoder

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

GobEncoder

func NewGobEncoder

func NewGobEncoder() *GobEncoder

func (*GobEncoder) Encode

func (g *GobEncoder) Encode(v interface{}) ([]byte, error)

type Listener

type Listener struct {
	CarrierListener
	// contains filtered or unexported fields
}

func (*Listener) Accept

func (l *Listener) Accept() *Conn

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

type Transport

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

func NewTransport

func NewTransport(sub CarrierTransport, codec Codec) *Transport

func (*Transport) Dial

func (t *Transport) Dial(addr net.Addr) (*Conn, error)

Dial returns instanteneously (it does not wait on I/O operations) and always succeeds, returning a non-nil connection object.

func (*Transport) Listen

func (t *Transport) Listen(addr net.Addr) *Listener

Jump to

Keyboard shortcuts

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