types

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultAPIPath default api path
	DefaultAPIPath = "/control"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API added in v0.0.3

type API struct {
	Port     int    `json:"port,omitempty" yaml:"port,omitempty"`
	Username string `json:"username,omitempty" yaml:"username,omitempty"`
	Password string `json:"password,omitempty" yaml:"password,omitempty"`
	DarkMode bool   `json:"darkMode,omitempty" yaml:"darkMode,omitempty"`
}

API configuration

type AccessList added in v0.3.0

type AccessList struct {
	AllowedClients    []string `json:"allowed_clients"`
	DisallowedClients []string `json:"disallowed_clients"`
	BlockedHosts      []string `json:"blocked_hosts"`
}

AccessList access list

func (*AccessList) Equals added in v0.3.0

func (al *AccessList) Equals(o *AccessList) bool

Equals access list equal check

func (*AccessList) Sort added in v0.3.0

func (al *AccessList) Sort()

Sort sort access list

type AdGuardInstance

type AdGuardInstance struct {
	URL                string `json:"url" yaml:"url"`
	APIPath            string `json:"apiPath,omitempty" yaml:"apiPath,omitempty"`
	Username           string `json:"username,omitempty" yaml:"username,omitempty"`
	Password           string `json:"password,omitempty" yaml:"password,omitempty"`
	InsecureSkipVerify bool   `json:"insecureSkipVerify" yaml:"insecureSkipVerify"`
	AutoSetup          bool   `json:"autoSetup" yaml:"autoSetup"`
}

AdGuardInstance AdguardHome config instance

func (*AdGuardInstance) Key

func (i *AdGuardInstance) Key() string

Key AdGuardInstance key

type Client

type Client struct {
	Ids             []string `json:"ids,omitempty"`
	Tags            []string `json:"tags,omitempty"`
	BlockedServices []string `json:"blocked_services,omitempty"`
	Upstreams       []string `json:"upstreams,omitempty"`

	UseGlobalSettings        bool   `json:"use_global_settings"`
	UseGlobalBlockedServices bool   `json:"use_global_blocked_services"`
	Name                     string `json:"name"`
	FilteringEnabled         bool   `json:"filtering_enabled"`
	ParentalEnabled          bool   `json:"parental_enabled"`
	SafesearchEnabled        bool   `json:"safesearch_enabled"`
	SafebrowsingEnabled      bool   `json:"safebrowsing_enabled"`
	Disallowed               bool   `json:"disallowed"`
	DisallowedRule           string `json:"disallowed_rule"`
}

Client API struct

func (*Client) Equals added in v0.3.0

func (cl *Client) Equals(o *Client) bool

Equals Clients equal check

func (*Client) Sort

func (cl *Client) Sort()

Sort sort clients

type ClientUpdate

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

ClientUpdate API struct

type Clients

type Clients struct {
	Clients     []Client `json:"clients"`
	AutoClients []struct {
		IP        string   `json:"ip"`
		Name      string   `json:"name"`
		Source    string   `json:"source"`
		WhoisInfo struct{} `json:"whois_info"`
	} `json:"auto_clients"`
	SupportedTags []string `json:"supported_tags"`
}

Clients API struct

func (*Clients) Merge

func (clients *Clients) Merge(other *Clients) ([]Client, []Client, []Client)

Merge merge Clients

type Config

type Config struct {
	Origin     AdGuardInstance   `json:"origin" yaml:"origin"`
	Replica    AdGuardInstance   `json:"replica,omitempty" yaml:"replica,omitempty"`
	Replicas   []AdGuardInstance `json:"replicas,omitempty" yaml:"replicas,omitempty"`
	Cron       string            `json:"cron,omitempty" yaml:"cron,omitempty"`
	RunOnStart bool              `json:"runOnStart,omitempty" yaml:"runOnStart,omitempty"`
	API        API               `json:"api,omitempty" yaml:"api,omitempty"`
	Features   Features          `json:"features,omitempty" yaml:"features,omitempty"`
}

Config application configuration struct

func (*Config) UniqueReplicas

func (cfg *Config) UniqueReplicas() []AdGuardInstance

UniqueReplicas get unique replication instances

type DHCP added in v0.3.2

type DHCP struct {
	ServerConfig bool `json:"serverConfig" yaml:"serverConfig"`
	StaticLeases bool `json:"staticLeases" yaml:"staticLeases"`
}

