Document every exported symbol and how callers use the library.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -14,33 +14,38 @@ type Action int
|
||||
const (
|
||||
// ActionAdd inserts a record.
|
||||
ActionAdd Action = iota
|
||||
// ActionDelete removes a matching RR (name, type, and rdata).
|
||||
// ActionDelete removes one record that matches owner, type, and rdata.
|
||||
ActionDelete
|
||||
)
|
||||
|
||||
// Change is a typed add or delete of one record.
|
||||
// Change is one add or delete of one record inside an Update batch.
|
||||
type Change struct {
|
||||
Action Action
|
||||
Record Record
|
||||
}
|
||||
|
||||
// Add builds an insert change.
|
||||
// Add builds an insert change for rec.
|
||||
func Add(rec Record) Change {
|
||||
return Change{Action: ActionAdd, Record: rec}
|
||||
}
|
||||
|
||||
// Delete builds a delete-by-rr change (name, type, and rdata).
|
||||
// Delete builds a delete of one matching record (owner, type, and rdata).
|
||||
func Delete(rec Record) Change {
|
||||
return Change{Action: ActionDelete, Record: rec}
|
||||
}
|
||||
|
||||
// UpdateResult is the nameserver's response to an UPDATE.
|
||||
// UpdateResult is a successful UPDATE response.
|
||||
// Rcode is the nameserver rcode text, which is NOERROR on success.
|
||||
type UpdateResult struct {
|
||||
Rcode string
|
||||
}
|
||||
|
||||
// Update applies RFC 2136 changes. It tries UDP first and retries on TCP when
|
||||
// the UDP exchange fails or the response is truncated.
|
||||
// Update sends an RFC 2136 UPDATE for changes, signed with the session TSIG key.
|
||||
// It tries UDP, then TCP when the UDP exchange fails or the response is truncated.
|
||||
// No changes returns success and does not contact the nameserver.
|
||||
// It returns an error when ctx is done, a record cannot be encoded, the
|
||||
// exchange fails, the nameserver rcode is not NOERROR, or Action is neither
|
||||
// ActionAdd nor ActionDelete.
|
||||
func (c *Client) Update(ctx context.Context, changes ...Change) (*UpdateResult, error) {
|
||||
if err := ctx.Err(); err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user