Files
tailscale/wgengine
Brad Fitzpatrick adc961352c disco, wgengine/magicsock: add custom disco message support
Add an experimental mechanism for registering custom disco message types
on a magicsock.Conn. Message types 0x80 and above are reserved for
external use; types below 0x80 are reserved for the Tailscale protocol.

disco package:
- Add MinCustomMessageType (0x80) constant
- Add ParseHookFunc type and ParseWithHook function

magicsock package:
- Add CustomDiscoMessage struct defining a custom message type
  (parser, handler, and whether to accept unknown peers)
- Conn.AddCustomDiscoMessage registers a type (panics on reserved
  range or duplicate registration)
- Conn.SendCustomDiscoOverDERP sends a custom message via DERP
  (rejects unregistered types)

The feature is gated behind the "customdisco" feature tag
(ts_omit_customdisco build tag) for dead code elimination.

As of 2026-03-10 this is not yet a guaranteed stable API.

Updates tailscale/corp#24454

Change-Id: I33b385f94ef63de9d359b9820203b2a7162dc609
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2026-03-10 20:35:27 -07:00
..