tailscale.comtailscale.com/net/udprelay Index | Files | Directories

package udprelay

import "tailscale.com/net/udprelay"

Package udprelay contains constructs for relaying Disco and WireGuard packets between Tailscale clients over UDP. This package is currently considered experimental.

Index

Variables

var ErrServerClosed = errors.New("server closed")

Types

type Server

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

Server implements an experimental UDP relay server.

func NewServer

func NewServer(port int, addrs []netip.Addr) (s *Server, boundPort int, err error)

NewServer constructs a Server listening on 0.0.0.0:'port'. IPv6 is not yet supported. Port may be 0, and what ultimately gets bound is returned as 'boundPort'. Supplied 'addrs' are joined with 'boundPort' and returned as endpoint.ServerEndpoint.AddrPorts in response to Server.AllocateEndpoint() requests.

TODO: IPv6 support TODO: dynamic addrs:port discovery

func (*Server) AllocateEndpoint

func (s *Server) AllocateEndpoint(discoA, discoB key.DiscoPublic) (endpoint.ServerEndpoint, error)

AllocateEndpoint allocates an endpoint.ServerEndpoint for the provided pair of key.DiscoPublic's. If an allocation already exists for discoA and discoB it is returned without modification/reallocation. AllocateEndpoint returns ErrServerClosed if the server has been closed.

func (*Server) Close

func (s *Server) Close() error

Close closes the server.

Source Files

server.go

Directories

PathSynopsis
net/udprelay/endpointPackage endpoint contains types relating to UDP relay server endpoints.
Version
v1.84.3 (latest)
Published
Jun 26, 2025
Platform
linux/amd64
Imports
16 packages
Last checked
3 hours ago

Tools for package owners.