package safesocket
import "tailscale.com/safesocket"
Package safesocket creates either a Unix socket, if possible, or otherwise a localhost TCP connection.
Index ¶
- Variables
- func ConnCloseRead(c net.Conn) error
- func ConnCloseWrite(c net.Conn) error
- func Connect(path string) (net.Conn, error)
- func ConnectContext(ctx context.Context, path string) (net.Conn, error)
- func GOOSUsesPeerCreds(goos string) bool
- func Listen(path string) (net.Listener, error)
- func LocalTCPPortAndToken() (port int, token string, err error)
- func PlatformUsesPeerCreds() bool
Variables ¶
var ( ErrTokenNotFound = errors.New("no token found") ErrNoTokenOnOS = errors.New("no token on " + runtime.GOOS) )
Functions ¶
func ConnCloseRead ¶
ConnCloseRead calls c's CloseRead method. c is expected to be either a UnixConn or TCPConn as returned from this package.
func ConnCloseWrite ¶
ConnCloseWrite calls c's CloseWrite method. c is expected to be either a UnixConn or TCPConn as returned from this package.
func Connect ¶
Connect connects to tailscaled using a unix socket or named pipe. Deprecated: use ConnectContext instead.
func ConnectContext ¶
ConnectContext connects to tailscaled using a unix socket or named pipe.
func GOOSUsesPeerCreds ¶
GOOSUsesPeerCreds is like PlatformUsesPeerCreds but takes a runtime.GOOS value instead of using the current one.
func Listen ¶
Listen returns a listener either on Unix socket path (on Unix), or the NamedPipe path (on Windows).
func LocalTCPPortAndToken ¶
LocalTCPPortAndToken returns the port number and auth token to connect to the local Tailscale daemon. It's currently only applicable on macOS when tailscaled is being run in the Mac Sandbox from the App Store version of Tailscale.
func PlatformUsesPeerCreds ¶
func PlatformUsesPeerCreds() bool
PlatformUsesPeerCreds reports whether the current platform uses peer credentials to authenticate connections.
Source Files ¶
safesocket.go safesocket_ps.go unixsocket.go
- Version
- v1.84.1 (latest)
- Published
- May 29, 2025
- Platform
- linux/amd64
- Imports
- 12 packages
- Last checked
- 9 hours ago –
Tools for package owners.