Skip to content

Commit

Permalink
client/tailscale: add Auto Approvers Field to ACLDetails
Browse files Browse the repository at this point in the history
Fixes tailscale#12011

Signed-off-by: Cagatay Gürtürk <963018+cagataygurturk@users.noreply.github.com>
  • Loading branch information
cagataygurturk committed May 5, 2024
1 parent ed843e6 commit 69655a2
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions client/tailscale/acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,22 @@ type ACLTest struct {
User string `json:"user,omitempty"` // old name for source
Accept []string `json:"accept,omitempty"` // expected destination ip:port that user can access
Deny []string `json:"deny,omitempty"` // expected destination ip:port that user cannot access
Allow []string `json:"allow,omitempty"` // old name for accept
}

Allow []string `json:"allow,omitempty"` // old name for accept
type ACLAutoApprovers struct {
Routes map[string][]string `json:"routes,omitempty"`
ExitNode []string `json:"exitnode,omitempty"`
}

// ACLDetails contains all the details for an ACL.
type ACLDetails struct {
Tests []ACLTest `json:"tests,omitempty"`
ACLs []ACLRow `json:"acls,omitempty"`
Groups map[string][]string `json:"groups,omitempty"`
TagOwners map[string][]string `json:"tagowners,omitempty"`
Hosts map[string]string `json:"hosts,omitempty"`
Tests []ACLTest `json:"tests,omitempty"`
ACLs []ACLRow `json:"acls,omitempty"`
Groups map[string][]string `json:"groups,omitempty"`
TagOwners map[string][]string `json:"tagowners,omitempty"`
Hosts map[string]string `json:"hosts,omitempty"`
AutoApprovers ACLAutoApprovers `json:"autoapprovers,omitempty"`
}

// ACL contains an ACLDetails and metadata.
Expand Down Expand Up @@ -87,6 +92,7 @@ func (c *Client) ACL(ctx context.Context) (acl *ACL, err error) {
return nil, handleErrorResponse(b, resp)
}

fmt.Println(string(b))
// Otherwise, try to decode the response.
var aclDetails ACLDetails
if err = json.Unmarshal(b, &aclDetails); err != nil {
Expand Down

0 comments on commit 69655a2

Please sign in to comment.