mirror of
https://github.com/tailscale/tailscale.git
synced 2026-05-05 12:16:44 +02:00
Add an Error field to MapResponse to allow the control server to communicate errors to clients in a structured way. The error includes a machine-readable code and a human-readable message. This enables clients to programmatically handle specific error conditions. The immediate use case is returning an explicit error when a node is not found on the tailnet, so that a message can be sent on the ipn bus to inform the client. Updates #18830 Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk>
47 lines
1.9 KiB
Go
47 lines
1.9 KiB
Go
// Copyright (c) Tailscale Inc & contributors
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
// Package tsconst exports some constants used elsewhere in the
|
|
// codebase.
|
|
package tsconst
|
|
|
|
// WintunInterfaceDesc is the description attached to Tailscale
|
|
// interfaces on Windows. This is set by the WinTun driver.
|
|
const WintunInterfaceDesc = "Tailscale Tunnel"
|
|
const WintunInterfaceDesc0_14 = "Wintun Userspace Tunnel"
|
|
|
|
// TailnetLockNotTrustedMsg is the error message used by network lock
|
|
// and sniffed (via substring) out of an error sent over the network.
|
|
const TailnetLockNotTrustedMsg = "this node is not trusted by network lock"
|
|
|
|
// MapResponseErrorCode is a unique string identifier for map response errors.
|
|
type MapResponseErrorCode string
|
|
|
|
// ErrCodeNodeNotFound indicates that the requested node was not found
|
|
// in the control plane database.
|
|
const ErrCodeNodeNotFound MapResponseErrorCode = "node-not-found"
|
|
|
|
// ErrCodeInvalidRequest indicates that the client sent a malformed
|
|
// or invalid request.
|
|
const ErrCodeInvalidRequest MapResponseErrorCode = "invalid-request"
|
|
|
|
// ErrCodeInternalError indicates that an internal server error
|
|
// occurred while processing the request.
|
|
const ErrCodeInternalError MapResponseErrorCode = "internal-error"
|
|
|
|
// ErrCodeMaintenanceMode indicates that the server is currently
|
|
// in maintenance mode and cannot process requests.
|
|
const ErrCodeMaintenanceMode MapResponseErrorCode = "maintenance-mode"
|
|
|
|
// ErrCodeRequestSuperseded indicates that the request was replaced
|
|
// by a newer request from the same client before it could complete.
|
|
const ErrCodeRequestSuperseded MapResponseErrorCode = "request-superseded"
|
|
|
|
// ErrCodeUserNotFound indicates that the requested user was not found
|
|
// in the control plane database.
|
|
const ErrCodeUserNotFound MapResponseErrorCode = "user-not-found"
|
|
|
|
// ErrCodeUnauthorized indicates that the client is not authorized
|
|
// to perform the requested operation.
|
|
const ErrCodeUnauthorized MapResponseErrorCode = "unauthorized"
|