server

package
v0.0.0-...-61e9e54 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2017 License: GPL-3.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Current = None

Current active server instance. None if any is enabled at this moment

View Source
var ResourcesPath = filepath.Join(os.Getenv("SNAP"), "static")

ResourcesPath absolute path to web static resources

View Source
var State = Stopped

State holds current server state

Functions

func ConnectHandler

func ConnectHandler(w http.ResponseWriter, r *http.Request)

ConnectHandler reads form got ssid and password and tries to connect to that network

func DisconnectHandler

func DisconnectHandler(w http.ResponseWriter, r *http.Request)

DisconnectHandler allows user to disconnect from external AP

func Errorf

func Errorf(format string, a ...interface{}) error

Errorf returns a new instance implementing error interface taken a formatted string and params as input

func HashItHandler

func HashItHandler(w http.ResponseWriter, r *http.Request)

HashItHandler returns a hash of the password as json

func ManagementHandler

func ManagementHandler(w http.ResponseWriter, r *http.Request)

ManagementHandler lists the current available SSIDs

func OperationalHandler

func OperationalHandler(w http.ResponseWriter, r *http.Request)

OperationalHandler display Opertational mode page

func ShutdownManagementServer

func ShutdownManagementServer() error

ShutdownManagementServer shutdown server management mode. If management server is not up, returns error

func ShutdownOperationalServer

func ShutdownOperationalServer() error

ShutdownOperationalServer shutdown server operational mode. If operational server is not up, returns error

func Sprintf

func Sprintf(format string, a ...interface{}) string

Sprintf returns a formatted string with project prefix

func StartManagementServer

func StartManagementServer() error

StartManagementServer starts server in management mode

func StartOperationalServer

func StartOperationalServer() error

StartOperationalServer starts server in operational mode

func WaitForState

func WaitForState(state RunningState) bool

WaitForState waits for server reach certain state

Types

type ConnectingData

type ConnectingData struct {
	Ssid string
}

ConnectingData dynamic data to fulfill the connect result page template

type Data

type Data interface{}

Data interface representing any data included in a template

type RunningState

type RunningState int

RunningState enum defining which server is up and running

const (
	Stopped RunningState = 0 + iota
	Starting
	Running
	Stopping
)

Server running state

type Server

type Server int

Server defines an enum of servers

const (
	None Server = 0 + iota
	Management
	Operational
)

Enum of available server options

type SsidsData

type SsidsData struct {
	Ssids []string
}

SsidsData dynamic data to fulfill the SSIDs page template

Jump to

Keyboard shortcuts

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