Skip to content

Commit 773ff9c

Browse files
authored
Add a link to API docs and clean up some comments (#56)
1 parent a770bcc commit 773ff9c

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
![Github Actions](https://github.com/tailscale/tailscale-client-go/actions/workflows/ci.yml/badge.svg?branch=master)
66

77

8-
A client implementation for the [Tailscale](https://tailscale.com) HTTP API
8+
A client implementation for the [Tailscale](https://tailscale.com) HTTP API.
9+
For more details, please see [API documentation](https://github.com/tailscale/tailscale/blob/main/api.md).
910

1011
# Example
1112

tailscale/client.go

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,28 @@ import (
1919
)
2020

2121
type (
22-
// The Client type is used to perform actions against the Tailscale API.
22+
// Client type is used to perform actions against the Tailscale API.
2323
Client struct {
2424
apiKey string
2525
http *http.Client
2626
baseURL *url.URL
2727
tailnet string
2828
}
2929

30-
// The APIError type describes an error as returned by the Tailscale API.
30+
// APIError type describes an error as returned by the Tailscale API.
3131
APIError struct {
3232
Message string `json:"message"`
3333
Data []APIErrorData `json:"data"`
3434
status int
3535
}
3636

37-
// The APIErrorData type describes elements of the data field within errors returned by the Tailscale API.
37+
// APIErrorData type describes elements of the data field within errors returned by the Tailscale API.
3838
APIErrorData struct {
3939
User string `json:"user"`
4040
Errors []string `json:"errors"`
4141
}
4242

43-
// The ClientOption type is a function that is used to modify a Client.
43+
// ClientOption type is a function that is used to modify a Client.
4444
ClientOption func(c *Client) error
4545
)
4646

@@ -273,6 +273,7 @@ func (c *Client) DNSNameservers(ctx context.Context) ([]string, error) {
273273
}
274274

275275
type (
276+
// ACL contains the schema for a tailnet policy file. More details: https://tailscale.com/kb/1018/acls/
276277
ACL struct {
277278
ACLs []ACLEntry `json:"acls,omitempty" hujson:"ACLs,omitempty"`
278279
AutoApprovers *ACLAutoApprovers `json:"autoapprovers,omitempty" hujson:"AutoApprovers,omitempty"`
@@ -287,7 +288,8 @@ type (
287288
OneCGNATRoute string `json:"oneCGNATRoute,omitempty" hujson:"OneCGNATRoute,omitempty"`
288289
RandomizeClientPort bool `json:"randomizeClientPort,omitempty" hujson:"RandomizeClientPort,omitempty"`
289290

290-
// As of Aug 2023 these fields are experimental and subject to change.
291+
// Postures and DefaultSourcePosture are for an experimental feature and not yet public or documented as of 2023-08-17.
292+
// This API is subject to change. Internal bug: corp/13986
291293
Postures map[string][]string `json:"postures,omitempty" hujson:"Postures,omitempty"`
292294
DefaultSourcePosture []string `json:"defaultSrcPosture,omitempty" hujson:"DefaultSrcPosture,omitempty"`
293295
}
@@ -305,7 +307,7 @@ type (
305307
Destination []string `json:"dst,omitempty" hujson:"Dst,omitempty"`
306308
Protocol string `json:"proto,omitempty" hujson:"Proto,omitempty"`
307309

308-
// Experimental.
310+
// SourcePosture is for an experimental feature and not yet public or documented as of 2023-08-17.
309311
SourcePosture []string `json:"srcPosture,omitempty" hujson:"SrcPosture,omitempty"`
310312
}
311313

@@ -588,7 +590,7 @@ func (c *Client) DeleteDevice(ctx context.Context, deviceID string) error {
588590
}
589591

590592
type (
591-
// The KeyCapabilities type describes the capabilities of an authentication key.
593+
// KeyCapabilities type describes the capabilities of an authentication key.
592594
KeyCapabilities struct {
593595
Devices struct {
594596
Create struct {
@@ -600,17 +602,17 @@ type (
600602
} `json:"devices"`
601603
}
602604

603-
// The CreateKeyRequest type describes the definition of an authentication key to create.
605+
// CreateKeyRequest type describes the definition of an authentication key to create.
604606
CreateKeyRequest struct {
605607
Capabilities KeyCapabilities `json:"capabilities"`
606608
ExpirySeconds int64 `json:"expirySeconds"`
607609
Description string `json:"description"`
608610
}
609611

610-
// The CreateKeyOption type is a function that is used to modify a CreateKeyRequest.
612+
// CreateKeyOption type is a function that is used to modify a CreateKeyRequest.
611613
CreateKeyOption func(c *CreateKeyRequest) error
612614

613-
// The Key type describes an authentication key within the tailnet.
615+
// Key type describes an authentication key within the tailnet.
614616
Key struct {
615617
ID string `json:"id"`
616618
Key string `json:"key"`
@@ -720,7 +722,7 @@ func (c *Client) SetDeviceTags(ctx context.Context, deviceID string, tags []stri
720722
}
721723

722724
type (
723-
// The DeviceKey type represents the properties of the key of an individual device within
725+
// DeviceKey type represents the properties of the key of an individual device within
724726
// the tailnet.
725727
DeviceKey struct {
726728
KeyExpiryDisabled bool `json:"keyExpiryDisabled"` // Whether or not this device's key will ever expire.
@@ -760,7 +762,7 @@ func ErrorData(err error) []APIErrorData {
760762
return nil
761763
}
762764

763-
// The Duration type wraps a time.Duration, allowing it to be JSON marshalled as a string like "20h" rather than
765+
// Duration type wraps a time.Duration, allowing it to be JSON marshalled as a string like "20h" rather than
764766
// a numeric value.
765767
type Duration time.Duration
766768

0 commit comments

Comments
 (0)