Files
tailscale/tailcfg/c2ntypes.go
Will Norris 3ec5be3f51 all: remove AUTHORS file and references to it
This file was never truly necessary and has never actually been used in
the history of Tailscale's open source releases.

A Brief History of AUTHORS files
---

The AUTHORS file was a pattern developed at Google, originally for
Chromium, then adopted by Go and a bunch of other projects. The problem
was that Chromium originally had a copyright line only recognizing
Google as the copyright holder. Because Google (and most open source
projects) do not require copyright assignemnt for contributions, each
contributor maintains their copyright. Some large corporate contributors
then tried to add their own name to the copyright line in the LICENSE
file or in file headers. This quickly becomes unwieldy, and puts a
tremendous burden on anyone building on top of Chromium, since the
license requires that they keep all copyright lines intact.

The compromise was to create an AUTHORS file that would list all of the
copyright holders. The LICENSE file and source file headers would then
include that list by reference, listing the copyright holder as "The
Chromium Authors".

This also become cumbersome to simply keep the file up to date with a
high rate of new contributors. Plus it's not always obvious who the
copyright holder is. Sometimes it is the individual making the
contribution, but many times it may be their employer. There is no way
for the proejct maintainer to know.

Eventually, Google changed their policy to no longer recommend trying to
keep the AUTHORS file up to date proactively, and instead to only add to
it when requested: https://opensource.google/docs/releasing/authors.
They are also clear that:

> Adding contributors to the AUTHORS file is entirely within the
> project's discretion and has no implications for copyright ownership.

It was primarily added to appease a small number of large contributors
that insisted that they be recognized as copyright holders (which was
entirely their right to do). But it's not truly necessary, and not even
the most accurate way of identifying contributors and/or copyright
holders.

In practice, we've never added anyone to our AUTHORS file. It only lists
Tailscale, so it's not really serving any purpose. It also causes
confusion because Tailscalars put the "Tailscale Inc & AUTHORS" header
in other open source repos which don't actually have an AUTHORS file, so
it's ambiguous what that means.

Instead, we just acknowledge that the contributors to Tailscale (whoever
they are) are copyright holders for their individual contributions. We
also have the benefit of using the DCO (developercertificate.org) which
provides some additional certification of their right to make the
contribution.

The source file changes were purely mechanical with:

    git ls-files | xargs sed -i -e 's/\(Tailscale Inc &\) AUTHORS/\1 contributors/g'

Updates #cleanup

Change-Id: Ia101a4a3005adb9118051b3416f5a64a4a45987d
Signed-off-by: Will Norris <will@tailscale.com>
2026-01-23 15:49:45 -08:00

149 lines
5.6 KiB
Go

// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause
// c2n (control-to-node) API types.
package tailcfg
import (
"encoding/json"
"net/netip"
)
// C2NSSHUsernamesRequest is the request for the /ssh/usernames.
// A GET request without a request body is equivalent to the zero value of this type.
// Otherwise, a POST request with a JSON-encoded request body is expected.
type C2NSSHUsernamesRequest struct {
// Exclude optionally specifies usernames to exclude
// from the response.
Exclude map[string]bool `json:",omitempty"`
// Max is the maximum number of usernames to return.
// If zero, a default limit is used.
Max int `json:",omitempty"`
}
// C2NSSHUsernamesResponse is the response (from node to control) from the
// /ssh/usernames handler.
//
// It returns username auto-complete suggestions for a user to SSH to this node.
// It's only shown to people who already have SSH access to the node. If this
// returns multiple usernames, only the usernames that would have access per the
// tailnet's ACLs are shown to the user so as to not leak the existence of
// usernames.
type C2NSSHUsernamesResponse struct {
// Usernames is the list of usernames to suggest. If the machine has many
// users, this list may be truncated. If getting the list of usernames might
// be too slow or unavailable, this list might be empty. This is effectively
// just a best effort set of hints.
Usernames []string
}
// C2NUpdateResponse is the response (from node to control) from the /update
// handler. It tells control the status of its request for the node to update
// its Tailscale installation.
type C2NUpdateResponse struct {
// Err is the error message, if any.
Err string `json:",omitempty"`
// Enabled indicates whether the user has opted in to updates triggered from
// control.
Enabled bool
// Supported indicates whether remote updates are supported on this
// OS/platform.
Supported bool
// Started indicates whether the update has started.
Started bool
}
// C2NPostureIdentityResponse contains either a set of identifying serial
// numbers and hardware addresses from the client, or a boolean flag
// indicating that the machine has opted out of posture collection.
type C2NPostureIdentityResponse struct {
// SerialNumbers is a list of serial numbers of the client machine.
SerialNumbers []string `json:",omitempty"`
// IfaceHardwareAddrs is a list of hardware addresses (MAC addresses)
// of the client machine's network interfaces.
IfaceHardwareAddrs []string `json:",omitempty"`
// PostureDisabled indicates if the machine has opted out of
// device posture collection.
PostureDisabled bool `json:",omitempty"`
}
// C2NAppConnectorDomainRoutesResponse contains a map of domains to
// slice of addresses, indicating what IP addresses have been resolved
// for each domain.
type C2NAppConnectorDomainRoutesResponse struct {
// Domains is a map of lower case domain names with no trailing dot,
// to a list of resolved IP addresses.
Domains map[string][]netip.Addr
}
// C2NTLSCertInfo describes the state of a cached TLS certificate.
type C2NTLSCertInfo struct {
// Valid means that the node has a cached and valid (not expired)
// certificate.
Valid bool `json:",omitempty"`
// Error is the error string if the certificate is not valid. If error is
// non-empty, the other booleans below might say why.
Error string `json:",omitempty"`
// Missing is whether the error string indicates a missing certificate
// that's never been fetched or isn't on disk.
Missing bool `json:",omitempty"`
// Expired is whether the error string indicates an expired certificate.
Expired bool `json:",omitempty"`
NotBefore string `json:",omitempty"` // RFC3339, if Valid
NotAfter string `json:",omitempty"` // RFC3339, if Valid
// TODO(bradfitz): add fields for whether an ACME fetch is currently in
// process and when it started, etc.
}
// C2NVIPServicesResponse is the response (from node to control) from the
// /vip-services handler.
//
// It returns the list of VIPServices that the node is currently serving with
// their port info and whether they are active or not. It also returns a hash of
// the response to allow the control server to detect changes.
type C2NVIPServicesResponse struct {
// VIPServices is the list of VIP services that the node is currently serving.
VIPServices []*VIPService `json:",omitempty"`
// ServicesHash is the hash of VIPServices to allow the control server to detect
// changes. This value matches what is reported in latest [Hostinfo.ServicesHash].
ServicesHash string
}
// C2NDebugNetmapRequest is the request (from control to node) for the
// /debug/netmap handler.
type C2NDebugNetmapRequest struct {
// Candidate is an optional full MapResponse to be used for generating a candidate
// network map. If unset, only the current network map is returned.
Candidate *MapResponse `json:"candidate,omitzero"`
// OmitFields is an optional list of netmap fields to omit from the response.
// If unset, no fields are omitted.
OmitFields []string `json:"omitFields,omitzero"`
}
// C2NDebugNetmapResponse is the response (from node to control) from the
// /debug/netmap handler. It contains the current network map and, if a
// candidate full MapResponse was provided in the request, a candidate network
// map generated from it.
// To avoid import cycles, and reflect the non-stable nature of
// netmap.NetworkMap values, they are returned as json.RawMessage.
type C2NDebugNetmapResponse struct {
// Current is the current network map (netmap.NetworkMap).
Current json.RawMessage `json:"current"`
// Candidate is a network map produced based on the candidate MapResponse.
Candidate json.RawMessage `json:"candidate,omitzero"`
}