Documentation ¶
Overview ¶
Package gdo provides the garage door webserver this file organizes the server oauth2 authentication wrapper and the gdo authorization module
Package gdo provides the garage door webserver this file organizes the door part
Package gdo implements the garage door controller ¶
Package gdo provides the garage door webserver this file organizes the server part
Index ¶
- func ClickHandler(w http.ResponseWriter, r *http.Request)
- func GetLoggedInUser(w http.ResponseWriter, r *http.Request) string
- func HomeHandler(w http.ResponseWriter, r *http.Request)
- func RandomString(n int) string
- type AccessEntry
- type ActiveSession
- type Config
- type DoorCfg
- type DoorState
- type GoogleUserProfile
- type Oauth2Cfg
- type OauthLogin
- type Timeout
- type Webserver
- type WebserverCfg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClickHandler ¶
func ClickHandler(w http.ResponseWriter, r *http.Request)
ClickHandler handles the homepage and anything matching "/api/{owner}/{device}/{state}" Owner = cj or sj Device = ipad, laptop, or all State = lock or unlock
func GetLoggedInUser ¶
func GetLoggedInUser(w http.ResponseWriter, r *http.Request) string
GetLoggedInUser returns the logged in user or cleans up if youve expired
func HomeHandler ¶
func HomeHandler(w http.ResponseWriter, r *http.Request)
HomeHandler handles the homepage and anything matching "/"
func RandomString ¶
RandomString produces a base64 string (websafe?) from n random bytes
Types ¶
type AccessEntry ¶
type AccessEntry struct { Username string `yaml:"email,omitempty"` GoogleID string `yaml:"googleId,omitempty"` }
AccessEntry populates the access array and allow google id holders to run the services
type ActiveSession ¶
Sessions track valid tokens
type Config ¶
type Config struct { Oauth2 Oauth2Cfg `yaml:"oauth2"` Server WebserverCfg `yaml:"webserver"` Door DoorCfg `yaml:"door"` Testing bool }
Config is the gdo config struct. Its members capture config for sections of the program
type DoorCfg ¶
type DoorCfg struct { ClosedPin int `yaml:"closedPin"` ClosedValue bool `yaml:"closedValue"` ClickRelay int `yaml:"clickRelay"` PiMonitorAddress string `yaml:"pimonitoraddress"` }
DoorCfg configures the door parameters
type DoorState ¶
type DoorState struct { ID string `json:"id"` State string `json:"state"` StateTime time.Time `json:"stateTime"` Asserted bool `json:"asserted,omitempty"` Error string `json:"error,omitempty"` }
DoorState is the exposed door data, serializable
type GoogleUserProfile ¶
type GoogleUserProfile struct { Email string `json:"email"` Verified bool `json:"verified_email"` ID string `json:"id"` Picture string `json:"picture"` }
GoogleUserProfile catches user data
type Oauth2Cfg ¶
type Oauth2Cfg struct { ClientSecret string `yaml:"clientSecret"` ClientID string `yaml:"clientID"` AppName string `yaml:"appName"` Redirect string `yaml:"redirect"` Scopes []string `yaml:"scopes"` Access []AccessEntry `yaml:"access"` }
Oauth2Cfg catptures Oauth configs
type OauthLogin ¶
OauthLogin type for oauth handler
func NewLoginHandler ¶
func NewLoginHandler(next http.Handler) OauthLogin
NewLoginHandler generates a login middleware
func NewLogoutHandler ¶
func NewLogoutHandler(next http.Handler) OauthLogin
NewLogoutHandler generates a login middleware
func (OauthLogin) ServeHTTP ¶
func (l OauthLogin) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP makes OauthLogin a http.Handler
type Timeout ¶
type Timeout struct { Server int `yaml:"server"` Write int `yaml:"write"` Read int `yaml:"read"` Idle int `yaml:"idle"` }
Timeout captures server timeout settings
type Webserver ¶
type Webserver struct { Testing bool // contains filtered or unexported fields }
Webserver is the target object for webserver functions
func NewWebserver ¶
NewWebserver gets a server ready to go
func (*Webserver) ListenAndServe ¶
ListenAndServe to implement http.Server
Directories ¶
Path | Synopsis |
---|---|
Code generated for package data by go-bindata DO NOT EDIT.
|
Code generated for package data by go-bindata DO NOT EDIT. |
Code generated for package staticdata by go-bindata DO NOT EDIT.
|
Code generated for package staticdata by go-bindata DO NOT EDIT. |