Documentation ¶
Index ¶
- Constants
- func IsFrame(r *bufio.Reader) (bool, error)
- func Session(res *Response) (string, error)
- func StatusText(code int) string
- type Auth
- type Client
- func (c *Client) Describe(endpoint string) (*Response, error)
- func (c *Client) Do(req *Request) (*Response, error)
- func (c *Client) Options(endpoint string) (*Response, error)
- func (c *Client) Play(endpoint, session string) (*Response, error)
- func (c *Client) Setup(endpoint, transport string) (*Response, error)
- func (c *Client) Teardown(endpoint, session string) (*Response, error)
- type Frame
- type Header
- func (h Header) Add(name, value string)
- func (h Header) Clone() Header
- func (h Header) Field(name string, index int) (string, bool)
- func (h Header) Get(name string) string
- func (h Header) Param(name, key string) (string, bool)
- func (h Header) Set(name, value string)
- func (h Header) Write(w io.Writer) error
- type Option
- type Request
- type Response
Constants ¶
const ( MethodAnnounce = "ANNOUNCE" MethodDescribe = "DESCRIBE" MethodGetParameter = "GET_PARAMETER" MethodOptions = "OPTIONS" MethodPause = "PAUSE" MethodPlay = "PLAY" MethodRecord = "RECORD" MethodRedirect = "REDIRECT" MethodSetParameter = "SET_PARAMETER" MethodSetup = "SETUP" MethodTeardown = "TEARDOWN" )
RTSP Verbs
const ( StatusContinue = 100 StatusOK = 200 StatusCreated = 201 StatusLowOnStorageSpace = 250 StatusMultipleChoices = 300 StatusMovedPermanently = 301 StatusMovedTemporarily = 302 StatusSeeOther = 303 StatusNotModified = 304 StatusUseProxy = 305 StatusBadRequest = 400 StatusPaymentRequired = 402 StatusForbidden = 403 StatusNotFound = 404 StatusMethodNotAllowed = 405 StatusNotAcceptable = 406 StatusProxyAuthenticationRequired = 407 StatusRequestTimeout = 408 StatusGone = 410 StatusLengthRequired = 411 StatusPreconditionFailed = 412 StatusRequestEntityTooLarge = 413 StatusRequestURITooLong = 414 StatusUnsupportedMediaType = 415 StatusInvalidparameter = 451 StatusIllegalConferenceIdentifier = 452 StatusNotEnoughBandwidth = 453 StatusSessionNotFound = 454 StatusMethodNotValidInThisState = 455 StatusHeaderFieldNotValid = 456 StatusInvalidRange = 457 StatusParameterIsReadOnly = 458 StatusAggregateOperationNotAllowed = 459 StatusOnlyAggregateOperationAllowed = 460 StatusUnsupportedTransport = 461 StatusDestinationUnreachable = 462 StatusInternalServerError = 500 StatusNotImplemented = 501 StatusBadGateway = 502 StatusGatewayTimeout = 504 StatusRTSPVersionNotSupported = 505 StatusOptionNotsupport = 551 )
RTSP response status codes
Variables ¶
This section is empty.
Functions ¶
func IsFrame ¶ added in v0.3.0
IsFrame returns true when the next message is an interleaved frame. This will block until at least one byte is available in the reader
func StatusText ¶ added in v0.5.0
StatusText returns a text of the RTSP status code. It returns the empty string if the code is unknown
Types ¶
type Auth ¶
type Auth interface { // Authorize the request given the response // This is called once before the request is send with a nil Response // and a second time if the response came back with status code 401 // unauthorized Authorize(*Request, *Response) (bool, error) }
Auth provides a mechanism for authenticating requests. Implementations may be found in the auth subpackage.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client allows sending and recieving rtsp data over a socket connection.
func NewClient ¶
func NewClient(conn io.ReadWriter, options ...Option) *Client
NewClient constructs an rtsp Client wrapping a connection.
type Frame ¶
Frame of interleaved binary data. This is encoded in RTP format.
type Header ¶ added in v0.2.0
Header is a collection of key/value pairs belonging to a request or response.
func ReadHeader ¶ added in v0.2.0
ReadHeader reads headers from the provided reader
func (Header) Field ¶ added in v0.8.0
Field looks up the header by name and returns the field for the provided index. The expected format is field1;field2;field3 ...
func (Header) Get ¶ added in v0.9.0
Get returns the first header value with the provided name. If not found, an empty string is returned.
func (Header) Param ¶ added in v0.8.0
Param looks up the header by name and returns the corresponding value for the provided key. The expected format is key1=value1;key2=value2 ...
type Option ¶
type Option func(*Client)
Option configures a client.
func WithFrameHandler ¶
WithFrameHandler sets a callback for incoming interleaved binary frames.
func WithUserAgent ¶
WithUserAgent specifies the user-agent to be sent with each request.
type Request ¶
Request contains all the information required to send a request
func NewRequest ¶
NewRequest constructs a new request. The endpoint must be an absolute url. The body may be nil.
func ReadRequest ¶
ReadRequest reads and parses an RTSP request from the provided reader.
type Response ¶
Response is a parsed RTSP response.
func NewResponse ¶
NewResponse constructs a new response. The body may be nil.
func ReadResponse ¶
ReadResponse reads and parses an RTSP response from the provided reader.
func (Response) Err ¶ added in v0.8.0
Err returns an error containing the status text if the status code is not 2xx