comm

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMessageTooLarge = errors.New("message too large")

ErrMessageTooLarge indicates that a framed message exceeds the allocation limit accepted by croc peers.

View Source
var HttpProxy = ""
View Source
var MAGIC_BYTES = []byte("croc")
View Source
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 New

func New(c net.Conn) *Comm

New returns a new comm

func NewConnection

func NewConnection(address string, timelimit ...time.Duration) (c *Comm, err error)

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) Close

func (c *Comm) Close()

Close closes the connection

func (*Comm) Connection

func (c *Comm) Connection() net.Conn

Connection returns the net.Conn connection

func (*Comm) Read

func (c *Comm) Read() (buf []byte, numBytes int, bs []byte, err error)

func (*Comm) Receive

func (c *Comm) Receive() (b []byte, err error)

Receive a message

func (*Comm) ReceiveInto

func (c *Comm) ReceiveInto(dst []byte) (b []byte, err error)

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

func (c *Comm) ReceiveWithDeadline(deadline time.Time) (b []byte, err error)

ReceiveWithDeadline receives one framed message without allowing any part of the read to extend beyond the supplied absolute deadline.

func (*Comm) ReceiveWithDeadlineLimit

func (c *Comm) ReceiveWithDeadlineLimit(deadline time.Time, maxSize int) (b []byte, err error)

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.

func (*Comm) Send

func (c *Comm) Send(message []byte) (err error)

Send a message

func (*Comm) Write

func (c *Comm) Write(b []byte) (n int, err error)

Jump to

Keyboard shortcuts

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