web

package
v0.0.0-...-5d729fc Latest Latest
Warning

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

Go to latest
Published: May 1, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter

func NewRouter(h *Handler, flv *myflv.Server) http.Handler

func StartHTTP

func StartHTTP(name string, addr string, h http.Handler)

Types

type Auth

type Auth struct {
	// contains filtered or unexported fields
}

func NewAuth

func NewAuth() (*Auth, error)

func (*Auth) FromRequest

func (a *Auth) FromRequest(r *http.Request) AuthContext

func (*Auth) IssueToken

func (a *Auth) IssueToken(username string) (string, error)

func (*Auth) ParseToken

func (a *Auth) ParseToken(payload string) (*Token, error)

type AuthContext

type AuthContext struct {
	LoggedIn bool
	Username string
}

func GetAuth

func GetAuth(r *http.Request) AuthContext

type CurrentStream

type CurrentStream struct {
	Name      string
	VideoLink string
	IsLive    bool
	Info      *bcast.WatchInfo
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(cfg *conf.App, render *Render, auth *Auth, chat *rtchat.Server, streams Streams) *Handler

func (*Handler) AuthMiddleware

func (h *Handler) AuthMiddleware(next http.Handler) http.Handler

func (*Handler) ChatSend

func (h *Handler) ChatSend(w http.ResponseWriter, r *http.Request)

func (*Handler) ChatSubscribe

func (h *Handler) ChatSubscribe(conn *websocket.Conn)

func (*Handler) DoLogout

func (h *Handler) DoLogout(w http.ResponseWriter, r *http.Request)

func (*Handler) DoSignIn

func (h *Handler) DoSignIn(w http.ResponseWriter, r *http.Request)

func (*Handler) MainPage

func (h *Handler) MainPage(w http.ResponseWriter, r *http.Request)

func (*Handler) SignIn

func (h *Handler) SignIn(w http.ResponseWriter, r *http.Request)

func (*Handler) Static

func (h *Handler) Static(w http.ResponseWriter, r *http.Request)

func (*Handler) WatchStream

func (h *Handler) WatchStream(w http.ResponseWriter, r *http.Request)

type Render

type Render struct {
	// contains filtered or unexported fields
}

func NewRender

func NewRender() (*Render, error)

func (*Render) Main

func (r *Render) Main(w http.ResponseWriter, data RenderContext)

func (*Render) SignIn

func (r *Render) SignIn(w http.ResponseWriter)

func (*Render) Stream

func (r *Render) Stream(w http.ResponseWriter, data RenderContext)

type RenderContext

type RenderContext struct {
	Auth      AuthContext
	Stream    CurrentStream
	SetupInfo *bcast.SetupInfo
}

type Streams

type Streams interface {
	SetupInfo(username string) *bcast.SetupInfo
	WatchInfo(req bcast.WatchRequest) *bcast.WatchInfo
}

type Token

type Token struct {
	Username string
}

Jump to

Keyboard shortcuts

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