Documentation
¶
Index ¶
- Constants
- func StartHTTPServer(lc fx.Lifecycle, c *ConnectHandler, address AddressType, ...) *http.Server
- type AddressType
- type AuthBackend
- type ConnectHandler
- func (h *ConnectHandler) AddHandlers(mux *http.ServeMux)
- func (h *ConnectHandler) GetHandler() http.Handler
- func (h *ConnectHandler) HandleCandidate(w http.ResponseWriter, r *http.Request)
- func (h *ConnectHandler) HandleConnect(w http.ResponseWriter, r *http.Request)
- func (h *ConnectHandler) HandleOffer(w http.ResponseWriter, r *http.Request)
- func (h *ConnectHandler) IsAuthorized(r *http.Request, fp string) bool
- type ConnectRequest
Constants ¶
View Source
const SessionTTL = time.Second * 30
Variables ¶
This section is empty.
Functions ¶
func StartHTTPServer ¶
func StartHTTPServer(lc fx.Lifecycle, c *ConnectHandler, address AddressType, logger *zap.SugaredLogger) *http.Server
StartHTTPServer starts a http server that listens to the given address and serves the connect endpoint.
Types ¶
type AddressType ¶
type AddressType string
type AuthBackend ¶
type ConnectHandler ¶
type ConnectHandler struct {
// contains filtered or unexported fields
}
func NewConnectHandler ¶
func NewConnectHandler( backend AuthBackend, conf *peers.Conf, logger *zap.SugaredLogger) *ConnectHandler
func (*ConnectHandler) AddHandlers ¶ added in v1.3.0
func (h *ConnectHandler) AddHandlers(mux *http.ServeMux)
func (*ConnectHandler) GetHandler ¶ added in v1.3.0
func (h *ConnectHandler) GetHandler() http.Handler
func (*ConnectHandler) HandleCandidate ¶ added in v1.3.0
func (h *ConnectHandler) HandleCandidate(w http.ResponseWriter, r *http.Request)
HandleCandidate is called when a client requests the candidate endpoint it should be a patch and the body webrtc's client candidate.
func (*ConnectHandler) HandleConnect ¶
func (h *ConnectHandler) HandleConnect(w http.ResponseWriter, r *http.Request)
HandleConnect is called when a client requests the connect endpoint it should be a post and the body webrtc's client offer. In reponse the handlers send the server's webrtc's offer.
func (*ConnectHandler) HandleOffer ¶ added in v1.3.0
func (h *ConnectHandler) HandleOffer(w http.ResponseWriter, r *http.Request)
HandleOffer is called when a client requests the whip endpoint it should be a post and the body webrtc's client offer. In reponse the handlers send the server's webrtc's offer.
func (*ConnectHandler) IsAuthorized ¶ added in v1.3.0
func (h *ConnectHandler) IsAuthorized(r *http.Request, fp string) bool
type ConnectRequest ¶
type ConnectRequest struct { Fingerprint string `json:"fingerprint"` APIVer int `json:"api_version"` Offer string `json:"offer"` }
ConnectRequest is the schema for the connect POST request
Click to show internal directories.
Click to hide internal directories.