Documentation
¶
Index ¶
- Variables
- type Comm
- func (c *Comm) Close()
- func (c *Comm) Connection() net.Conn
- func (c *Comm) Read() (buf []byte, numBytes int, bs []byte, err error)
- func (c *Comm) Receive() (b []byte, err error)
- func (c *Comm) ReceiveInto(dst []byte) (b []byte, err error)
- func (c *Comm) ReceiveWithDeadline(deadline time.Time) (b []byte, err error)
- func (c *Comm) ReceiveWithDeadlineLimit(deadline time.Time, maxSize int) (b []byte, err error)
- func (c *Comm) Send(message []byte) (err error)
- func (c *Comm) Write(b []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
var ErrMessageTooLarge = errors.New("message too large")
ErrMessageTooLarge indicates that a framed message exceeds the allocation limit accepted by croc peers.
var HttpProxy = ""
var MAGIC_BYTES = []byte("croc")
var Socks5Proxy = ""
Functions ¶
This section is empty.
Types ¶
type Comm ¶
type Comm struct {
// contains filtered or unexported fields
}
Comm is some basic TCP communication
func NewConnection ¶
NewConnection gets a new comm to a tcp address
func NewConnectionContext ¶
func NewConnectionContext(ctx context.Context, address string, timelimit ...time.Duration) (c *Comm, err error)
NewConnectionContext gets a new comm to a TCP address and makes direct and proxy dials return promptly when ctx is canceled.
func (*Comm) Connection ¶
Connection returns the net.Conn connection
func (*Comm) ReceiveInto ¶
ReceiveInto receives a framed message, reusing dst when it has enough capacity. Callers must finish using the returned bytes before the next call.
func (*Comm) ReceiveWithDeadline ¶
ReceiveWithDeadline receives one framed message without allowing any part of the read to extend beyond the supplied absolute deadline.
func (*Comm) ReceiveWithDeadlineLimit ¶
ReceiveWithDeadlineLimit receives one framed message without allowing any part of the read to extend beyond deadline or allocating more than maxSize bytes for the message body.