summaryrefslogtreecommitdiffhomepage
path: root/ipn/ipnlocal/netmapcache/types.go
blob: c9f9efc1e3b210ebac09581ac0a6aed46ed5b095 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause

package netmapcache

import (
	"tailscale.com/tailcfg"
	"tailscale.com/tka"
	"tailscale.com/types/key"
	"tailscale.com/types/views"
)

// The fields in the following wrapper types are all pointers, even when their
// target type is also a pointer, so that they can be used to unmarshal
// directly into the fields of another value.  These wrappers intentionally do
// not omit zero or empty values, since we want the cache to reflect the value
// the object had at the time it was written, even if the default changes
// later.
//
// Moreover, these are all struct types so that each cached record will be a
// JSON object even if the underlying value marshals to an array or primitive
// type, and so that we have a seam if we want to replace or version the cached
// representation separately from the default JSON layout.

type netmapMisc struct {
	MachineKey       *key.MachinePublic
	CollectServices  *bool
	DisplayMessages  *map[tailcfg.DisplayMessageID]tailcfg.DisplayMessage
	TKAEnabled       *bool
	TKAHead          *tka.AUMHash
	Domain           *string
	DomainAuditLogID *string
}

type netmapSSH struct {
	SSHPolicy **tailcfg.SSHPolicy
}

type netmapDNS struct {
	DNS *tailcfg.DNSConfig
}

type netmapDERPMap struct {
	DERPMap **tailcfg.DERPMap
}

type netmapNode struct {
	Node *tailcfg.NodeView
}

type netmapUserProfile struct {
	UserProfile *tailcfg.UserProfileView
}

type netmapPacketFilter struct {
	Rules *views.Slice[tailcfg.FilterRule]

	// Match expressions are derived from the rules.
}