Documentation ¶
Index ¶
- Constants
- func Logger(customLogger zerolog.Logger)
- type AuthHandler
- type BaseWorker
- func (worker BaseWorker) Alive() bool
- func (BaseWorker) BlockedBy() []WorkerName
- func (worker BaseWorker) GracefulShutdown() bool
- func (worker *BaseWorker) ID() string
- func (worker *BaseWorker) Shutdown() error
- func (worker *BaseWorker) Start()
- func (worker BaseWorker) Started() bool
- func (worker *BaseWorker) Stop() error
- func (BaseWorker) Test() error
- func (worker *BaseWorker) WaitForShutdown()
- type ChanStat
- type ChanStats
- type ConfigurationData
- type ConfigurationKey
- type ConfigurationPortalData
- type ConfigurationWhiteListData
- type ConfigurationWifiData
- type HandlerJSONResponse
- type HandlerJSONResponseType
- type IP
- type IPNet
- type Ints
- type IpRange
- type JsonString
- type MigrateLogger
- type NFQActionType
- type PortalEventType
- type ReportDate
- type SentryLogHook
- type StatisticKey
- type Worker
- type WorkerLogger
- func (wlogger WorkerLogger) Debug(format string, v ...interface{})
- func (wlogger WorkerLogger) Error(format string, v ...interface{})
- func (wlogger WorkerLogger) Info(format string, v ...interface{})
- func (wlogger WorkerLogger) PrintMessage(prefix string, message *dhcpv4.DHCPv4)
- func (wlogger WorkerLogger) Printf(format string, v ...interface{})
- func (wlogger WorkerLogger) Write(p []byte) (n int, err error)
- type WorkerName
Constants ¶
const ( ColorReset = "\033[0m" ColorRed = "\033[0;31m" ColorGreen = "\033[0;32m" ColorYellow = "\033[0;33m" ColorCyan = "\033[0;36m" ColorWhite = "\033[0;97m" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthHandler ¶
type AuthHandler bool
const ( Blocking AuthHandler = true NonBlocking AuthHandler = false )
type BaseWorker ¶
type BaseWorker struct {
// contains filtered or unexported fields
}
BaseWorker implements the standard functionality every worker has e.g. the behavior of Shutdown and Alive.
func (BaseWorker) Alive ¶
func (worker BaseWorker) Alive() bool
func (BaseWorker) BlockedBy ¶
func (BaseWorker) BlockedBy() []WorkerName
func (BaseWorker) GracefulShutdown ¶
func (worker BaseWorker) GracefulShutdown() bool
func (*BaseWorker) ID ¶
func (worker *BaseWorker) ID() string
func (*BaseWorker) Shutdown ¶
func (worker *BaseWorker) Shutdown() error
func (*BaseWorker) Start ¶
func (worker *BaseWorker) Start()
func (BaseWorker) Started ¶
func (worker BaseWorker) Started() bool
func (*BaseWorker) Stop ¶
func (worker *BaseWorker) Stop() error
func (BaseWorker) Test ¶
func (BaseWorker) Test() error
func (*BaseWorker) WaitForShutdown ¶
func (worker *BaseWorker) WaitForShutdown()
type ChanStat ¶
ChanStat holds information on how often a certain go channel was called. Only if the call succeeded ChanStat.Processed will be increased.
type ConfigurationData ¶
type ConfigurationData interface {
Merge(JsonString) JsonString
}
type ConfigurationKey ¶
type ConfigurationKey string
ConfigurationKey represents the keys for the available system configuration
const ( WhiteListConfiguration ConfigurationKey = "whitelist" IPTablesConfiguration ConfigurationKey = "iptables" PortalConfiguration ConfigurationKey = "portal" PatternConfiguration ConfigurationKey = "pattern" NetworkConfiguration ConfigurationKey = "network" NetworkDNSConfiguration ConfigurationKey = "network_dns" NetworkDHCPClientConfiguration ConfigurationKey = "network_dhcp_client" NetworkDHCPServerConfiguration ConfigurationKey = "network_dhcp_server" HWDetectConfiguration ConfigurationKey = "hw_detect" WifiSTAConfiguration ConfigurationKey = "wifi_sta" WifiAPConfiguration ConfigurationKey = "wifi_ap" )
func (ConfigurationKey) String ¶
func (key ConfigurationKey) String() string
String returns the string representative of ConfigurationKey
type ConfigurationPortalData ¶
type ConfigurationPortalData struct { Fingerprint string `json:"fingerprint" binding:"fingerprint"` Notification *bool `json:"notification"` Exception *bool `json:"exception"` Profile *bool `json:"profile"` Enabled bool `json:"enabled" binding:"required"` PoolUuid string `json:"poolUuid" binding:"uuid"` }
func (ConfigurationPortalData) Merge ¶
func (data ConfigurationPortalData) Merge(dbJson JsonString) JsonString
type ConfigurationWhiteListData ¶
type ConfigurationWhiteListData struct {
Entries []string `json:"entries" binding:"iporcidr"`
}
func (ConfigurationWhiteListData) Merge ¶
func (data ConfigurationWhiteListData) Merge(dbJson JsonString) JsonString
type ConfigurationWifiData ¶
type ConfigurationWifiData struct { SSID string `json:"ssid" binding:"min=2"` Passphrase string `json:"passphrase" binding:"min=12"` Enabled *bool `json:"enabled,omitempty" binding:"required"` ExtraConfiguration map[string]string `json:"extraConfiguration"` }
func (ConfigurationWifiData) Merge ¶
func (data ConfigurationWifiData) Merge(dbJson JsonString) JsonString
type HandlerJSONResponse ¶
type HandlerJSONResponse struct { Type HandlerJSONResponseType `json:"type"` Message string `json:"msg,omitempty"` Data interface{} `json:"data,omitempty"` }
type HandlerJSONResponseType ¶
type HandlerJSONResponseType string
const ( HandlerErrorType HandlerJSONResponseType = "error" HandlerSuccessType HandlerJSONResponseType = "success" )
type IP ¶
IP represents net.IP with a custom scanner interface for sqlx and json
type IPNet ¶
IP represents net.IPNet with a custom scanner interface for sqlx and json
type IpRange ¶
type IpRange struct {
Start, End string
}
IpRange represents a range within a subnet. This is used for dhcpd configuration.
type JsonString ¶
type JsonString string
JsonString is a special string and should contain only valid JSON. It is used for interacting with the sqlx library
func (JsonString) MarshalJSON ¶
func (jsonString JsonString) MarshalJSON() ([]byte, error)
NOTE normally json stops marshalling if it is a string but in this case we save JSON data as string in a database WARNING if the string is not valid json this will make trouble
func (*JsonString) UnmarshalJSON ¶
func (jsonString *JsonString) UnmarshalJSON(b []byte) error
type MigrateLogger ¶
MigrateLogger is used to display migration results via the zerolog channel
func (MigrateLogger) Printf ¶
func (m MigrateLogger) Printf(format string, v ...interface{})
func (MigrateLogger) Verbose ¶
func (MigrateLogger) Verbose() bool
type NFQActionType ¶
type NFQActionType byte
NFQActionType is used to give feedback about which component was responsible for dropping traffic
const ( NFQActionDefault = 0x00 PacketDroppedByProfile NFQActionType = 0x10 // profiling ML )
func (*NFQActionType) Scan ¶
func (action *NFQActionType) Scan(src interface{}) error
func (NFQActionType) String ¶
func (action NFQActionType) String() string
String will return the string representation of the nfq action type
func (NFQActionType) Value ¶
func (action NFQActionType) Value() (driver.Value, error)
type PortalEventType ¶
type PortalEventType uint
PortalEventType represents the portal event message type
const ( PortalMembershipRequest PortalEventType = 0 PortalNotification PortalEventType = 1 PortalException PortalEventType = 2 // generic portal event PortalGenericEvent PortalEventType = 100 )
type ReportDate ¶
ReportDate is a special formatted database timestamp
func (*ReportDate) Scan ¶
func (reportDate *ReportDate) Scan(src interface{}) error
func (ReportDate) Value ¶
func (reportDate ReportDate) Value() (driver.Value, error)
type SentryLogHook ¶
type SentryLogHook struct{}
type StatisticKey ¶
type StatisticKey string
StatisticKey represents the keys for the available statistics
const ( DNSPatternStatistic StatisticKey = "DNSPatternStatistic" IPPatternStatistic StatisticKey = "IPPatternStatistic" // what is active right now ActiveIPPatternStatistic StatisticKey = "ActiveIPPatternStatistic" ActiveDNSPatternStatistic StatisticKey = "ActiveDNSPatternStatistic" NetworkDeviceStatistic StatisticKey = "NetworkDeviceStatistic" DroppedConnectionsStatistic StatisticKey = "DroppedConnectionsStatistic" )
type Worker ¶
type Worker interface { ID() string Name() WorkerName Alive() bool Started() bool Shutdown() error GracefulShutdown() bool Logger(zerolog.Logger) BlockedBy() []WorkerName Run() Test() error }
Worker is the minimum functionality a worker struct has to implement
type WorkerLogger ¶
type WorkerLogger struct { // if IsError is nil the log level will be debug, // if IsError is false the log level will be info // if IsError is true the log level will be error IsError *bool zerolog.Logger }
WorkerLogger is the wrapper interface to e.g. the DHCP client and server log messages
func (WorkerLogger) Debug ¶
func (wlogger WorkerLogger) Debug(format string, v ...interface{})
func (WorkerLogger) Error ¶
func (wlogger WorkerLogger) Error(format string, v ...interface{})
func (WorkerLogger) Info ¶
func (wlogger WorkerLogger) Info(format string, v ...interface{})
func (WorkerLogger) PrintMessage ¶
func (wlogger WorkerLogger) PrintMessage(prefix string, message *dhcpv4.DHCPv4)
func (WorkerLogger) Printf ¶
func (wlogger WorkerLogger) Printf(format string, v ...interface{})
func (WorkerLogger) Write ¶
func (wlogger WorkerLogger) Write(p []byte) (n int, err error)
type WorkerName ¶
type WorkerName string
WorkerName represents the name from a worker. This is used to identify individuals
const ( ConfdWorker WorkerName = "CONFD" DhcpClientWorker WorkerName = "DHCPCLIENT" DhcpServerWorker WorkerName = "DHCPSERVER" DnsWorker WorkerName = "DNS" FrontendWorker WorkerName = "FRONTEND" HWDetectWorker WorkerName = "HWDETECT" IPTablesWorker WorkerName = "IPTABLES" NFQWorker WorkerName = "NFQ" PortalWorker WorkerName = "PORTAL" ProfilerWorker WorkerName = "PROFILER" WatcherWorker WorkerName = "WATCHER" WifiAPWorker WorkerName = "WIFIAP" WifiSTAWorker WorkerName = "WIFISTA" )
func (WorkerName) String ¶
func (name WorkerName) String() string