Tailscale.Udp
(Tailscale v0.3.3)
View Source
Tailscale UDP sockets.
Summary
Functions
Bind a UDP socket on the specified port.
Get the local address on which this UDP socket is bound.
Receive a packet from the socket, blocking until one is ready.
Send a packet to a specified remote address.
Types
Functions
@spec bind(Tailscale.t(), Tailscale.ip_addr() | :ip4 | :ip6, :inet.port_number()) :: {:ok, t()} | {:error, any()}
Bind a UDP socket on the specified port.
Parameters
dev: the tailscale device on which to bind a socket.addr: the address to bind to. Passing:ip4or:ip6will cause the socket to bind to thetailscale node's respective tailnet ip.port: the port number to bind.
@spec local_addr(t()) :: {:inet.ip_address(), :inet.port_number()}
Get the local address on which this UDP socket is bound.
@spec recv(t()) :: {:ok, Tailscale.ip_addr(), :inet.port_number(), binary()} | {:error, any()}
Receive a packet from the socket, blocking until one is ready.
@spec send(t(), Tailscale.ip_addr(), :inet.port_number(), binary()) :: :ok | {:error, any()}
Send a packet to a specified remote address.
Parameters
sock: the socket to send onremote: the host to deliver the packet to. DNS is not yet supported: this must be an IP address for now.port: the port on the remote host the packet should be delivered to.payload: the message payload.