cpd

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package cpd contains the Captive Portal Detection.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Host is the host address used for probing.
	Host = "connectivity-check.ubuntu.com"

	// HTTPTimeout is the timeout for http requests in seconds.
	HTTPTimeout = 5 * time.Second

	// ProbeCount is the number of probes to run.
	ProbeCount = 3

	// ProbeWait is the time between probes.
	ProbeWait = time.Second

	// ProbeTimer is the probe timer in case of no detected portal
	// in seconds.
	ProbeTimer = 300 * time.Second

	// ProbeTimerDetected is the probe timer in case of a detected portal
	// in seconds.
	ProbeTimerDetected = 15 * time.Second
)

Functions

This section is empty.

Types

type CPD

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

CPD is a captive portal detection instance.

func NewCPD

func NewCPD(config *Config) *CPD

NewCPD returns a new CPD.

func (*CPD) Hosts

func (c *CPD) Hosts() []string

Hosts returns the host addresses used for captive protal detection.

func (*CPD) Probe

func (c *CPD) Probe()

Probe triggers the captive portal detection.

func (*CPD) Results

func (c *CPD) Results() chan *Report

Results returns the results channel.

func (*CPD) Start

func (c *CPD) Start()

Start starts the captive portal detection.

func (*CPD) Stop

func (c *CPD) Stop()

Stop stops the captive portal detection.

type Config added in v0.1.0

type Config struct {
	Host               string
	HTTPTimeout        time.Duration
	ProbeCount         int
	ProbeWait          time.Duration
	ProbeTimer         time.Duration
	ProbeTimerDetected time.Duration
}

Config is the configuration of the captive portal detection.

func NewConfig added in v0.1.0

func NewConfig() *Config

NewConfig returns a new default configuration for captive portal detection.

func (*Config) Valid added in v0.1.0

func (c *Config) Valid() bool

Valid returns whether the captive portal detection configuration is valid.

type Report

type Report struct {
	Detected bool
	Host     string
}

Report is a captive portal detection report.

Jump to

Keyboard shortcuts

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