ipn: add Notify.LocalTCPPort field for macOS Network Extension to use

We want the macOS Network Extension to share fate with the UI frontend,
so we need the backend to know when the frontend disappears.

One easy way to do that is to reuse the existing TCP server it's
already running (for tailscale status clietns).

We now tell the frontend our ephemeral TCP port number, and then have
the UI connect to it, so the backend can know when it disappears.

There are likely Swift ways of doing this, but I couldn't find them
quickly enough, so I reached for the hammer I knew.
This commit is contained in:
Brad Fitzpatrick 2020-07-09 09:08:54 -07:00
parent 248d28671b
commit 96d806789f

View File

@ -58,6 +58,12 @@ type Notify struct {
BrowseToURL *string // UI should open a browser right now
BackendLogID *string // public logtail id used by backend
// LocalTCPPort, if non-nil, informs the UI frontend which
// (non-zero) localhost TCP port it's listening on.
// This is currently only used by Tailscale when run in the
// macOS Network Extension.
LocalTCPPort *uint16 `json:",omitempty"`
// type is mirrored in xcode/Shared/IPN.swift
}