DHCP features

type DHCPServerConfig added in v0.3.0

type DHCPServerConfig struct {
	V4            *V4ServerConfJSON `json:"v4"`
	V6            *V6ServerConfJSON `json:"v6"`
	InterfaceName string            `json:"interface_name"`
	Enabled       bool              `json:"enabled"`

	Leases       Leases `json:"leases,omitempty"`
	StaticLeases Leases `json:"static_leases,omitempty"`
}

DHCPServerConfig dhcp server config

func (*DHCPServerConfig) Equals added in v0.3.0

func (c *DHCPServerConfig) Equals(o *DHCPServerConfig) bool

Equals dhcp server config equal check

type DNS added in v0.3.2

type DNS struct {
	AccessLists  bool `json:"accessLists" yaml:"accessLists"`
	ServerConfig bool `json:"serverConfig" yaml:"serverConfig"`
	Rewrites     bool `json:"rewrites" yaml:"rewrites"`
}

DNS features

type DNSConfig added in v0.3.0

type DNSConfig struct {
	Upstreams     []string `json:"upstream_dns,omitempty"`
	UpstreamsFile string   `json:"upstream_dns_file"`
	Bootstraps    []string `json:"bootstrap_dns,omitempty"`

	ProtectionEnabled bool     `json:"protection_enabled"`
	RateLimit         uint32   `json:"ratelimit"`
	BlockingMode      string   `json:"blocking_mode,omitempty"`
	BlockingIPv4      net.IP   `json:"blocking_ipv4,omitempty"`
	BlockingIPv6      net.IP   `json:"blocking_ipv6"`
	EDNSCSEnabled     bool     `json:"edns_cs_enabled"`
	DNSSECEnabled     bool     `json:"dnssec_enabled"`
	DisableIPv6       bool     `json:"disable_ipv6"`
	UpstreamMode      string   `json:"upstream_mode,omitempty"`
	CacheSize         uint32   `json:"cache_size"`
	CacheMinTTL       uint32   `json:"cache_ttl_min"`
	CacheMaxTTL       uint32   `json:"cache_ttl_max"`
	ResolveClients    bool     `json:"resolve_clients"`
	LocalPTRUpstreams []string `json:"local_ptr_upstreams,omitempty"`
}

DNSConfig dns config

func (*DNSConfig) Equals added in v0.3.0

func (c *DNSConfig) Equals(o *DNSConfig) bool

Equals dns config equal check

func (*DNSConfig) Sort added in v0.3.0

func (c *DNSConfig) Sort()

Sort sort dns config

type EnableConfig added in v0.0.5

type EnableConfig struct {
	Enabled bool `json:"enabled"`
}

EnableConfig API struct

type Features added in v0.3.2

type Features struct {
	DNS             DNS  `json:"dns" yaml:"dns"`
	DHCP            DHCP `json:"dhcp" yaml:"dhcp"`
	GeneralSettings bool `json:"generalSettings" yaml:"generalSettings"`
	QueryLogConfig  bool `json:"queryLogConfig" yaml:"queryLogConfig"`
	StatsConfig     bool `json:"statsConfig" yaml:"statsConfig"`
	ClientSettings  bool `json:"clientSettings" yaml:"clientSettings"`
	Services        bool `json:"services" yaml:"services"`
	Filters         bool `json:"filters" yaml:"filters"`
}

Features feature flags

func (*Features) LogDisabled added in v0.3.2

func (f *Features) LogDisabled(l *zap.SugaredLogger)

LogDisabled log all disabled features

type Filter

type Filter struct {
	ID         int    `json:"id"`
	Enabled    bool   `json:"enabled"`
	URL        string `json:"url"`  // needed for add
	Name       string `json:"name"` // needed for add
	RulesCount int    `json:"rules_count"`
	Whitelist  bool   `json:"whitelist"` // needed for add
}

Filter API struct

func (*Filter) Equals added in v0.1.1

func (f *Filter) Equals(o *Filter) bool

Equals Filter equal check

type FilterUpdate added in v0.1.1

type FilterUpdate struct {
	URL       string `json:"url"`
	Data      Filter `json:"data"`
	Whitelist bool   `json:"whitelist"`
}

FilterUpdate API struct

type FilteringConfig

type FilteringConfig struct {
	EnableConfig
	IntervalConfig
}

