Documentation
¶
Overview ¶
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 ConnectCurrentUserContext(ctx context.Context, path string) (net.Conn, error)
- func GOOSUsesPeerCreds(goos string) bool
- func Listen(path string) (net.Listener, error)
- func ListenCurrentUser(path string) (net.Listener, error)
- func LocalTCPPortAndToken() (port int, token string, err error)
- func PlatformUsesPeerCreds() bool
Constants ¶
This section is empty.
Variables ¶
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 ¶ added in v1.68.0
ConnectContext connects to tailscaled using a unix socket or named pipe.
func ConnectCurrentUserContext ¶ added in v1.104.0
ConnectCurrentUserContext is like ConnectContext, but on Windows it fails if the named pipe's owner is not the user running this process. Only administrators may make a pipe owned by anyone but themselves, so this stops another user from standing up a pipe of the expected name and impersonating the user's own tailscaled. On other platforms it is ConnectContext.
func GOOSUsesPeerCreds ¶ added in v1.8.0
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 ListenCurrentUser ¶ added in v1.104.0
ListenCurrentUser is like Listen, but on Windows the named pipe is owned by, and accessible only to, the user running this process, so that a client can verify with ConnectCurrentUserContext that it reached a server running as itself. It is for a tailscaled run by a user for their own use (tailscaled --windows-mode=dev) rather than by the system. On other platforms it is Listen.
func LocalTCPPortAndToken ¶ added in v1.6.0
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 ¶ added in v1.6.0
func PlatformUsesPeerCreds() bool
PlatformUsesPeerCreds reports whether the current platform uses peer credentials to authenticate connections.
Types ¶
This section is empty.