tailcfg: add Node.Sharer field
Updates #992 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>pull/957/head
parent
d8a5b3f22f
commit
560da4884f
|
@ -147,9 +147,17 @@ type UserProfile struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Node struct {
|
type Node struct {
|
||||||
ID NodeID
|
ID NodeID
|
||||||
Name string // DNS
|
Name string // DNS
|
||||||
User UserID
|
|
||||||
|
// User is the user who created the node. If ACL tags are in
|
||||||
|
// use for the node then it doesn't reflect the ACL identity
|
||||||
|
// that the node is running as.
|
||||||
|
User UserID
|
||||||
|
|
||||||
|
// Sharer, if non-zero, is the user who shared this node, if different than User.
|
||||||
|
Sharer UserID `json:",omitempty"`
|
||||||
|
|
||||||
Key NodeKey
|
Key NodeKey
|
||||||
KeyExpiry time.Time
|
KeyExpiry time.Time
|
||||||
Machine MachineKey
|
Machine MachineKey
|
||||||
|
@ -769,6 +777,7 @@ func (n *Node) Equal(n2 *Node) bool {
|
||||||
n.ID == n2.ID &&
|
n.ID == n2.ID &&
|
||||||
n.Name == n2.Name &&
|
n.Name == n2.Name &&
|
||||||
n.User == n2.User &&
|
n.User == n2.User &&
|
||||||
|
n.Sharer == n2.Sharer &&
|
||||||
n.Key == n2.Key &&
|
n.Key == n2.Key &&
|
||||||
n.KeyExpiry.Equal(n2.KeyExpiry) &&
|
n.KeyExpiry.Equal(n2.KeyExpiry) &&
|
||||||
n.Machine == n2.Machine &&
|
n.Machine == n2.Machine &&
|
||||||
|
|
|
@ -64,6 +64,7 @@ var _NodeNeedsRegeneration = Node(struct {
|
||||||
ID NodeID
|
ID NodeID
|
||||||
Name string
|
Name string
|
||||||
User UserID
|
User UserID
|
||||||
|
Sharer UserID
|
||||||
Key NodeKey
|
Key NodeKey
|
||||||
KeyExpiry time.Time
|
KeyExpiry time.Time
|
||||||
Machine MachineKey
|
Machine MachineKey
|
||||||
|
|
|
@ -188,7 +188,12 @@ func TestHostinfoEqual(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNodeEqual(t *testing.T) {
|
func TestNodeEqual(t *testing.T) {
|
||||||
nodeHandles := []string{"ID", "Name", "User", "Key", "KeyExpiry", "Machine", "DiscoKey", "Addresses", "AllowedIPs", "Endpoints", "DERP", "Hostinfo", "Created", "LastSeen", "KeepAlive", "MachineAuthorized"}
|
nodeHandles := []string{
|
||||||
|
"ID", "Name", "User", "Sharer",
|
||||||
|
"Key", "KeyExpiry", "Machine", "DiscoKey",
|
||||||
|
"Addresses", "AllowedIPs", "Endpoints", "DERP", "Hostinfo",
|
||||||
|
"Created", "LastSeen", "KeepAlive", "MachineAuthorized",
|
||||||
|
}
|
||||||
if have := fieldsOf(reflect.TypeOf(Node{})); !reflect.DeepEqual(have, nodeHandles) {
|
if have := fieldsOf(reflect.TypeOf(Node{})); !reflect.DeepEqual(have, nodeHandles) {
|
||||||
t.Errorf("Node.Equal check might be out of sync\nfields: %q\nhandled: %q\n",
|
t.Errorf("Node.Equal check might be out of sync\nfields: %q\nhandled: %q\n",
|
||||||
have, nodeHandles)
|
have, nodeHandles)
|
||||||
|
|
Loading…
Reference in New Issue