Documentation ¶
Index ¶
- type App
- type ByID
- type Server
- func (s *Server) AddApp(w http.ResponseWriter, req *http.Request)
- func (s *Server) DeleteApp(w http.ResponseWriter, req *http.Request)
- func (s *Server) LoadApps() error
- func (s *Server) ProcessApps(w http.ResponseWriter, req *http.Request)
- func (s *Server) SendApps(w http.ResponseWriter, req *http.Request)
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { ID int `json:"id"` Name string `json:"name,omitempty"` // name of the app Icon string `json:"icon,omitempty"` // icon to display Color string `json:"color,omitempty"` // icon's color IsProxy bool `json:"isProxy"` // true if reverse proxy Host string `json:"host"` // to match against request Host header ForwardTo string `json:"forwardTo,omitempty"` // non-empty if reverse proxy Serve string `json:"serve,omitempty"` // non-empty if static server Secured bool `json:"secured"` // true if the handler is secured with auth Login string `json:"login,omitempty"` // Basic auth login for automatic login Password string `json:"password,omitempty"` // Basic auth password for automatic login OpenPath string `json:"openpath,omitempty"` // Opened path on iframe preview Roles []string `json:"roles,omitempty"` // Roles allowed to access the app SecurityHeaders bool `json:"securityheaders,omitempty"` // Inject security headers (CSP, STS, etc.) CachePattern []string `json:"cachepattern,omitempty"` // Cache routes corresponding to that pattern CacheDuration int `json:"cacheduration,omitempty"` // Cache routes for seconds }
App represents a app serving static content proxying a web server
type Server ¶
type Server struct { Mu sync.RWMutex // guards the fields below Apps []*app // contains filtered or unexported fields }
Server implements an http.Handler that acts as either a reverse proxy or a simple file server, as determined by a rule set.
func NewServer ¶
func NewServer(file string, portFromMain int, frameSourceFromMain string, authzFromMain authzFunc) (*Server, error)
NewServer constructs a Server that reads apps from file
func (*Server) AddApp ¶
func (s *Server) AddApp(w http.ResponseWriter, req *http.Request)
AddApp adds an app
func (*Server) DeleteApp ¶
func (s *Server) DeleteApp(w http.ResponseWriter, req *http.Request)
DeleteApp adds an app
func (*Server) LoadApps ¶
LoadApps tests whether file has been modified since its last invocation and, if so, loads the app set from file.
func (*Server) ProcessApps ¶
func (s *Server) ProcessApps(w http.ResponseWriter, req *http.Request)
ProcessApps processes apps regarding of HTTP method
Click to show internal directories.
Click to hide internal directories.