split configuration into sections

This commit is contained in:
aler9
2021-05-07 15:34:54 +02:00
parent bec905ed9c
commit a8c6af39e3
3 changed files with 75 additions and 25 deletions

View File

@@ -29,15 +29,26 @@ func DialPublish(address string, tracks Tracks) (*ClientConn, error) {
// Client is a RTSP client.
type Client struct {
// the stream protocol (UDP or TCP).
// If nil, it is chosen automatically (first UDP, then, if it fails, TCP).
// It defaults to nil.
StreamProtocol *StreamProtocol
//
// connection
//
// timeout of read operations.
// It defaults to 10 seconds.
ReadTimeout time.Duration
// timeout of write operations.
// It defaults to 10 seconds.
WriteTimeout time.Duration
// a TLS configuration to connect to TLS (RTSPS) servers.
// It defaults to &tls.Config{InsecureSkipVerify:true}
TLSConfig *tls.Config
//
// initialization
//
// disable being redirected to other servers, that can happen during Describe().
// It defaults to false.
RedirectDisable bool
@@ -47,19 +58,20 @@ type Client struct {
// It defaults to false.
AnyPortEnable bool
// timeout of read operations.
// It defaults to 10 seconds.
ReadTimeout time.Duration
//
// reading / writing
//
// the stream protocol (UDP or TCP).
// If nil, it is chosen automatically (first UDP, then, if it fails, TCP).
// It defaults to nil.
StreamProtocol *StreamProtocol
// If the client is reading with UDP, it must receive
// at least a packet within this timeout.
// It defaults to 3 seconds.
InitialUDPReadTimeout time.Duration
// timeout of write operations.
// It defaults to 10 seconds.
WriteTimeout time.Duration
// read buffer count.
// If greater than 1, allows to pass buffers to routines different than the one
// that is reading frames.
@@ -71,12 +83,20 @@ type Client struct {
// It defaults to 2048.
ReadBufferSize int
//
// callbacks
//
// callback called before every request.
OnRequest func(req *base.Request)
// callback called after every response.
OnResponse func(res *base.Response)
//
// system functions
//
// function used to initialize the TCP client.
// It defaults to net.DialTimeout.
DialTimeout func(network, address string, timeout time.Duration) (net.Conn, error)
@@ -85,6 +105,10 @@ type Client struct {
// It defaults to net.ListenPacket.
ListenPacket func(network, address string) (net.PacketConn, error)
//
// private
//
senderReportPeriod time.Duration
receiverReportPeriod time.Duration
}