Documentation ¶
Index ¶
- type CNAMERecord
- type CNAMERecordList
- type CNAMERecordsListResponse
- type Client
- func (c Client) CreateDNSRecord(ctx context.Context, record *DNSRecord) (*DNSRecord, error)
- func (c Client) DeleteDNSRecord(ctx context.Context, domain string) error
- func (c Client) GetAdBlockerStatus(ctx context.Context) (*EnableAdBlock, error)
- func (c Client) GetDNSRecord(ctx context.Context, domain string) (*DNSRecord, error)
- func (c *Client) Init(ctx context.Context) error
- func (c Client) ListCNAMERecords(ctx context.Context) (CNAMERecordList, error)
- func (c Client) ListDNSRecords(ctx context.Context) (DNSRecordList, error)
- func (c *Client) Request(ctx context.Context, method string, path string, data *url.Values) (*http.Request, error)
- func (c Client) RequestWithAuth(ctx context.Context, method string, path string, data *url.Values) (*http.Request, error)
- func (c Client) RequestWithSession(ctx context.Context, method string, path string, data *url.Values) (*http.Request, error)
- func (c Client) SetAdBlockEnabled(ctx context.Context, enable bool) (*EnableAdBlock, error)
- func (c Client) UpdateDNSRecord(ctx context.Context, record *DNSRecord) (*DNSRecord, error)
- func (c *Client) Validate() error
- type Config
- type CreateDNSRecordResponse
- type DNSRecord
- type DNSRecordList
- type DNSRecordsListResponse
- type EnableAdBlock
- type EnableAdBlockResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CNAMERecord ¶ added in v0.0.2
type CNAMERecordList ¶ added in v0.0.2
type CNAMERecordList []CNAMERecord
type CNAMERecordsListResponse ¶ added in v0.0.2
type CNAMERecordsListResponse struct {
Data [][]string
}
func (CNAMERecordsListResponse) ToDNSRecordList ¶ added in v0.0.2
func (rr CNAMERecordsListResponse) ToDNSRecordList() CNAMERecordList
ToDNSRecordList converts a CNAMERecordsListResponse into a CNAMERecordsList object.
type Client ¶
func (Client) CreateDNSRecord ¶
CreateDNSRecord creates a pihole DNS record entry
func (Client) DeleteDNSRecord ¶
DeleteDNSRecord deletes a pihole local DNS record by domain name
func (Client) GetAdBlockerStatus ¶
func (c Client) GetAdBlockerStatus(ctx context.Context) (*EnableAdBlock, error)
GetAdBlockerStatus returns whether pihole ad blocking is enabled or not
func (Client) GetDNSRecord ¶
GetDNSRecord searches the pihole local DNS records for the passed domain and returns a result if found
func (*Client) Init ¶
Init sets fields on the client which are a product of pihole network requests or other side effects
func (Client) ListCNAMERecords ¶ added in v0.0.2
func (c Client) ListCNAMERecords(ctx context.Context) (CNAMERecordList, error)
ListCNAMERecords returns a list of the configured CNAME Pi-hole records
func (Client) ListDNSRecords ¶
func (c Client) ListDNSRecords(ctx context.Context) (DNSRecordList, error)
ListDNSRecords Returns the list of custom DNS records configured in pihole
func (*Client) Request ¶
func (c *Client) Request(ctx context.Context, method string, path string, data *url.Values) (*http.Request, error)
Request executes a basic unauthenticated http request
func (Client) RequestWithAuth ¶
func (c Client) RequestWithAuth(ctx context.Context, method string, path string, data *url.Values) (*http.Request, error)
RequestWithAuth adds an auth token to the passed request
func (Client) RequestWithSession ¶
func (c Client) RequestWithSession(ctx context.Context, method string, path string, data *url.Values) (*http.Request, error)
RequestWithSession executes a request with appropriate session authentication (login() must have been called)
func (Client) SetAdBlockEnabled ¶
SetAdBlockEnabled sets whether pihole ad blocking is enabled or not
func (Client) UpdateDNSRecord ¶
UpdateDNSRecord deletes a pihole local DNS record by domain name
type CreateDNSRecordResponse ¶
type DNSRecordList ¶
type DNSRecordList []DNSRecord
type DNSRecordsListResponse ¶
type DNSRecordsListResponse struct {
Data [][]string
}
func (DNSRecordsListResponse) ToDNSRecordList ¶
func (rr DNSRecordsListResponse) ToDNSRecordList() DNSRecordList
ToDNSRecordList converts a DNSRecordsListResponse into a DNSRecordList object.
type EnableAdBlock ¶
type EnableAdBlock struct {
Enabled bool
}
type EnableAdBlockResponse ¶
type EnableAdBlockResponse struct {
Status string
}
func (EnableAdBlockResponse) ToEnableAdBlock ¶
func (eb EnableAdBlockResponse) ToEnableAdBlock() *EnableAdBlock
ToEnableAdBlock turns am EnableAdBlockResponse into an EnableAdBlock object