@@ -10,11 +10,11 @@ type DNSResource struct {
10
10
}
11
11
12
12
type (
13
- // SplitDnsRequest is a map from domain names to a list of nameservers.
14
- SplitDnsRequest map [string ][]string
13
+ // SplitDNSRequest is a map from domain names to a list of nameservers.
14
+ SplitDNSRequest map [string ][]string
15
15
16
- // SplitDnsResponse is a map from domain names to a list of nameservers.
17
- SplitDnsResponse SplitDnsRequest
16
+ // SplitDNSResponse is a map from domain names to a list of nameservers.
17
+ SplitDNSResponse SplitDNSRequest
18
18
19
19
DNSPreferences struct {
20
20
MagicDNS bool `json:"magicDNS"`
@@ -77,29 +77,32 @@ func (dr *DNSResource) Nameservers(ctx context.Context) ([]string, error) {
77
77
}
78
78
79
79
// UpdateSplitDNS updates the split DNS settings for a tailnet using the
80
- // provided SplitDnsRequest object. This is a PATCH operation that performs
80
+ // provided [SplitDNSRequest] object. This is a PATCH operation that performs
81
81
// partial updates of the underlying data structure.
82
82
//
83
83
// Mapping a domain to a nil slice in the request will unset the nameservers
84
84
// associated with that domain. Values provided for domains will overwrite the
85
85
// current value associated with the domain. Domains not included in the request
86
86
// will remain unchanged.
87
- func (dr * DNSResource ) UpdateSplitDNS (ctx context.Context , request SplitDnsRequest ) (* SplitDnsResponse , error ) {
87
+ func (dr * DNSResource ) UpdateSplitDNS (ctx context.Context , request SplitDNSRequest ) (SplitDNSResponse , error ) {
88
88
req , err := dr .buildRequest (ctx , http .MethodPatch , dr .buildTailnetURL ("dns" , "split-dns" ), requestBody (request ))
89
89
if err != nil {
90
90
return nil , err
91
91
}
92
92
93
- var resp SplitDnsResponse
94
- return & resp , dr .do (req , & resp )
93
+ var resp SplitDNSResponse
94
+ if err := dr .do (req , & resp ); err != nil {
95
+ return nil , err
96
+ }
97
+ return resp , nil
95
98
}
96
99
97
100
// SetSplitDNS sets the split DNS settings for a tailnet using the provided
98
- // SplitDnsRequest object. This is a PUT operation that fully replaces the underlying
101
+ // [SplitDNSRequest] object. This is a PUT operation that fully replaces the underlying
99
102
// data structure.
100
103
//
101
- // Passing in an empty SplitDnsRequest will unset all split DNS mappings for the tailnet.
102
- func (dr * DNSResource ) SetSplitDNS (ctx context.Context , request SplitDnsRequest ) error {
104
+ // Passing in an empty [SplitDNSRequest] will unset all split DNS mappings for the tailnet.
105
+ func (dr * DNSResource ) SetSplitDNS (ctx context.Context , request SplitDNSRequest ) error {
103
106
req , err := dr .buildRequest (ctx , http .MethodPut , dr .buildTailnetURL ("dns" , "split-dns" ), requestBody (request ))
104
107
if err != nil {
105
108
return err
@@ -109,14 +112,17 @@ func (dr *DNSResource) SetSplitDNS(ctx context.Context, request SplitDnsRequest)
109
112
}
110
113
111
114
// SplitDNS retrieves the split DNS configuration for a tailnet.
112
- func (dr * DNSResource ) SplitDNS (ctx context.Context ) (* SplitDnsResponse , error ) {
115
+ func (dr * DNSResource ) SplitDNS (ctx context.Context ) (SplitDNSResponse , error ) {
113
116
req , err := dr .buildRequest (ctx , http .MethodGet , dr .buildTailnetURL ("dns" , "split-dns" ))
114
117
if err != nil {
115
118
return nil , err
116
119
}
117
120
118
- var resp SplitDnsResponse
119
- return & resp , dr .do (req , & resp )
121
+ var resp SplitDNSResponse
122
+ if err := dr .do (req , & resp ); err != nil {
123
+ return nil , err
124
+ }
125
+ return resp , nil
120
126
}
121
127
122
128
// Preferences retrieves the DNS preferences that are currently set for the given tailnet. Supply the tailnet of
0 commit comments