Tailscale.Tcp.Stream (Tailscale v0.3.3)

View Source

Tailscale TCP sockets (connected).

Summary

Types

t()

A handle to a TCP stream (connected socket).

Functions

Get the local address on which this TCP stream is bound.

Receive data from the TCP socket, blocking until at least one byte can be received.

Get the remote address to which this TCP stream is connected.

Send data over the TCP socket, blocking until at least one byte can be sent.

Send the payload over the TCP socket, blocking until it is fully sent.

Types

t()

@opaque t()

A handle to a TCP stream (connected socket).

Functions

local_addr(stream)

@spec local_addr(t()) :: {:inet.ip_address(), :inet.port_number()}

Get the local address on which this TCP stream is bound.

recv(res)

@spec recv(t()) :: {:ok, binary()} | {:error, any()}

Receive data from the TCP socket, blocking until at least one byte can be received.

remote_addr(stream)

@spec remote_addr(t()) :: {:inet.ip_address(), :inet.port_number()}

Get the remote address to which this TCP stream is connected.

send(res, msg)

@spec send(t(), binary()) :: {:ok, integer()} | {:error, any()}

Send data over the TCP socket, blocking until at least one byte can be sent.

Returns the number of bytes actually sent.

send_all(res, msg)

@spec send_all(t(), binary()) :: :ok | {:error, any()}

Send the payload over the TCP socket, blocking until it is fully sent.