home

package
v0.107.25 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: GPL-3.0 Imports: 76 Imported by: 0

Documentation

Overview

Package home contains AdGuard Home's HTTP API methods.

Index

Constants

View Source
const (
	ClientSourceNone clientSource = iota
	ClientSourceWHOIS
	ClientSourceARP
	ClientSourceRDNS
	ClientSourceDHCP
	ClientSourceHostsFile
	ClientSourcePersistent
)

Clients information sources. The order determines the priority.

View Source
const MaxConnReadSize = 64 * 1024

MaxConnReadSize is an upper limit in bytes for reading from net.Conn.

View Source
const MaxFileSize = 1024 * 1024

MaxFileSize is a maximum file length in bytes.

View Source
const PasswordMinRunes = 8

PasswordMinRunes is the minimum length of user's password in runes.

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(clientBuildFS fs.FS)

Main is the entry point

func RegisterAuthHandlers

func RegisterAuthHandlers()

RegisterAuthHandlers - register handlers

Types

type Auth

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

Auth - global object

func InitAuth

func InitAuth(dbFilename string, users []webUser, sessionTTL uint32, rateLimiter *authRateLimiter) *Auth

InitAuth - create a global object

func (*Auth) AuthRequired

func (a *Auth) AuthRequired() bool

AuthRequired - if authentication is required

func (*Auth) Close

func (a *Auth) Close()

Close - close module

func (*Auth) GetUsers

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

GetUsers - get users

func (*Auth) RemoveSession

func (a *Auth) RemoveSession(sess string)

RemoveSession - remove session

func (*Auth) UserAdd

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

UserAdd - add new user

type Client

type Client struct {
	Name string

	IDs             []string
	Tags            []string
	BlockedServices []string
	Upstreams       []string

	UseOwnSettings        bool
	FilteringEnabled      bool
	SafeSearchEnabled     bool
	SafeBrowsingEnabled   bool
	ParentalEnabled       bool
	UseOwnBlockedServices bool
	// contains filtered or unexported fields
}

Client contains information about persistent clients.

type RDNS

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

RDNS resolves clients' addresses to enrich their metadata.

func NewRDNS added in v0.106.0

func NewRDNS(
	exchanger dnsforward.RDNSExchanger,
	clients *clientsContainer,
	usePrivate bool,
) (rDNS *RDNS)

NewRDNS creates and returns initialized RDNS.

func (*RDNS) Begin

func (r *RDNS) Begin(ip netip.Addr)

Begin adds the ip to the resolving queue if it is not cached or already resolved.

type RuntimeClient added in v0.106.0

type RuntimeClient struct {
	WHOISInfo *RuntimeClientWHOISInfo
	Host      string
	Source    clientSource
}

RuntimeClient information

type RuntimeClientWHOISInfo added in v0.107.0

type RuntimeClientWHOISInfo struct {
	City    string `json:"city,omitempty"`
	Country string `json:"country,omitempty"`
	Orgname string `json:"orgname,omitempty"`
}

RuntimeClientWHOISInfo is the filtered WHOIS data for a runtime client.

type Theme added in v0.107.22

type Theme string

Theme is an enum of all allowed UI themes.

const (
	ThemeAuto  Theme = "auto"
	ThemeLight Theme = "light"
	ThemeDark  Theme = "dark"
)

Allowed Theme values.

Keep in sync with client/src/helpers/constants.js.

func (*Theme) UnmarshalText added in v0.107.22

func (t *Theme) UnmarshalText(b []byte) (err error)

UnmarshalText implements encoding.TextUnmarshaler interface for *Theme.

type WHOIS added in v0.107.0

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

WHOIS - module context

func (*WHOIS) Begin added in v0.107.0

func (w *WHOIS) Begin(ip netip.Addr)

Begin - begin requesting WHOIS info

type Web

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

Web is the web UI and API server.

func (*Web) Close

func (web *Web) Close(ctx context.Context)

Close gracefully shuts down the HTTP servers.

func (*Web) Start

func (web *Web) Start()

Start - start serving HTTP requests

func (*Web) TLSConfigChanged

func (web *Web) TLSConfigChanged(ctx context.Context, tlsConf tlsConfigSettings)

TLSConfigChanged updates the TLS configuration and restarts the HTTPS server if necessary.

Jump to

Keyboard shortcuts

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