config

package
v0.0.0-...-7ec33b0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const GuestsUsername = "Guests"

GuestsUsername is the collective name to be displayed for devices that are currently online

Variables

This section is empty.

Functions

func AllowsIP

func AllowsIP(ip net.IP) bool

AllowsIP checks if the given IP is allowed by auth CIDR

func IsDeviceFor

func IsDeviceFor(device string) string

func PrintUsage

func PrintUsage()

PrintUsage displays the help for the env vars

func Read

func Read() error

Read from env variables

Types

type AppConfig

type AppConfig struct {
	// FritzBoxUrl is the base URL for the Fritz!Box Web UI
	FritzBoxUrl string `required:"true" split_words:"true"`
	// FritzBoxUsername to use for logging in
	FritzBoxUsername string `required:"true" split_words:"true"`
	// FritzBoxPassword to use for logging in
	FritzBoxPassword string `required:"true" split_words:"true"`
	// IgnoreCertificates specifies to ignore SSL certificate validation for the requests to Fritz!Box
	IgnoreCertificates bool `required:"false" default:"false" split_words:"true"`
	// DeviceNameMapping is the list of device names to map to given usernames
	DeviceNameMapping DeviceNameMappingDecoder `required:"true" split_words:"true"`
	// ServerPort is the HTTP port of the server
	ServerPort int `required:"false" default:"8090" split-word:"true"`
	// ShowGuests enables the visibility of guest devices, bundled under a pseudo username
	ShowGuests bool `required:"false" default:"true" split_words:"true"`
	// AuthMiddlewareOrder is a ordered list, which is followed to authenticate users
	AuthMiddlewareOrder []string `required:"false" default:"ip_range,www_authenticate"  split_words:"true"`
	// AuthIpRange is the local IP range to allow direct access to the page
	AuthIpRange IpRangeDecoder `required:"false" default:"192.168.178.0/24"  split_words:"true"`
	// AuthPassword is the shared password for WWW-Authenticate to get access
	AuthPassword string `required:"false" default:"changeme" split_words:"true"`
	// IndexTemplatePath is the location of a custom UI template to use
	IndexTemplatePath string `required:"false" split_words:"true"`
	// TelegramBotToken is the token to use for doing telegram requests. If it is set telegram messages are read
	TelegramBotToken string `required:"false" split_words:"true"`
	// TelegramBotAllowedUsers is the list of usernames allowed to talk to the bot
	TelegramBotAllowedUsers []string `required:"false" split_words:"true"`
}

AppConfig represents the configuration for the entire application

func Get

func Get() *AppConfig

Get current app configuration, make sure Read has been called before.

type DeviceNameMappingDecoder

type DeviceNameMappingDecoder map[string][]string

func (*DeviceNameMappingDecoder) Decode

func (umd *DeviceNameMappingDecoder) Decode(value string) error

type IpRangeDecoder

type IpRangeDecoder net.IPNet

func (*IpRangeDecoder) Decode

func (iprd *IpRangeDecoder) Decode(value string) error

Jump to

Keyboard shortcuts

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