Documentation
¶
Overview ¶
Package telemetry sends anonymous usage signals to TelemetryDeck (Ingest API v2): that Planck was installed and launched, and that a stream started and ended, with its codec and the kind of route it took. A signal never holds a host or device name, an address, a Tailscale identity, a window title, a pairing PIN or key, or anything of the stream itself; the payload keeps only values from the fixed lists below.
The user turns it off in Settings › General. Off stops every signal at once, including queued ones and a send in flight.
Index ¶
Constants ¶
const ( TypeInstalled = "app.installed" TypeLaunched = "app.launched" TypeSessionStarted = "session.started" TypeSessionEnded = "session.ended" )
The signal types.
const ( ChannelRelease = "release" ChannelDev = "dev" )
The build channels: an official release, or any other build.
const ( ModeClient = "client" ModeHost = "host" )
The modes: which side of a stream this process, or a session, is.
const ( TransportLAN = "lan" TransportTailscaleDirect = "tailscale_direct" TransportTailscaleRelay = "tailscale_relay" TransportUnknown = unknown )
The values of a session's transportKind.
const DefaultEndpoint = "https://nom.telemetrydeck.com/v2/"
DefaultEndpoint is TelemetryDeck's Ingest API v2.
Variables ¶
var DefaultAppID = ""
DefaultAppID is the TelemetryDeck App ID of the official app. Empty sends nothing. Release builds set it with -ldflags "-X github.com/planckdotgg/planck/internal/telemetry.DefaultAppID=<id>"; PLANCK_TELEMETRY_APP_ID overrides it.
Functions ¶
func ClientUser ¶
ClientUser is the clientUser of an install: the lowercase hex SHA-256 of its random ID. TelemetryDeck hashes it again, with a salt.
func TransportKind ¶
TransportKind is a path's name, as pkg/ratectl or pkg/discovery give it, as one of the Transport constants.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client queues signals and sends them on its own goroutine. A nil Client sends nothing.
func (*Client) Active ¶
Active is true when signals can leave: an App ID is set and the user has telemetry on.
func (*Client) Launched ¶
func (c *Client) Launched()
Launched sends app.launched, after app.installed the first time on this install. It sends once per run; while telemetry is off it waits for the next call.
func (*Client) SessionEnded ¶
SessionEnded sends session.ended.
func (*Client) SessionStarted ¶
SessionStarted sends session.started.
func (*Client) SetEnabled ¶
SetEnabled follows the user's setting. Off drops the queue and cancels a send in flight.
type Options ¶
type Options struct {
AppID string
Endpoint string
TestMode bool
// StateFile keeps the install ID and whether app.installed was sent.
StateFile string
AppVersion string
Channel string
// Mode is ModeClient or ModeHost: the program that sends.
Mode string
HTTP *http.Client
// RetryAfter is the wait after a failed send; 0 is one minute.
RetryAfter time.Duration
// Enabled, if set, reads the user's setting again before each send,
// shutdown's included; false turns the client off as SetEnabled(false).
Enabled func() bool
}
Options set up a Client.
func OptionsForThisBuild ¶
OptionsForThisBuild are the options of this build: the App ID, the endpoint, and test mode from the build, overridden by PLANCK_TELEMETRY_APP_ID, PLANCK_TELEMETRY_ENDPOINT and PLANCK_TELEMETRY_TEST_MODE=1. A build that is not official is always in test mode: the variable can only turn test mode on.
type Session ¶
type Session struct {
Mode string // ModeClient or ModeHost
Codec string // CodecName's input: "HEVC", "h264", "PyroWave"...
Transport string // TransportKind's input: "lan-direct", "tailscale-derp"...
}
Session is what session.started and session.ended tell of a stream. Unknown values are sent as "unknown", so nothing else can leave.