home

package
v0.104.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: GPL-3.0 Imports: 64 Imported by: 0

Documentation

Overview

Package home contains AdGuard Home's HTTP API methods.

Index

Constants

View Source
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

View Source
const (
	FilterRefreshForce      = 1 // ignore last file modification date
	FilterRefreshAllowlists = 2 // update allow-lists
	FilterRefreshBlocklists = 4 // update block-lists
)

Variables

View Source
var (
	ARMVersion = ""
)

Update-related variables

View Source
var Context homeContext

Context - a global context object

View Source
var GLMode bool

GLMode - enable GL-Inet compatibility mode

Functions

func Main

func Main(version, channel, armVer string)

Main is the entry point

func RegisterAuthHandlers

func RegisterAuthHandlers()

RegisterAuthHandlers - register handlers

func StartMods

func StartMods() error

StartMods - initialize and start DNS after installation

func WebCheckPortAvailable

func WebCheckPortAvailable(port int) bool

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 InitAuth

func InitAuth(dbFilename string, users []User, sessionTTL uint32) *Auth

InitAuth - create a global object

func (*Auth) AuthRequired

func (a *Auth) AuthRequired() bool

AuthRequired - if authentication is required

func (*Auth) CheckSession

func (a *Auth) CheckSession(sess string) int

CheckSession - check if session is valid Return 0 if OK; -1 if session doesn't exist; 1 if session has expired

func (*Auth) Close

func (a *Auth) Close()

Close - close module

func (*Auth) GetCurrentUser

func (a *Auth) GetCurrentUser(r *http.Request) User

GetCurrentUser - get the current user

func (*Auth) GetUsers

func (a *Auth) GetUsers() []User

GetUsers - get users

func (*Auth) RemoveSession

func (a *Auth) RemoveSession(sess string)

RemoveSession - remove session

func (*Auth) UserAdd

func (a *Auth) UserAdd(u *User, password string)

UserAdd - add new user

func (*Auth) UserFind

func (a *Auth) UserFind(login, password string) User

UserFind - find a user

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 DNSEncryption

type DNSEncryption struct {
	// contains filtered or unexported fields
}

type DNSSettings

type DNSSettings struct {
	DNSProtocol string
	ServerURL   string `plist:",omitempty"`
	ServerName  string `plist:",omitempty"`
}

type Filtering

type Filtering struct {
	// contains filtered or unexported fields
}

Filtering - module object

func (*Filtering) Close

func (f *Filtering) Close()

Close - close the module

func (*Filtering) Init

func (f *Filtering) Init()

Init - initialize the module

func (*Filtering) RegisterFilteringHandlers

func (f *Filtering) RegisterFilteringHandlers()

RegisterFilteringHandlers - register handlers

func (*Filtering) Start

func (f *Filtering) Start()

Start - start the module

type HTTPSServer

type HTTPSServer struct {
	// contains filtered or unexported fields
}

HTTPSServer - HTTPS Server

type MobileConfig

type MobileConfig struct {
	PayloadContent           []PayloadContent
	PayloadDescription       string
	PayloadDisplayName       string
	PayloadIdentifier        string
	PayloadRemovalDisallowed bool
	PayloadType              string
	PayloadUUID              string
	PayloadVersion           int
}

type PayloadContent

type PayloadContent struct {
	Name               string
	PayloadDescription string
	PayloadDisplayName string
	PayloadIdentifier  string
	PayloadType        string
	PayloadUUID        string
	PayloadVersion     int
	DNSSettings        DNSSettings
}

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

func (*RDNS) Begin

func (r *RDNS) Begin(ip string)

Begin - add IP address to rDNS queue

type TLSMod

type TLSMod struct {
	// contains filtered or unexported fields
}

TLSMod - TLS module object

func (*TLSMod) Close

func (t *TLSMod) Close()

Close - close module

func (*TLSMod) Reload

func (t *TLSMod) Reload()

Reload - reload certificate file

func (*TLSMod) Start

func (t *TLSMod) Start()

Start - start the module

func (*TLSMod) WriteDiskConfig

func (t *TLSMod) WriteDiskConfig(conf *tlsConfigSettings)

WriteDiskConfig - write config

type User

type User struct {
	Name         string `yaml:"name"`
	PasswordHash string `yaml:"password"` // bcrypt hash
}

User object

type Web

type Web struct {
	// contains filtered or unexported fields
}

Web - module object

func CreateWeb

func CreateWeb(conf *WebConfig) *Web

CreateWeb - create module

func (*Web) Close

func (web *Web) Close()

Close - stop HTTP server, possibly waiting for all active connections to be closed

func (*Web) Start

func (web *Web) Start()

Start - start serving HTTP requests

func (*Web) TLSConfigChanged

func (web *Web) TLSConfigChanged(tlsConf tlsConfigSettings)

TLSConfigChanged - called when TLS configuration has changed

type WebConfig

type WebConfig struct {
	BindHost  string
	BindPort  int
	PortHTTPS int
	// contains filtered or unexported fields
}

type Whois

type Whois struct {
	// contains filtered or unexported fields
}

Whois - module context

func (*Whois) Begin

func (w *Whois) Begin(ip string)

Begin - begin requesting WHOIS info

Jump to

Keyboard shortcuts

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