Documentation ¶
Overview ¶
Package home contains AdGuard Home's HTTP API methods.
Index ¶
- Constants
- Variables
- func Main(version, channel, armVer, mipsVer string)
- func RegisterAuthHandlers()
- func StartMods() error
- func WebCheckPortAvailable(port int) bool
- type Auth
- func (a *Auth) AuthRequired() bool
- func (a *Auth) CheckSession(sess string) int
- func (a *Auth) Close()
- func (a *Auth) GetCurrentUser(r *http.Request) User
- func (a *Auth) GetUsers() []User
- func (a *Auth) RemoveSession(sess string)
- func (a *Auth) UserAdd(u *User, password string)
- func (a *Auth) UserFind(login, password string) User
- type Client
- type ClientHost
- type Filtering
- type HTTPSServer
- type RDNS
- type TLSMod
- type User
- type Web
- type Whois
Constants ¶
const ( // Priority: etc/hosts > DHCP > ARP > rDNS > WHOIS ClientSourceWHOIS clientSource = iota // from WHOIS ClientSourceRDNS // from rDNS ClientSourceDHCP // from DHCP ClientSourceARP // from 'arp -a' ClientSourceHostsFile // from /etc/hosts )
Client sources
const ( // ReadTimeout is the maximum duration for reading the entire request, // including the body. ReadTimeout = 10 * time.Second // ReadHeaderTimeout is the amount of time allowed to read request // headers. ReadHeaderTimeout = 10 * time.Second // WriteTimeout is the maximum duration before timing out writes of the // response. WriteTimeout = 10 * time.Second )
const MaxConnReadSize = 64 * 1024
MaxConnReadSize is an upper limit in bytes for reading from net.Conn.
const MaxFileSize = 1024 * 1024
MaxFileSize is a maximum file length in bytes.
const RequestBodySizeLimit = 64 * 1024
RequestBodySizeLimit is maximum request body length in bytes.
Variables ¶
var ( ARMVersion = "" MIPSVersion = "" )
Update-related variables
var Context homeContext
Context - a global context object
var GLMode bool
GLMode - enable GL-Inet compatibility mode
Functions ¶
func WebCheckPortAvailable ¶
WebCheckPortAvailable - check if port is available BUT: if we are already using this port, no need
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth - global object
func (*Auth) AuthRequired ¶
AuthRequired - if authentication is required
func (*Auth) CheckSession ¶
CheckSession - check if session is valid Return 0 if OK; -1 if session doesn't exist; 1 if session has expired
func (*Auth) GetCurrentUser ¶
GetCurrentUser - get the current user
func (*Auth) RemoveSession ¶
RemoveSession - remove session
type Client ¶
type Client struct { IDs []string Tags []string Name string UseOwnSettings bool // false: use global settings FilteringEnabled bool SafeSearchEnabled bool SafeBrowsingEnabled bool ParentalEnabled bool UseOwnBlockedServices bool // false: use global settings BlockedServices []string Upstreams []string // list of upstream servers to be used for the client's requests // contains filtered or unexported fields }
Client information
type ClientHost ¶
type ClientHost struct { Host string Source clientSource WhoisInfo [][]string // [[key,value], ...] }
ClientHost information
type Filtering ¶
type Filtering struct {
// contains filtered or unexported fields
}
Filtering - module object
func (*Filtering) RegisterFilteringHandlers ¶
func (f *Filtering) RegisterFilteringHandlers()
RegisterFilteringHandlers - register handlers
type HTTPSServer ¶
type HTTPSServer struct {
// contains filtered or unexported fields
}
HTTPSServer - HTTPS Server
type RDNS ¶
type RDNS struct {
// contains filtered or unexported fields
}
RDNS - module context
func InitRDNS ¶
func InitRDNS(dnsServer *dnsforward.Server, clients *clientsContainer) *RDNS
InitRDNS - create module context
type TLSMod ¶
type TLSMod struct {
// contains filtered or unexported fields
}
TLSMod - TLS module object
func (*TLSMod) WriteDiskConfig ¶
func (t *TLSMod) WriteDiskConfig(conf *tlsConfigSettings)
WriteDiskConfig - write config
type Web ¶
type Web struct {
// contains filtered or unexported fields
}
Web - module object
func (*Web) Close ¶
func (web *Web) Close()
Close - stop HTTP server, possibly waiting for all active connections to be closed
func (*Web) TLSConfigChanged ¶
func (web *Web) TLSConfigChanged(tlsConf tlsConfigSettings)
TLSConfigChanged - called when TLS configuration has changed