FilteringConfig API struct

type FilteringStatus

type FilteringStatus struct {
	FilteringConfig
	Filters          Filters   `json:"filters"`
	WhitelistFilters Filters   `json:"whitelist_filters"`
	UserRules        UserRules `json:"user_rules"`
}

FilteringStatus API struct

type Filters

type Filters []Filter

Filters list of Filter

func (Filters) Merge

func (f Filters) Merge(other Filters) (Filters, Filters, Filters)

Merge merge Filters

type InstallConfig added in v0.2.0

type InstallConfig struct {
	Web      InstallPort `json:"web"`
	DNS      InstallPort `json:"dns"`
	Username string      `json:"username"`
	Password string      `json:"password"`
}

InstallConfig AdguardHome install config

type InstallPort added in v0.2.0

type InstallPort struct {
	IP         string `json:"ip"`
	Port       int    `json:"port"`
	Status     string `json:"status"`
	CanAutofix bool   `json:"can_autofix"`
}

InstallPort AdguardHome install config port

type IntervalConfig added in v0.0.5

type IntervalConfig struct {
	Interval float64 `json:"interval"`
}

IntervalConfig API struct

type Lease added in v0.3.0

type Lease struct {
	HWAddr   string `json:"mac"`
	IP       net.IP `json:"ip"`
	Hostname string `json:"hostname"`

	// Lease expiration time
	// 1: static lease
	Expiry time.Time `json:"expires"`
}

Lease contains the necessary information about a DHCP lease

type Leases added in v0.3.0

type Leases []Lease

Leases slice of leases type

func (Leases) Merge added in v0.3.0

func (l Leases) Merge(other Leases) ([]Lease, []Lease)

Merge the leases

type Protection added in v0.0.4

type Protection struct {
	ProtectionEnabled bool `json:"protection_enabled"`
}

Protection API struct

type QueryLogConfig added in v0.0.5

type QueryLogConfig struct {
	EnableConfig
	IntervalConfig
	AnonymizeClientIP bool `json:"anonymize_client_ip"`
}

QueryLogConfig API struct

func (*QueryLogConfig) Equals added in v0.0.5

func (qlc *QueryLogConfig) Equals(o *QueryLogConfig) bool

Equals QueryLogConfig equal check

type RefreshFilter

type RefreshFilter struct {
	Whitelist bool `json:"whitelist"`
}

RefreshFilter API struct

type RewriteEntries

type RewriteEntries []RewriteEntry

RewriteEntries list of RewriteEntry

func (*RewriteEntries) Merge

Merge RewriteEntries

type RewriteEntry

type RewriteEntry struct {
	Domain string `json:"domain"`
	Answer string `json:"answer"`
}

RewriteEntry API struct

func (*RewriteEntry) Key

func (re *RewriteEntry) Key() string

Key RewriteEntry key

type Services

type Services []string

Services API struct

func (Services) Equals

func (s Services) Equals(o Services) bool

Equals Services equal check

func (Services) Sort

func (s Services) Sort()

Sort sort Services

type Status

type Status struct {
	Protection
	DNSAddresses  []string `json:"dns_addresses"`
	DNSPort       int      `json:"dns_port"`
	HTTPPort      int      `json:"http_port"`
	DhcpAvailable bool     `json:"dhcp_available"`
	Running       bool     `json:"running"`
	Version       string   `json:"version"`
	Language      string   `json:"language"`
}

Status API struct

type UserRules

type UserRules []string

UserRules API struct

func (UserRules) String

func (ur UserRules) String() string

String toString of Users

type V4ServerConfJSON added in v0.3.0

type V4ServerConfJSON struct {
	GatewayIP     net.IP `json:"gateway_ip"`
	SubnetMask    net.IP `json:"subnet_mask"`
	RangeStart    net.IP `json:"range_start"`
	RangeEnd      net.IP `json:"range_end"`
	LeaseDuration uint32 `json:"lease_duration"`
}

V4ServerConfJSON v4 server conf

type V6ServerConfJSON added in v0.3.0

type V6ServerConfJSON struct {
	RangeStart    net.IP `json:"range_start"`
	RangeEnd      net.IP `json:"range_end"`
	LeaseDuration uint32 `json:"lease_duration"`
}

V6ServerConfJSON v6 server conf

Jump to

Keyboard shortcuts

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