adguard

package module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2023 License: MIT Imports: 6 Imported by: 1

README

AdGuard Home Go SDK

Release GoDoc License Status Go Report Card

Based on version 0.107 of the upstream API.

This was written primarily for use in my Terraform provider for AdGuard Home.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ADG

type ADG struct {
	HostURL    string
	HTTPClient *http.Client
	Auth       AuthStruct
}

ADG Client

func NewClient

func NewClient(host, username, password, scheme *string, timeout *int) (*ADG, error)

NewClient

func (*ADG) CreateClient

func (c *ADG) CreateClient(client Client) (*Client, error)

CreateClient - Create a client

func (*ADG) CreateListFilter added in v0.2.1

func (c *ADG) CreateListFilter(filterData AddUrlRequest) (*Filter, bool, error)

CreateListFilter - Create a list filter, returning the created filter and whether it's a whitelist filter

func (*ADG) DeleteClient

func (c *ADG) DeleteClient(clientDelete ClientDelete) error

DeleteClient - Deletes a client

func (*ADG) DeleteListFilter added in v0.2.1

func (c *ADG) DeleteListFilter(filterDelete RemoveUrlRequest) error

DeleteListFilter - Deletes a list filter

func (*ADG) GetAllFilters added in v0.2.1

func (c *ADG) GetAllFilters() (*FilterStatus, error)

GetAllFilter - Returns all filters

func (*ADG) GetClient

func (c *ADG) GetClient(identifier string) (*Client, error)

GetClient - Returns a client based on an identifier

func (*ADG) GetListFilterById added in v0.2.1

func (c *ADG) GetListFilterById(id int64) (*Filter, bool, error)

GetListFilterById - Returns a list filter based on its name and whether it's a whitelist filter

func (*ADG) GetListFilterByName added in v0.2.1

func (c *ADG) GetListFilterByName(listName string) (*Filter, bool, error)

GetListFilterByName - Returns a list filter based on its name and whether it's a whitelist filter

func (*ADG) GetUserRules added in v0.2.1

func (c *ADG) GetUserRules() (*[]string, error)

GetUserRules - Returns a list of all user rules

func (*ADG) UpdateClient

func (c *ADG) UpdateClient(clientUpdate ClientUpdate) (*Client, error)

UpdateClient - Update a client

func (*ADG) UpdateListFilter added in v0.2.1

func (c *ADG) UpdateListFilter(filterUpdate FilterSetUrl) (*Filter, bool, error)

UpdateListFilter - Update a list filter, returning the updated filter and whether it's a whitelist filter

func (*ADG) UpdateUserRules added in v0.2.1

func (c *ADG) UpdateUserRules(rules SetRulesRequest) (*[]string, error)

UpdateUserRules - Update user-provided rules, returning the list of all user rules

type AddUrlRequest added in v0.2.1

type AddUrlRequest struct {
	Name      string `json:"name"`
	Url       string `json:"url"`
	Whitelist bool   `json:"whitelist"`
}

AddUrlRequest

type AllClients

type AllClients struct {
	Clients       []Client     `json:"clients"`
	ClientAuto    []ClientAuto `json:"auto_clients"`
	SupportedTags []string     `json:"supported_tags"`
}

AllClients

type AuthStruct

type AuthStruct struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

AuthStruct

type Client

type Client struct {
	Name                     string   `json:"name"`
	Ids                      []string `json:"ids"`
	UseGlobalSettings        bool     `json:"use_global_settings"`
	FilteringEnabled         bool     `json:"filtering_enabled"`
	ParentalEnabled          bool     `json:"parental_enabled"`
	SafebrowsingEnabled      bool     `json:"safebrowsing_enabled"`
	SafesearchEnabled        bool     `json:"safesearch_enabled"`
	UseGlobalBlockedServices bool     `json:"use_global_blocked_services"`
	BlockedServices          []string `json:"blocked_services"`
	Upstreams                []string `json:"upstreams"`
	Tags                     []string `json:"tags"`
}

Client

type ClientAuto

type ClientAuto struct {
	Name      string            `json:"name"`
	Ip        string            `json:"ip"`
	Source    string            `json:"source"`
	WhoisInfo map[string]string `json:"whois_info"`
}

ClientAuto

type ClientDelete

type ClientDelete struct {
	Name string `json:"name"`
}

ClientDelete

type ClientUpdate

type ClientUpdate struct {
	Name string `json:"name"`
	Data Client `json:"data"`
}

ClientUpdate

type Filter added in v0.2.1

type Filter struct {
	Enabled     bool   `json:"enabled"`
	Id          int64  `json:"id"`
	LastUpdated string `json:"last_updated"`
	Name        string `json:"name"`
	RulesCount  int32  `json:"rules_count"`
	Url         string `json:"url"`
}

Filter

type FilterSetUrl added in v0.2.1

type FilterSetUrl struct {
	Data      FilterSetUrlData `json:"data"`
	Url       string           `json:"url"`
	Whitelist bool             `json:"whitelist"`
}

FilterSetUrl

type FilterSetUrlData added in v0.2.1

type FilterSetUrlData struct {
	Enabled bool   `json:"enabled"`
	Name    string `json:"name"`
	Url     string `json:"url"`
}

FilterSetUrlData

type FilterStatus added in v0.2.1

type FilterStatus struct {
	Enabled          bool     `json:"enabled"`
	Interval         int      `json:"interval"`
	Filters          []Filter `json:"filters"`
	WhitelistFilters []Filter `json:"whitelist_filters"`
	UserRules        []string `json:"user_rules"`
}

FilterStatus

type RemoveUrlRequest added in v0.2.1

type RemoveUrlRequest struct {
	Url       string `json:"url"`
	Whitelist bool   `json:"whitelist"`
}

RemoveUrlRequest

type SetRulesRequest added in v0.2.1

type SetRulesRequest struct {
	Rules []string `json:"rules"`
}

SetRulesRequest

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL