api

package
v0.9.2-0...-36b1380 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package api provides basic API structs for the REST services

Index

Constants

View Source
const (
	// PathBlockingStatusPath defines the REST endpoint for blocking status
	PathBlockingStatusPath = "/api/blocking/status"

	// PathBlockingEnablePath defines the REST endpoint for blocking enable
	PathBlockingEnablePath = "/api/blocking/enable"

	// PathBlockingDisablePath defines the REST endpoint for blocking disable
	PathBlockingDisablePath = "/api/blocking/disable"

	// PathListsRefresh defines the REST endpoint for blocking refresh
	PathListsRefresh = "/api/lists/refresh"

	// PathQueryPath defines the REST endpoint for query
	PathQueryPath = "/api/query"
)

Variables

This section is empty.

Functions

func RegisterEndpoint

func RegisterEndpoint(router chi.Router, t interface{})

RegisterEndpoint registers an implementation as HTTP endpoint

Types

type BlockingControl

type BlockingControl interface {
	EnableBlocking()
	DisableBlocking(duration time.Duration, disableGroups []string) error
	BlockingStatus() BlockingStatus
}

BlockingControl interface to control the blocking status

type BlockingEndpoint

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

BlockingEndpoint endpoint for the blocking status control

type BlockingStatus

type BlockingStatus struct {
	// True if blocking is enabled
	Enabled bool `json:"enabled"`
	// Disabled group names
	DisabledGroups []string `json:"disabledGroups"`
	// If blocking is temporary disabled: amount of seconds until blocking will be enabled
	AutoEnableInSec uint `json:"autoEnableInSec"`
}

BlockingStatus represents the current blocking status

type ListRefreshEndpoint

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

ListRefreshEndpoint endpoint for list refresh

type ListRefresher

type ListRefresher interface {
	RefreshLists()
}

ListRefresher interface to control the list refresh

type QueryRequest

type QueryRequest struct {
	// query for DNS request
	Query string
	// request type (A, AAAA, ...)
	Type string
}

QueryRequest is a data structure for a DNS request

type QueryResult

type QueryResult struct {
	// blocky reason for resolution
	Reason string `json:"reason"`
	// response type (CACHED, BLOCKED, ...)
	ResponseType string `json:"responseType"`
	// actual DNS response
	Response string `json:"response"`
	// DNS return code (NOERROR, NXDOMAIN, ...)
	ReturnCode string `json:"returnCode"`
}

QueryResult is a data structure for the DNS result

Jump to

Keyboard shortcuts

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