Documentation ¶
Index ¶
- Variables
- func FileExtensionFromFilePath(fpath string) string
- func FileMimeFromFilePath(fpath string) (string, error)
- func FilePathFromFilename(fname string) string
- func FilePathFromRequest(r *http.Request) string
- func FilePathFromUrl(url string) string
- func HandleInvalidRange(msg string, w http.ResponseWriter, r *http.Request)
- func HandleNotFound(url string, w http.ResponseWriter, r *http.Request)
- func HandleServerError(url string, w http.ResponseWriter, r *http.Request)
- func RedirectHome(url string, w http.ResponseWriter, r *http.Request)
- func StreamDataFilePathFromFilename(fname string) string
- func StreamDataFilePathFromUrl(url string) string
- func StreamDataFilenameFromUrl(url string) string
- type Path
- type PathHandler
- type RoomPathHandler
- type RootPathHandler
- type StreamPathHandler
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ApiRootUrl = "/api" FileRootUrl = "/src/static/" SocketRootUrl = "/ws" RoomRootUrl = "/room" StreamRootUrl = "/stream" RoomRootPrefix = "/v/" RoomRootRegex = "^\\/v\\/.*" StreamRootRegex = "^\\/s\\/.*" StreamDataRootPath = "data" FileRootPath = "pkg/webclient" )
View Source
var ( RootPathUrl = "/" RootPathIndexFile = "index.html" )
View Source
var (
RoomPathIndexFile = "video.html"
)
Functions ¶
func FileMimeFromFilePath ¶
func FilePathFromFilename ¶
func FilePathFromRequest ¶
func FilePathFromUrl ¶
func HandleInvalidRange ¶
func HandleInvalidRange(msg string, w http.ResponseWriter, r *http.Request)
func HandleNotFound ¶
func HandleNotFound(url string, w http.ResponseWriter, r *http.Request)
func HandleServerError ¶
func HandleServerError(url string, w http.ResponseWriter, r *http.Request)
func RedirectHome ¶
func RedirectHome(url string, w http.ResponseWriter, r *http.Request)
func StreamDataFilenameFromUrl ¶
StreamDataFilenameFromUrl receives a stream-formatted request url and returns its last segment, or the original url if the path is malformed.
Types ¶
type Path ¶
type Path interface { // GetUrl returns the fully-qualified url of an http url handler GetUrl() string // Handle receives an http writer and http request and // responds to the request with the appropriate resources / response. // an error is returned if the request is not able to be handled. Handle(string, http.ResponseWriter, *http.Request) error }
Path is an interface representing an http url handler
func NewPathRoom ¶
func NewPathRoom() Path
func NewPathRoot ¶
func NewPathRoot() Path
func NewPathStream ¶
func NewPathStream() Path
type PathHandler ¶
type PathHandler struct {
// contains filtered or unexported fields
}
PathHandler implements Path and provides default path-handling values
func (PathHandler) GetUrl ¶
func (h PathHandler) GetUrl() string
func (PathHandler) Handle ¶
func (h PathHandler) Handle(url string, w http.ResponseWriter, r *http.Request) error
type RoomPathHandler ¶
type RoomPathHandler struct {
*PathHandler
}
RoomPathHandler implements Path and handles all room url requests
func (*RoomPathHandler) Handle ¶
func (h *RoomPathHandler) Handle(url string, w http.ResponseWriter, r *http.Request) error
type RootPathHandler ¶
type RootPathHandler struct {
*PathHandler
}
RootPathHandler implements Path and handles all root url requests
func (*RootPathHandler) Handle ¶
func (h *RootPathHandler) Handle(url string, w http.ResponseWriter, r *http.Request) error
type StreamPathHandler ¶
type StreamPathHandler struct {
*PathHandler
}
RoomPathHandler implements Path and handles all room url requests
func (*StreamPathHandler) Handle ¶
func (h *StreamPathHandler) Handle(url string, w http.ResponseWriter, r *http.Request) error
Click to show internal directories.
Click to hide internal directories.