Documentation ¶
Index ¶
- Constants
- Variables
- type Address
- type Client
- func (client *Client) Add(zoneName string, request *Request) (*Response, error)
- func (client *Client) AddA(zoneName string, names []string, target string, ttl string) (*Response, error)
- func (client *Client) AddAAAA(zoneName string, names []string, target string, ttl string) (*Response, error)
- func (client *Client) AddCnames(zoneName string, names []string, target string, ttl string) (*Response, error)
- func (client *Client) AddMx(zoneName string, names []string, target string, preference string, ttl string) (*Response, error)
- func (client *Client) AddTxt(zoneName string, names []string, target string, ttl string) (*Response, error)
- func (client *Client) CommitZone(zoneName string) (*Response, error)
- func (client *Client) DeleteRecord(zoneName string, id int) (*Response, error)
- func (client *Client) Do(r *http.Request) (*http.Response, error)
- func (client *Client) DownloadZone(zoneName string) (string, error)
- func (client *Client) GetAAAARecords(zoneName string, nameFilter string, targetFilter string) ([]*RR, error)
- func (client *Client) GetARecords(zoneName string, nameFilter string, targetFilter string) ([]*RR, error)
- func (client *Client) GetCnameRecords(zoneName string, nameFilter string, targetFilter string) ([]*RR, error)
- func (client *Client) GetMxRecords(zoneName string, nameFilter string, targetFilter string) ([]*RR, error)
- func (client *Client) GetOauth2Client() (*http.Client, error)
- func (client *Client) GetRecords(zoneName string) ([]*RR, error)
- func (client *Client) GetServices() ([]*Service, error)
- func (client *Client) GetTxtRecords(zoneName string, nameFilter string, targetFilter string) ([]*RR, error)
- func (client *Client) RollbackZone(zoneName string) (*Response, error)
- type Cname
- type Data
- type Dname
- type Error
- type Exchange
- type Hinfo
- type IClient
- type MboxDname
- type Mname
- type Mx
- type Naptr
- type Ns
- type Provider
- func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- func (p *Provider) GetRecords(ctx context.Context, zone string) ([]libdns.Record, error)
- func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- type Ptr
- type RR
- type Replacement
- type Request
- type Response
- type Revision
- type Rname
- type Rp
- type RrList
- type Service
- type Soa
- type Srv
- type Target
- type Txt
- type TxtDname
- type Zone
Constants ¶
View Source
const ( BaseURL = `https://api.nic.ru` TokenURL = BaseURL + `/oauth/token` GetRecordsUrlPattern = BaseURL + `/dns-master/services/%s/zones/%s/records` DeleteRecordsUrlPattern = BaseURL + `/dns-master/services/%s/zones/%s/records/%d` AddRecordsUrlPattern = BaseURL + `/dns-master/services/%s/zones/%s/records` GetServicesUrl = BaseURL + `/dns-master/services` CommitUrlPattern = BaseURL + `/dns-master/services/%s/zones/%s/commit` RollbackUrlPattern = BaseURL + `/dns-master/services/%s/zones/%s/rollback` DownloadZoneUrlPattern = BaseURL + `/dns-master/services/%s/zones/%s` SuccessStatus = `success` OAuth2Scope = `.+:/dns-master/.+` )
Variables ¶
View Source
var ( XmlDecodeError = errors.New(`xml decode error`) XmlEncodeError = errors.New(`xml encode error`) JsonDecodeError = errors.New(`json decode error`) JsonEncodeError = errors.New(`json encode error`) CreateFileError = errors.New(`create file error`) ReadFileError = errors.New(`read file error`) ApiNonSuccessError = errors.New(`api non-success error`) RequestError = errors.New(`request error`) ResponseError = errors.New(`response error`) InvalidStatusCode = errors.New(`invalid status code`) BufferReadError = errors.New(`buffer read error`) Oauth2ClientError = errors.New(`oauth2 client error`) NameFilterError = errors.New(`name filter error`) TargetFilterError = errors.New(`target filter error`) UpdateTokenCacheFileError = errors.New(`update token cache file error`) AuthorizationError = errors.New(`authorization error`) NotImplementedRecordType = errors.New(`not implemented record type`) )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) DeleteRecord ¶
func (*Client) GetAAAARecords ¶
func (*Client) GetARecords ¶
func (*Client) GetCnameRecords ¶
func (*Client) GetMxRecords ¶
func (*Client) GetServices ¶
func (*Client) GetTxtRecords ¶
type Data ¶
type Data struct { Text string `xml:",chardata" json:"text,omitempty"` Service []*Service `xml:"service" json:"service,omitempty"` Zone []*Zone `xml:"zone" json:"zone,omitempty"` Address []*Address `xml:"address" json:"address,omitempty"` Revision []*Revision `xml:"revision" json:"revision,omitempty"` }
type IClient ¶
type IClient interface { AddA(zoneName string, names []string, target string, ttl string) (*Response, error) AddAAAA(zoneName string, names []string, target string, ttl string) (*Response, error) AddCnames(zoneName string, names []string, target string, ttl string) (*Response, error) AddMx(zoneName string, names []string, target string, preference string, ttl string) (*Response, error) AddTxt(zoneName string, names []string, target string, ttl string) (*Response, error) CommitZone(zoneName string) (*Response, error) DeleteRecord(zoneName string, id int) (*Response, error) DownloadZone(zoneName string) (string, error) GetRecords(zoneName string) ([]*RR, error) GetARecords(zoneName string, nameFilter string, targetFilter string) ([]*RR, error) GetAAAARecords(zoneName string, nameFilter string, targetFilter string) ([]*RR, error) GetCnameRecords(zoneName string, nameFilter string, targetFilter string) ([]*RR, error) GetMxRecords(zoneName string, nameFilter string, targetFilter string) ([]*RR, error) GetTxtRecords(zoneName string, nameFilter string, targetFilter string) ([]*RR, error) RollbackZone(zoneName string) (*Response, error) GetServices() ([]*Service, error) }
type Naptr ¶
type Naptr struct { Text string `xml:",chardata" json:"text,omitempty"` Order string `xml:"order" json:"order,omitempty"` Preference string `xml:"preference" json:"preference,omitempty"` Flags string `xml:"flags" json:"flags,omitempty"` Service string `xml:"service" json:"service,omitempty"` Regexp string `xml:"regexp" json:"regexp,omitempty"` Replacement *Replacement `xml:"replacement" json:"replacement,omitempty"` }
type Provider ¶
type Provider struct { OAuth2ClientID string `json:"oauth2_client_id"` OAuth2SecretID string `json:"oauth2_secret_id"` Username string `json:"username"` Password string `json:"password"` DnsServiceName string `json:"dns_service_name"` CachePath string `json:"cache_path"` }
Provider facilitates DNS record manipulation with NIC.ru.
func (*Provider) AppendRecords ¶
func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
AppendRecords adds records to the zone. It returns the records that were added.
func (*Provider) DeleteRecords ¶
func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
DeleteRecords deletes the records from the zone. It returns the records that were deleted.
func (*Provider) GetRecords ¶
GetRecords lists all the records in the zone.
type RR ¶
type RR struct { Text string `xml:",chardata" json:"text,omitempty"` ID string `xml:"id,attr,omitempty" json:"id,omitempty"` Name string `xml:"name" json:"name,omitempty"` IdnName string `xml:"idn-name,omitempty" json:"idn_name,omitempty"` Ttl string `xml:"ttl" json:"ttl,omitempty"` Type string `xml:"type" json:"type,omitempty"` Soa *Soa `xml:"soa" xml:"soa,omitempty"` A *Address `xml:"a" json:"a,omitempty"` AAAA *Address `xml:"aaaa" json:"aaaa,omitempty"` Cname *Cname `xml:"cname" json:"cname,omitempty"` Ns *Ns `xml:"ns" json:"ns,omitempty"` Mx *Mx `xml:"mx" json:"mx,omitempty"` Srv *Srv `xml:"srv" json:"srv,omitempty"` Ptr *Ptr `xml:"ptr" json:"ptr,omitempty"` Txt *Txt `xml:"txt" json:"txt,omitempty"` Dname *Dname `xml:"dname" json:"dname,omitempty"` Hinfo *Hinfo `xml:"hinfo" json:"hinfo,omitempty"` Naptr *Naptr `xml:"naptr" json:"naptr,omitempty"` Rp *Rp `xml:"rp" json:"rp,omitempty"` }
type Replacement ¶
type Response ¶
type Response struct { XMLName xml.Name `xml:"response" json:"xml_name,omitempty"` Text string `xml:",chardata" json:"text,omitempty"` Status string `xml:"status" json:"status,omitempty"` Errors struct { Text string `xml:",chardata" json:"text,omitempty"` Error Error `xml:"error" json:"error,omitempty"` } `xml:"errors" json:"errors,omitempty"` Data *Data `xml:"data" json:"data,omitempty"` }
type Service ¶
type Service struct { Text string `xml:",chardata" json:"text,omitempty"` Admin string `xml:"admin,attr" json:"admin,omitempty"` DomainsLimit string `xml:"domains-limit,attr" json:"domains_limit,omitempty"` DomainsNum string `xml:"domains-num,attr" json:"domains_num,omitempty"` Enable string `xml:"enable,attr" json:"enable,omitempty"` HasPrimary string `xml:"has-primary,attr" json:"has_primary,omitempty"` Name string `xml:"name,attr" json:"name,omitempty"` Payer string `xml:"payer,attr" json:"payer,omitempty"` Tariff string `xml:"tariff,attr" json:"tariff,omitempty"` RrLimit string `xml:"rr-limit,attr" json:"rr_limit,omitempty"` RrNum string `xml:"rr-num,attr" json:"rr_num,omitempty"` }
type Soa ¶
type Soa struct { Text string `xml:",chardata" json:"text,omitempty"` Mname *Mname `xml:"mname" json:"mname,omitempty"` Rname *Rname `xml:"rname" json:"rname,omitempty"` Serial string `xml:"serial" json:"serial,omitempty"` Refresh string `xml:"refresh" json:"refresh,omitempty"` Retry string `xml:"retry" json:"retry,omitempty"` Expire string `xml:"expire" json:"expire,omitempty"` Minimum string `xml:"minimum" json:"minimum,omitempty"` }
type Zone ¶
type Zone struct { Text string `xml:",chardata" json:"text,omitempty"` Admin string `xml:"admin,attr" json:"admin,omitempty"` Enable string `xml:"enable,attr" json:"enable,omitempty"` HasChanges string `xml:"has-changes,attr" json:"has_changes,omitempty"` HasPrimary string `xml:"has-primary,attr" json:"has_primary,omitempty"` ID string `xml:"id,attr" json:"id,omitempty"` IdnName string `xml:"idn-name,attr" json:"idn_name,omitempty"` Name string `xml:"name,attr" json:"name,omitempty"` Payer string `xml:"payer,attr" json:"payer,omitempty"` Service string `xml:"service,attr" json:"service,omitempty"` Rr []*RR `xml:"rr" json:"rr,omitempty"` }
Source Files ¶
- add-a.go
- add-aaaa.go
- add-cnames.go
- add-mx.go
- add-records.go
- add-txt.go
- client.go
- commit.go
- constants.go
- delete-records.go
- download-zone.go
- errors.go
- get-a-records.go
- get-aaaa-records.go
- get-cname-records.go
- get-mx-records.go
- get-records.go
- get-txt-records.go
- models.go
- oauth2.go
- provider.go
- rollback.go
- services.go
Click to show internal directories.
Click to hide internal directories.