mirror of
https://github.com/aler9/gortsplib
synced 2025-09-27 19:42:11 +08:00
rename Transport* into Protocol* (#895)
This commit is contained in:
46
client.go
46
client.go
@@ -446,10 +446,10 @@ type Client struct {
|
|||||||
// timeout of write operations.
|
// timeout of write operations.
|
||||||
// It defaults to 10 seconds.
|
// It defaults to 10 seconds.
|
||||||
WriteTimeout time.Duration
|
WriteTimeout time.Duration
|
||||||
// a TLS configuration to connect to TLS (RTSPS) servers.
|
// a TLS configuration to connect to TLS/RTSPS servers.
|
||||||
// It defaults to nil.
|
// It defaults to nil.
|
||||||
TLSConfig *tls.Config
|
TLSConfig *tls.Config
|
||||||
// tunnel.
|
// tunneling method.
|
||||||
Tunnel Tunnel
|
Tunnel Tunnel
|
||||||
// transport protocol (UDP, Multicast or TCP).
|
// transport protocol (UDP, Multicast or TCP).
|
||||||
// If nil, it is chosen automatically (first UDP, then, if it fails, TCP).
|
// If nil, it is chosen automatically (first UDP, then, if it fails, TCP).
|
||||||
@@ -985,7 +985,7 @@ func (c *Client) trySwitchingProtocol() error {
|
|||||||
c.reset()
|
c.reset()
|
||||||
|
|
||||||
c.setuppedTransport = &SessionTransport{
|
c.setuppedTransport = &SessionTransport{
|
||||||
Protocol: TransportTCP,
|
Protocol: ProtocolTCP,
|
||||||
}
|
}
|
||||||
|
|
||||||
// some Hikvision cameras require a describe before a setup
|
// some Hikvision cameras require a describe before a setup
|
||||||
@@ -1022,23 +1022,23 @@ func (c *Client) startTransportRoutines() {
|
|||||||
cm.start()
|
cm.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.setuppedTransport.Protocol == TransportTCP {
|
if c.setuppedTransport.Protocol == ProtocolTCP {
|
||||||
c.tcpFrame = &base.InterleavedFrame{}
|
c.tcpFrame = &base.InterleavedFrame{}
|
||||||
c.tcpBuffer = make([]byte, c.MaxPacketSize+4)
|
c.tcpBuffer = make([]byte, c.MaxPacketSize+4)
|
||||||
}
|
}
|
||||||
|
|
||||||
// always enable keepalives unless we are recording with TCP
|
// always enable keepalives unless we are recording with TCP
|
||||||
if c.state == clientStatePlay || c.setuppedTransport.Protocol != TransportTCP {
|
if c.state == clientStatePlay || c.setuppedTransport.Protocol != ProtocolTCP {
|
||||||
c.keepAliveTimer = time.NewTimer(c.keepAlivePeriod)
|
c.keepAliveTimer = time.NewTimer(c.keepAlivePeriod)
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.state == clientStatePlay && c.stdChannelSetupped {
|
if c.state == clientStatePlay && c.stdChannelSetupped {
|
||||||
switch c.setuppedTransport.Protocol {
|
switch c.setuppedTransport.Protocol {
|
||||||
case TransportUDP:
|
case ProtocolUDP:
|
||||||
c.checkTimeoutTimer = time.NewTimer(c.InitialUDPReadTimeout)
|
c.checkTimeoutTimer = time.NewTimer(c.InitialUDPReadTimeout)
|
||||||
c.checkTimeoutInitial = true
|
c.checkTimeoutInitial = true
|
||||||
|
|
||||||
case TransportUDPMulticast:
|
case ProtocolUDPMulticast:
|
||||||
c.checkTimeoutTimer = time.NewTimer(c.checkTimeoutPeriod)
|
c.checkTimeoutTimer = time.NewTimer(c.checkTimeoutPeriod)
|
||||||
|
|
||||||
default: // TCP
|
default: // TCP
|
||||||
@@ -1048,7 +1048,7 @@ func (c *Client) startTransportRoutines() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.setuppedTransport.Protocol == TransportTCP {
|
if c.setuppedTransport.Protocol == ProtocolTCP {
|
||||||
c.reader.setAllowInterleavedFrames(true)
|
c.reader.setAllowInterleavedFrames(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1284,8 +1284,8 @@ func (c *Client) isInTCPTimeout() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) doCheckTimeout() error {
|
func (c *Client) doCheckTimeout() error {
|
||||||
if c.setuppedTransport.Protocol == TransportUDP ||
|
if c.setuppedTransport.Protocol == ProtocolUDP ||
|
||||||
c.setuppedTransport.Protocol == TransportUDPMulticast {
|
c.setuppedTransport.Protocol == ProtocolUDPMulticast {
|
||||||
if c.checkTimeoutInitial && !c.backChannelSetupped && c.Protocol == nil {
|
if c.checkTimeoutInitial && !c.backChannelSetupped && c.Protocol == nil {
|
||||||
c.checkTimeoutInitial = false
|
c.checkTimeoutInitial = false
|
||||||
|
|
||||||
@@ -1491,7 +1491,7 @@ func (c *Client) doAnnounce(u *base.URL, desc *description.Session) (*base.Respo
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Protocol != nil && *c.Protocol == TransportUDPMulticast {
|
if c.Protocol != nil && *c.Protocol == ProtocolUDPMulticast {
|
||||||
return nil, fmt.Errorf("recording with UDP multicast is not supported")
|
return nil, fmt.Errorf("recording with UDP multicast is not supported")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1613,9 +1613,9 @@ func (c *Client) doSetup(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if c.Tunnel == TunnelNone && (th.Profile == headers.TransportProfileSAVP || c.Scheme == "rtsp") {
|
if c.Tunnel == TunnelNone && (th.Profile == headers.TransportProfileSAVP || c.Scheme == "rtsp") {
|
||||||
protocol = TransportUDP
|
protocol = ProtocolUDP
|
||||||
} else {
|
} else {
|
||||||
protocol = TransportTCP
|
protocol = ProtocolTCP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1652,14 +1652,14 @@ func (c *Client) doSetup(
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
switch protocol {
|
switch protocol {
|
||||||
case TransportUDP, TransportUDPMulticast:
|
case ProtocolUDP, ProtocolUDPMulticast:
|
||||||
if c.Scheme == "rtsps" && !isSecure(th.Profile) {
|
if c.Scheme == "rtsps" && !isSecure(th.Profile) {
|
||||||
return nil, fmt.Errorf("unable to setup secure UDP")
|
return nil, fmt.Errorf("unable to setup secure UDP")
|
||||||
}
|
}
|
||||||
|
|
||||||
th.Protocol = headers.TransportProtocolUDP
|
th.Protocol = headers.TransportProtocolUDP
|
||||||
|
|
||||||
if protocol == TransportUDP {
|
if protocol == ProtocolUDP {
|
||||||
if (rtpPort == 0 && rtcpPort != 0) ||
|
if (rtpPort == 0 && rtcpPort != 0) ||
|
||||||
(rtpPort != 0 && rtcpPort == 0) {
|
(rtpPort != 0 && rtcpPort == 0) {
|
||||||
return nil, liberrors.ErrClientUDPPortsZero{}
|
return nil, liberrors.ErrClientUDPPortsZero{}
|
||||||
@@ -1688,7 +1688,7 @@ func (c *Client) doSetup(
|
|||||||
th.Delivery = &v1
|
th.Delivery = &v1
|
||||||
}
|
}
|
||||||
|
|
||||||
case TransportTCP:
|
case ProtocolTCP:
|
||||||
v1 := headers.TransportDeliveryUnicast
|
v1 := headers.TransportDeliveryUnicast
|
||||||
th.Delivery = &v1
|
th.Delivery = &v1
|
||||||
th.Protocol = headers.TransportProtocolTCP
|
th.Protocol = headers.TransportProtocolTCP
|
||||||
@@ -1768,7 +1768,7 @@ func (c *Client) doSetup(
|
|||||||
c.setuppedTransport == nil && c.Protocol == nil {
|
c.setuppedTransport == nil && c.Protocol == nil {
|
||||||
c.OnTransportSwitch(liberrors.ErrClientSwitchToTCP2{})
|
c.OnTransportSwitch(liberrors.ErrClientSwitchToTCP2{})
|
||||||
c.setuppedTransport = &SessionTransport{
|
c.setuppedTransport = &SessionTransport{
|
||||||
Protocol: TransportTCP,
|
Protocol: ProtocolTCP,
|
||||||
Profile: th.Profile,
|
Profile: th.Profile,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1785,7 +1785,7 @@ func (c *Client) doSetup(
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch protocol {
|
switch protocol {
|
||||||
case TransportUDP, TransportUDPMulticast:
|
case ProtocolUDP, ProtocolUDPMulticast:
|
||||||
if thRes.Protocol == headers.TransportProtocolTCP {
|
if thRes.Protocol == headers.TransportProtocolTCP {
|
||||||
// switch transport automatically
|
// switch transport automatically
|
||||||
if c.setuppedTransport == nil && c.Protocol == nil {
|
if c.setuppedTransport == nil && c.Protocol == nil {
|
||||||
@@ -1796,7 +1796,7 @@ func (c *Client) doSetup(
|
|||||||
c.reset()
|
c.reset()
|
||||||
|
|
||||||
c.setuppedTransport = &SessionTransport{
|
c.setuppedTransport = &SessionTransport{
|
||||||
Protocol: TransportTCP,
|
Protocol: ProtocolTCP,
|
||||||
Profile: th.Profile,
|
Profile: th.Profile,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1814,7 +1814,7 @@ func (c *Client) doSetup(
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch protocol {
|
switch protocol {
|
||||||
case TransportUDP:
|
case ProtocolUDP:
|
||||||
if thRes.Delivery != nil && *thRes.Delivery != headers.TransportDeliveryUnicast {
|
if thRes.Delivery != nil && *thRes.Delivery != headers.TransportDeliveryUnicast {
|
||||||
return nil, liberrors.ErrClientTransportHeaderInvalidDelivery{}
|
return nil, liberrors.ErrClientTransportHeaderInvalidDelivery{}
|
||||||
}
|
}
|
||||||
@@ -1865,7 +1865,7 @@ func (c *Client) doSetup(
|
|||||||
}
|
}
|
||||||
udpRTCPListener.readIP = remoteIP
|
udpRTCPListener.readIP = remoteIP
|
||||||
|
|
||||||
case TransportUDPMulticast:
|
case ProtocolUDPMulticast:
|
||||||
if thRes.Delivery == nil || *thRes.Delivery != headers.TransportDeliveryMulticast {
|
if thRes.Delivery == nil || *thRes.Delivery != headers.TransportDeliveryMulticast {
|
||||||
return nil, liberrors.ErrClientTransportHeaderInvalidDelivery{}
|
return nil, liberrors.ErrClientTransportHeaderInvalidDelivery{}
|
||||||
}
|
}
|
||||||
@@ -1936,7 +1936,7 @@ func (c *Client) doSetup(
|
|||||||
Port: thRes.Ports[1],
|
Port: thRes.Ports[1],
|
||||||
}
|
}
|
||||||
|
|
||||||
case TransportTCP:
|
case ProtocolTCP:
|
||||||
if thRes.Protocol != headers.TransportProtocolTCP {
|
if thRes.Protocol != headers.TransportProtocolTCP {
|
||||||
return nil, liberrors.ErrClientServerRequestedUDP{}
|
return nil, liberrors.ErrClientServerRequestedUDP{}
|
||||||
}
|
}
|
||||||
@@ -2128,7 +2128,7 @@ func (c *Client) doPlay(ra *headers.Range) (*base.Response, error) {
|
|||||||
// when protocol is UDP,
|
// when protocol is UDP,
|
||||||
// open the firewall by sending empty packets to the remote part.
|
// open the firewall by sending empty packets to the remote part.
|
||||||
// do this before sending the PLAY request.
|
// do this before sending the PLAY request.
|
||||||
if c.setuppedTransport.Protocol == TransportUDP {
|
if c.setuppedTransport.Protocol == ProtocolUDP {
|
||||||
for _, cm := range c.setuppedMedias {
|
for _, cm := range c.setuppedMedias {
|
||||||
if !cm.media.IsBackChannel && cm.udpRTPListener.writeAddr != nil {
|
if !cm.media.IsBackChannel && cm.udpRTPListener.writeAddr != nil {
|
||||||
buf, _ := (&rtp.Packet{Header: rtp.Header{Version: 2}}).Marshal()
|
buf, _ := (&rtp.Packet{Header: rtp.Header{Version: 2}}).Marshal()
|
||||||
|
@@ -610,15 +610,15 @@ func TestClientPlay(t *testing.T) {
|
|||||||
Protocol: func() *Protocol {
|
Protocol: func() *Protocol {
|
||||||
switch ca.transport {
|
switch ca.transport {
|
||||||
case "udp":
|
case "udp":
|
||||||
v := TransportUDP
|
v := ProtocolUDP
|
||||||
return &v
|
return &v
|
||||||
|
|
||||||
case "multicast":
|
case "multicast":
|
||||||
v := TransportUDPMulticast
|
v := ProtocolUDPMulticast
|
||||||
return &v
|
return &v
|
||||||
|
|
||||||
default: // tcp
|
default: // tcp
|
||||||
v := TransportTCP
|
v := ProtocolTCP
|
||||||
return &v
|
return &v
|
||||||
}
|
}
|
||||||
}(),
|
}(),
|
||||||
@@ -1041,7 +1041,7 @@ func TestClientPlayPartial(t *testing.T) {
|
|||||||
c := Client{
|
c := Client{
|
||||||
Scheme: u.Scheme,
|
Scheme: u.Scheme,
|
||||||
Host: u.Host,
|
Host: u.Host,
|
||||||
Protocol: ptrOf(TransportTCP),
|
Protocol: ptrOf(ProtocolTCP),
|
||||||
}
|
}
|
||||||
|
|
||||||
err = c.Start()
|
err = c.Start()
|
||||||
@@ -1987,7 +1987,7 @@ func TestClientPlayDifferentInterleavedIDs(t *testing.T) {
|
|||||||
packetRecv := make(chan struct{})
|
packetRecv := make(chan struct{})
|
||||||
|
|
||||||
c := Client{
|
c := Client{
|
||||||
Protocol: ptrOf(TransportTCP),
|
Protocol: ptrOf(ProtocolTCP),
|
||||||
}
|
}
|
||||||
|
|
||||||
err = readAll(&c, "rtsp://localhost:8554/teststream",
|
err = readAll(&c, "rtsp://localhost:8554/teststream",
|
||||||
@@ -2423,10 +2423,10 @@ func TestClientPlayPausePlay(t *testing.T) {
|
|||||||
c := Client{
|
c := Client{
|
||||||
Protocol: func() *Protocol {
|
Protocol: func() *Protocol {
|
||||||
if transport == "udp" {
|
if transport == "udp" {
|
||||||
v := TransportUDP
|
v := ProtocolUDP
|
||||||
return &v
|
return &v
|
||||||
}
|
}
|
||||||
v := TransportTCP
|
v := ProtocolTCP
|
||||||
return &v
|
return &v
|
||||||
}(),
|
}(),
|
||||||
}
|
}
|
||||||
@@ -2743,11 +2743,11 @@ func TestClientPlayErrorTimeout(t *testing.T) {
|
|||||||
Protocol: func() *Protocol {
|
Protocol: func() *Protocol {
|
||||||
switch transport {
|
switch transport {
|
||||||
case "udp":
|
case "udp":
|
||||||
v := TransportUDP
|
v := ProtocolUDP
|
||||||
return &v
|
return &v
|
||||||
|
|
||||||
case "tcp":
|
case "tcp":
|
||||||
v := TransportTCP
|
v := ProtocolTCP
|
||||||
return &v
|
return &v
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@@ -2876,7 +2876,7 @@ func TestClientPlayIgnoreTCPInvalidMedia(t *testing.T) {
|
|||||||
recv := make(chan struct{})
|
recv := make(chan struct{})
|
||||||
|
|
||||||
c := Client{
|
c := Client{
|
||||||
Protocol: ptrOf(TransportTCP),
|
Protocol: ptrOf(ProtocolTCP),
|
||||||
}
|
}
|
||||||
|
|
||||||
err = readAll(&c, "rtsp://localhost:8554/teststream",
|
err = readAll(&c, "rtsp://localhost:8554/teststream",
|
||||||
@@ -3027,7 +3027,7 @@ func TestClientPlayKeepAlive(t *testing.T) {
|
|||||||
n := 0
|
n := 0
|
||||||
m := 0
|
m := 0
|
||||||
|
|
||||||
v := TransportTCP
|
v := ProtocolTCP
|
||||||
c := Client{
|
c := Client{
|
||||||
Protocol: &v,
|
Protocol: &v,
|
||||||
OnResponse: func(_ *base.Response) {
|
OnResponse: func(_ *base.Response) {
|
||||||
@@ -3174,7 +3174,7 @@ func TestClientPlayDifferentSource(t *testing.T) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
c := Client{
|
c := Client{
|
||||||
Protocol: ptrOf(TransportUDP),
|
Protocol: ptrOf(ProtocolUDP),
|
||||||
}
|
}
|
||||||
|
|
||||||
err = readAll(&c, "rtsp://localhost:8554/test/stream?param=value",
|
err = readAll(&c, "rtsp://localhost:8554/test/stream?param=value",
|
||||||
@@ -3420,10 +3420,10 @@ func TestClientPlayDecodeErrors(t *testing.T) {
|
|||||||
c := Client{
|
c := Client{
|
||||||
Protocol: func() *Protocol {
|
Protocol: func() *Protocol {
|
||||||
if ca.proto == "udp" {
|
if ca.proto == "udp" {
|
||||||
v := TransportUDP
|
v := ProtocolUDP
|
||||||
return &v
|
return &v
|
||||||
}
|
}
|
||||||
v := TransportTCP
|
v := ProtocolTCP
|
||||||
return &v
|
return &v
|
||||||
}(),
|
}(),
|
||||||
OnPacketsLost: func(lost uint64) {
|
OnPacketsLost: func(lost uint64) {
|
||||||
@@ -3904,9 +3904,9 @@ func TestClientPlayBackChannel(t *testing.T) {
|
|||||||
RequestBackChannels: true,
|
RequestBackChannels: true,
|
||||||
Protocol: func() *Protocol {
|
Protocol: func() *Protocol {
|
||||||
if transport == "tcp" {
|
if transport == "tcp" {
|
||||||
return ptrOf(TransportTCP)
|
return ptrOf(ProtocolTCP)
|
||||||
}
|
}
|
||||||
return ptrOf(TransportUDP)
|
return ptrOf(ProtocolUDP)
|
||||||
}(),
|
}(),
|
||||||
senderReportPeriod: 500 * time.Millisecond,
|
senderReportPeriod: 500 * time.Millisecond,
|
||||||
receiverReportPeriod: 750 * time.Millisecond,
|
receiverReportPeriod: 750 * time.Millisecond,
|
||||||
|
@@ -419,10 +419,10 @@ func TestClientRecord(t *testing.T) {
|
|||||||
},
|
},
|
||||||
Protocol: func() *Protocol {
|
Protocol: func() *Protocol {
|
||||||
if ca.transport == "udp" {
|
if ca.transport == "udp" {
|
||||||
v := TransportUDP
|
v := ProtocolUDP
|
||||||
return &v
|
return &v
|
||||||
}
|
}
|
||||||
v := TransportTCP
|
v := ProtocolTCP
|
||||||
return &v
|
return &v
|
||||||
}(),
|
}(),
|
||||||
}
|
}
|
||||||
@@ -589,10 +589,10 @@ func TestClientRecordSocketError(t *testing.T) {
|
|||||||
},
|
},
|
||||||
Protocol: func() *Protocol {
|
Protocol: func() *Protocol {
|
||||||
if transport == "udp" {
|
if transport == "udp" {
|
||||||
v := TransportUDP
|
v := ProtocolUDP
|
||||||
return &v
|
return &v
|
||||||
}
|
}
|
||||||
v := TransportTCP
|
v := ProtocolTCP
|
||||||
return &v
|
return &v
|
||||||
}(),
|
}(),
|
||||||
}
|
}
|
||||||
@@ -733,10 +733,10 @@ func TestClientRecordPauseRecordSerial(t *testing.T) {
|
|||||||
c := Client{
|
c := Client{
|
||||||
Protocol: func() *Protocol {
|
Protocol: func() *Protocol {
|
||||||
if transport == "udp" {
|
if transport == "udp" {
|
||||||
v := TransportUDP
|
v := ProtocolUDP
|
||||||
return &v
|
return &v
|
||||||
}
|
}
|
||||||
v := TransportTCP
|
v := ProtocolTCP
|
||||||
return &v
|
return &v
|
||||||
}(),
|
}(),
|
||||||
}
|
}
|
||||||
@@ -892,10 +892,10 @@ func TestClientRecordPauseRecordParallel(t *testing.T) {
|
|||||||
c := Client{
|
c := Client{
|
||||||
Protocol: func() *Protocol {
|
Protocol: func() *Protocol {
|
||||||
if transport == "udp" {
|
if transport == "udp" {
|
||||||
v := TransportUDP
|
v := ProtocolUDP
|
||||||
return &v
|
return &v
|
||||||
}
|
}
|
||||||
v := TransportTCP
|
v := ProtocolTCP
|
||||||
return &v
|
return &v
|
||||||
}(),
|
}(),
|
||||||
}
|
}
|
||||||
@@ -1217,10 +1217,10 @@ func TestClientRecordDecodeErrors(t *testing.T) {
|
|||||||
c := Client{
|
c := Client{
|
||||||
Protocol: func() *Protocol {
|
Protocol: func() *Protocol {
|
||||||
if ca.proto == "udp" {
|
if ca.proto == "udp" {
|
||||||
v := TransportUDP
|
v := ProtocolUDP
|
||||||
return &v
|
return &v
|
||||||
}
|
}
|
||||||
v := TransportTCP
|
v := ProtocolTCP
|
||||||
return &v
|
return &v
|
||||||
}(),
|
}(),
|
||||||
OnDecodeError: func(err error) {
|
OnDecodeError: func(err error) {
|
||||||
@@ -1391,10 +1391,10 @@ func TestClientRecordRTCPReport(t *testing.T) {
|
|||||||
c := Client{
|
c := Client{
|
||||||
Protocol: func() *Protocol {
|
Protocol: func() *Protocol {
|
||||||
if ca == "udp" {
|
if ca == "udp" {
|
||||||
v := TransportUDP
|
v := ProtocolUDP
|
||||||
return &v
|
return &v
|
||||||
}
|
}
|
||||||
v := TransportTCP
|
v := ProtocolTCP
|
||||||
return &v
|
return &v
|
||||||
}(),
|
}(),
|
||||||
timeNow: func() time.Time {
|
timeNow: func() time.Time {
|
||||||
@@ -1536,7 +1536,7 @@ func TestClientRecordIgnoreTCPRTPPackets(t *testing.T) {
|
|||||||
rtcpReceived := make(chan struct{})
|
rtcpReceived := make(chan struct{})
|
||||||
|
|
||||||
c := Client{
|
c := Client{
|
||||||
Protocol: ptrOf(TransportTCP),
|
Protocol: ptrOf(ProtocolTCP),
|
||||||
}
|
}
|
||||||
|
|
||||||
medias := []*description.Media{testH264Media}
|
medias := []*description.Media{testH264Media}
|
||||||
|
@@ -28,6 +28,8 @@ func main() {
|
|||||||
c := gortsplib.Client{
|
c := gortsplib.Client{
|
||||||
Scheme: u.Scheme,
|
Scheme: u.Scheme,
|
||||||
Host: u.Host,
|
Host: u.Host,
|
||||||
|
// tunneling method.
|
||||||
|
Tunnel: gortsplib.TunnelNone,
|
||||||
// transport protocol (UDP, Multicast or TCP). If nil, it is chosen automatically
|
// transport protocol (UDP, Multicast or TCP). If nil, it is chosen automatically
|
||||||
Protocol: nil,
|
Protocol: nil,
|
||||||
// timeout of read operations
|
// timeout of read operations
|
||||||
|
@@ -175,9 +175,9 @@ func TestClientVsServer(t *testing.T) {
|
|||||||
var publisherProto gortsplib.Protocol
|
var publisherProto gortsplib.Protocol
|
||||||
switch ca.publisherProto {
|
switch ca.publisherProto {
|
||||||
case "udp":
|
case "udp":
|
||||||
publisherProto = gortsplib.TransportUDP
|
publisherProto = gortsplib.ProtocolUDP
|
||||||
case "tcp":
|
case "tcp":
|
||||||
publisherProto = gortsplib.TransportTCP
|
publisherProto = gortsplib.ProtocolTCP
|
||||||
}
|
}
|
||||||
|
|
||||||
publisher := &gortsplib.Client{
|
publisher := &gortsplib.Client{
|
||||||
@@ -201,11 +201,11 @@ func TestClientVsServer(t *testing.T) {
|
|||||||
var readerProto gortsplib.Protocol
|
var readerProto gortsplib.Protocol
|
||||||
switch ca.readerProto {
|
switch ca.readerProto {
|
||||||
case "udp":
|
case "udp":
|
||||||
readerProto = gortsplib.TransportUDP
|
readerProto = gortsplib.ProtocolUDP
|
||||||
case "tcp":
|
case "tcp":
|
||||||
readerProto = gortsplib.TransportTCP
|
readerProto = gortsplib.ProtocolTCP
|
||||||
case "multicast":
|
case "multicast":
|
||||||
readerProto = gortsplib.TransportUDPMulticast
|
readerProto = gortsplib.ProtocolUDPMulticast
|
||||||
}
|
}
|
||||||
|
|
||||||
u, err := base.ParseURL(ca.readerScheme + "://" + multicastCapableIP(t) + ":8554/test/stream?key=val")
|
u, err := base.ParseURL(ca.readerScheme + "://" + multicastCapableIP(t) + ":8554/test/stream?key=val")
|
||||||
|
@@ -682,13 +682,13 @@ func TestServerPlay(t *testing.T) {
|
|||||||
var proto Protocol
|
var proto Protocol
|
||||||
switch ca.transport {
|
switch ca.transport {
|
||||||
case "udp":
|
case "udp":
|
||||||
proto = TransportUDP
|
proto = ProtocolUDP
|
||||||
|
|
||||||
case "tcp":
|
case "tcp":
|
||||||
proto = TransportTCP
|
proto = ProtocolTCP
|
||||||
|
|
||||||
case "multicast":
|
case "multicast":
|
||||||
proto = TransportUDPMulticast
|
proto = ProtocolUDPMulticast
|
||||||
}
|
}
|
||||||
|
|
||||||
var profile headers.TransportProfile
|
var profile headers.TransportProfile
|
||||||
|
@@ -624,10 +624,10 @@ func TestServerRecord(t *testing.T) {
|
|||||||
var proto Protocol
|
var proto Protocol
|
||||||
switch ca.transport {
|
switch ca.transport {
|
||||||
case "udp":
|
case "udp":
|
||||||
proto = TransportUDP
|
proto = ProtocolUDP
|
||||||
|
|
||||||
case "tcp":
|
case "tcp":
|
||||||
proto = TransportTCP
|
proto = ProtocolTCP
|
||||||
}
|
}
|
||||||
|
|
||||||
var profile headers.TransportProfile
|
var profile headers.TransportProfile
|
||||||
|
@@ -885,8 +885,8 @@ func (ss *ServerSession) runInner() error {
|
|||||||
// and transport is UDP or UDP-multicast.
|
// and transport is UDP or UDP-multicast.
|
||||||
if (ss.state == ServerSessionStatePrePlay ||
|
if (ss.state == ServerSessionStatePrePlay ||
|
||||||
ss.state == ServerSessionStatePlay) &&
|
ss.state == ServerSessionStatePlay) &&
|
||||||
(ss.setuppedTransport.Protocol == TransportUDP ||
|
(ss.setuppedTransport.Protocol == ProtocolUDP ||
|
||||||
ss.setuppedTransport.Protocol == TransportUDPMulticast) {
|
ss.setuppedTransport.Protocol == ProtocolUDPMulticast) {
|
||||||
v := uint(ss.s.sessionTimeout / time.Second)
|
v := uint(ss.s.sessionTimeout / time.Second)
|
||||||
return &v
|
return &v
|
||||||
}
|
}
|
||||||
@@ -922,7 +922,7 @@ func (ss *ServerSession) runInner() error {
|
|||||||
// close the session.
|
// close the session.
|
||||||
if ((ss.state != ServerSessionStateRecord &&
|
if ((ss.state != ServerSessionStateRecord &&
|
||||||
ss.state != ServerSessionStatePlay) ||
|
ss.state != ServerSessionStatePlay) ||
|
||||||
ss.setuppedTransport.Protocol == TransportTCP) &&
|
ss.setuppedTransport.Protocol == ProtocolTCP) &&
|
||||||
len(ss.conns) == 0 {
|
len(ss.conns) == 0 {
|
||||||
return liberrors.ErrServerSessionNotInUse{}
|
return liberrors.ErrServerSessionNotInUse{}
|
||||||
}
|
}
|
||||||
@@ -930,7 +930,7 @@ func (ss *ServerSession) runInner() error {
|
|||||||
case <-ss.chAsyncStartWriter:
|
case <-ss.chAsyncStartWriter:
|
||||||
if (ss.state == ServerSessionStateRecord ||
|
if (ss.state == ServerSessionStateRecord ||
|
||||||
ss.state == ServerSessionStatePlay) &&
|
ss.state == ServerSessionStatePlay) &&
|
||||||
ss.setuppedTransport.Protocol == TransportTCP {
|
ss.setuppedTransport.Protocol == ProtocolTCP {
|
||||||
ss.startWriter()
|
ss.startWriter()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1134,13 +1134,13 @@ func (ss *ServerSession) handleRequestInner(sc *ServerConn, req *base.Request) (
|
|||||||
switch inTH.Protocol {
|
switch inTH.Protocol {
|
||||||
case headers.TransportProtocolUDP:
|
case headers.TransportProtocolUDP:
|
||||||
if inTH.Delivery != nil && *inTH.Delivery == headers.TransportDeliveryMulticast {
|
if inTH.Delivery != nil && *inTH.Delivery == headers.TransportDeliveryMulticast {
|
||||||
protocol = TransportUDPMulticast
|
protocol = ProtocolUDPMulticast
|
||||||
} else {
|
} else {
|
||||||
protocol = TransportUDP
|
protocol = ProtocolUDP
|
||||||
}
|
}
|
||||||
|
|
||||||
case headers.TransportProtocolTCP:
|
case headers.TransportProtocolTCP:
|
||||||
protocol = TransportTCP
|
protocol = ProtocolTCP
|
||||||
}
|
}
|
||||||
|
|
||||||
var srtpInCtx *wrappedSRTPContext
|
var srtpInCtx *wrappedSRTPContext
|
||||||
@@ -1176,14 +1176,14 @@ func (ss *ServerSession) handleRequestInner(sc *ServerConn, req *base.Request) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch protocol {
|
switch protocol {
|
||||||
case TransportUDP:
|
case ProtocolUDP:
|
||||||
if inTH.ClientPorts == nil {
|
if inTH.ClientPorts == nil {
|
||||||
return &base.Response{
|
return &base.Response{
|
||||||
StatusCode: base.StatusBadRequest,
|
StatusCode: base.StatusBadRequest,
|
||||||
}, liberrors.ErrServerTransportHeaderNoClientPorts{}
|
}, liberrors.ErrServerTransportHeaderNoClientPorts{}
|
||||||
}
|
}
|
||||||
|
|
||||||
case TransportTCP:
|
case ProtocolTCP:
|
||||||
if inTH.InterleavedIDs != nil {
|
if inTH.InterleavedIDs != nil {
|
||||||
if (inTH.InterleavedIDs[0] + 1) != inTH.InterleavedIDs[1] {
|
if (inTH.InterleavedIDs[0] + 1) != inTH.InterleavedIDs[1] {
|
||||||
return &base.Response{
|
return &base.Response{
|
||||||
@@ -1208,7 +1208,7 @@ func (ss *ServerSession) handleRequestInner(sc *ServerConn, req *base.Request) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
default: // record
|
default: // record
|
||||||
if protocol == TransportUDPMulticast {
|
if protocol == ProtocolUDPMulticast {
|
||||||
return &base.Response{
|
return &base.Response{
|
||||||
StatusCode: base.StatusUnsupportedTransport,
|
StatusCode: base.StatusUnsupportedTransport,
|
||||||
}, nil
|
}, nil
|
||||||
@@ -1363,10 +1363,10 @@ func (ss *ServerSession) handleRequestInner(sc *ServerConn, req *base.Request) (
|
|||||||
var tcpChannel int
|
var tcpChannel int
|
||||||
|
|
||||||
switch protocol {
|
switch protocol {
|
||||||
case TransportUDP, TransportUDPMulticast:
|
case ProtocolUDP, ProtocolUDPMulticast:
|
||||||
th.Protocol = headers.TransportProtocolUDP
|
th.Protocol = headers.TransportProtocolUDP
|
||||||
|
|
||||||
if protocol == TransportUDP {
|
if protocol == ProtocolUDP {
|
||||||
udpRTPReadPort = inTH.ClientPorts[0]
|
udpRTPReadPort = inTH.ClientPorts[0]
|
||||||
udpRTCPReadPort = inTH.ClientPorts[1]
|
udpRTCPReadPort = inTH.ClientPorts[1]
|
||||||
|
|
||||||
@@ -1496,7 +1496,7 @@ func (ss *ServerSession) handleRequestInner(sc *ServerConn, req *base.Request) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ss.state != ServerSessionStatePlay &&
|
if ss.state != ServerSessionStatePlay &&
|
||||||
ss.setuppedTransport.Protocol != TransportUDPMulticast {
|
ss.setuppedTransport.Protocol != ProtocolUDPMulticast {
|
||||||
ss.createWriter()
|
ss.createWriter()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1529,17 +1529,17 @@ func (ss *ServerSession) handleRequestInner(sc *ServerConn, req *base.Request) (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ss.setuppedTransport.Protocol == TransportTCP {
|
if ss.setuppedTransport.Protocol == ProtocolTCP {
|
||||||
ss.tcpFrame = &base.InterleavedFrame{}
|
ss.tcpFrame = &base.InterleavedFrame{}
|
||||||
ss.tcpBuffer = make([]byte, ss.s.MaxPacketSize+4)
|
ss.tcpBuffer = make([]byte, ss.s.MaxPacketSize+4)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ss.setuppedTransport.Protocol {
|
switch ss.setuppedTransport.Protocol {
|
||||||
case TransportUDP:
|
case ProtocolUDP:
|
||||||
ss.udpCheckStreamTimer = time.NewTimer(ss.s.checkStreamPeriod)
|
ss.udpCheckStreamTimer = time.NewTimer(ss.s.checkStreamPeriod)
|
||||||
ss.startWriter()
|
ss.startWriter()
|
||||||
|
|
||||||
case TransportUDPMulticast:
|
case ProtocolUDPMulticast:
|
||||||
ss.udpCheckStreamTimer = time.NewTimer(ss.s.checkStreamPeriod)
|
ss.udpCheckStreamTimer = time.NewTimer(ss.s.checkStreamPeriod)
|
||||||
|
|
||||||
default: // TCP
|
default: // TCP
|
||||||
@@ -1567,7 +1567,7 @@ func (ss *ServerSession) handleRequestInner(sc *ServerConn, req *base.Request) (
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ss.state != ServerSessionStatePlay &&
|
if ss.state != ServerSessionStatePlay &&
|
||||||
ss.setuppedTransport.Protocol != TransportUDPMulticast {
|
ss.setuppedTransport.Protocol != ProtocolUDPMulticast {
|
||||||
ss.destroyWriter()
|
ss.destroyWriter()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1624,13 +1624,13 @@ func (ss *ServerSession) handleRequestInner(sc *ServerConn, req *base.Request) (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ss.setuppedTransport.Protocol == TransportTCP {
|
if ss.setuppedTransport.Protocol == ProtocolTCP {
|
||||||
ss.tcpFrame = &base.InterleavedFrame{}
|
ss.tcpFrame = &base.InterleavedFrame{}
|
||||||
ss.tcpBuffer = make([]byte, ss.s.MaxPacketSize+4)
|
ss.tcpBuffer = make([]byte, ss.s.MaxPacketSize+4)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ss.setuppedTransport.Protocol {
|
switch ss.setuppedTransport.Protocol {
|
||||||
case TransportUDP:
|
case ProtocolUDP:
|
||||||
ss.udpCheckStreamTimer = time.NewTimer(ss.s.checkStreamPeriod)
|
ss.udpCheckStreamTimer = time.NewTimer(ss.s.checkStreamPeriod)
|
||||||
ss.startWriter()
|
ss.startWriter()
|
||||||
|
|
||||||
@@ -1688,10 +1688,10 @@ func (ss *ServerSession) handleRequestInner(sc *ServerConn, req *base.Request) (
|
|||||||
ss.propsMutex.Unlock()
|
ss.propsMutex.Unlock()
|
||||||
|
|
||||||
switch ss.setuppedTransport.Protocol {
|
switch ss.setuppedTransport.Protocol {
|
||||||
case TransportUDP:
|
case ProtocolUDP:
|
||||||
ss.udpCheckStreamTimer = emptyTimer()
|
ss.udpCheckStreamTimer = emptyTimer()
|
||||||
|
|
||||||
case TransportUDPMulticast:
|
case ProtocolUDPMulticast:
|
||||||
ss.udpCheckStreamTimer = emptyTimer()
|
ss.udpCheckStreamTimer = emptyTimer()
|
||||||
|
|
||||||
default: // TCP
|
default: // TCP
|
||||||
@@ -1701,7 +1701,7 @@ func (ss *ServerSession) handleRequestInner(sc *ServerConn, req *base.Request) (
|
|||||||
|
|
||||||
case ServerSessionStateRecord:
|
case ServerSessionStateRecord:
|
||||||
switch ss.setuppedTransport.Protocol {
|
switch ss.setuppedTransport.Protocol {
|
||||||
case TransportUDP:
|
case ProtocolUDP:
|
||||||
ss.udpCheckStreamTimer = emptyTimer()
|
ss.udpCheckStreamTimer = emptyTimer()
|
||||||
|
|
||||||
default: // TCP
|
default: // TCP
|
||||||
@@ -1721,7 +1721,7 @@ func (ss *ServerSession) handleRequestInner(sc *ServerConn, req *base.Request) (
|
|||||||
case base.Teardown:
|
case base.Teardown:
|
||||||
var err error
|
var err error
|
||||||
if (ss.state == ServerSessionStatePlay || ss.state == ServerSessionStateRecord) &&
|
if (ss.state == ServerSessionStatePlay || ss.state == ServerSessionStateRecord) &&
|
||||||
ss.setuppedTransport.Protocol == TransportTCP {
|
ss.setuppedTransport.Protocol == ProtocolTCP {
|
||||||
err = switchReadFuncError{false}
|
err = switchReadFuncError{false}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,8 +31,8 @@ func (sf *serverSessionFormat) initialize() {
|
|||||||
sf.rtpPacketsSent = new(uint64)
|
sf.rtpPacketsSent = new(uint64)
|
||||||
sf.rtpPacketsLost = new(uint64)
|
sf.rtpPacketsLost = new(uint64)
|
||||||
|
|
||||||
udp := sf.sm.ss.setuppedTransport.Protocol == TransportUDP ||
|
udp := sf.sm.ss.setuppedTransport.Protocol == ProtocolUDP ||
|
||||||
sf.sm.ss.setuppedTransport.Protocol == TransportUDPMulticast
|
sf.sm.ss.setuppedTransport.Protocol == ProtocolUDPMulticast
|
||||||
|
|
||||||
if udp {
|
if udp {
|
||||||
sf.writePacketRTPInQueue = sf.writePacketRTPInQueueUDP
|
sf.writePacketRTPInQueue = sf.writePacketRTPInQueueUDP
|
||||||
|
@@ -59,10 +59,10 @@ func (sm *serverSessionMedia) initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch sm.ss.setuppedTransport.Protocol {
|
switch sm.ss.setuppedTransport.Protocol {
|
||||||
case TransportUDP, TransportUDPMulticast:
|
case ProtocolUDP, ProtocolUDPMulticast:
|
||||||
sm.writePacketRTCPInQueue = sm.writePacketRTCPInQueueUDP
|
sm.writePacketRTCPInQueue = sm.writePacketRTCPInQueueUDP
|
||||||
|
|
||||||
case TransportTCP:
|
case ProtocolTCP:
|
||||||
sm.writePacketRTCPInQueue = sm.writePacketRTCPInQueueTCP
|
sm.writePacketRTCPInQueue = sm.writePacketRTCPInQueueTCP
|
||||||
|
|
||||||
if sm.ss.tcpCallbackByChannel == nil {
|
if sm.ss.tcpCallbackByChannel == nil {
|
||||||
@@ -89,8 +89,8 @@ func (sm *serverSessionMedia) close() {
|
|||||||
|
|
||||||
func (sm *serverSessionMedia) start() error {
|
func (sm *serverSessionMedia) start() error {
|
||||||
switch sm.ss.setuppedTransport.Protocol {
|
switch sm.ss.setuppedTransport.Protocol {
|
||||||
case TransportUDP, TransportUDPMulticast:
|
case ProtocolUDP, ProtocolUDPMulticast:
|
||||||
if sm.ss.setuppedTransport.Protocol == TransportUDP {
|
if sm.ss.setuppedTransport.Protocol == ProtocolUDP {
|
||||||
if sm.ss.state == ServerSessionStatePlay {
|
if sm.ss.state == ServerSessionStatePlay {
|
||||||
if sm.media.IsBackChannel {
|
if sm.media.IsBackChannel {
|
||||||
sm.ss.s.udpRTPListener.addClient(sm.ss.author.ip(), sm.udpRTPReadPort, sm.readPacketRTPUDPPlay)
|
sm.ss.s.udpRTPListener.addClient(sm.ss.author.ip(), sm.udpRTPReadPort, sm.readPacketRTPUDPPlay)
|
||||||
@@ -136,7 +136,7 @@ func (sm *serverSessionMedia) start() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (sm *serverSessionMedia) stop() {
|
func (sm *serverSessionMedia) stop() {
|
||||||
if sm.ss.setuppedTransport.Protocol == TransportUDP {
|
if sm.ss.setuppedTransport.Protocol == ProtocolUDP {
|
||||||
sm.ss.s.udpRTPListener.removeClient(sm.ss.author.ip(), sm.udpRTPReadPort)
|
sm.ss.s.udpRTPListener.removeClient(sm.ss.author.ip(), sm.udpRTPReadPort)
|
||||||
sm.ss.s.udpRTCPListener.removeClient(sm.ss.author.ip(), sm.udpRTCPReadPort)
|
sm.ss.s.udpRTCPListener.removeClient(sm.ss.author.ip(), sm.udpRTCPReadPort)
|
||||||
}
|
}
|
||||||
|
@@ -188,10 +188,10 @@ func (st *ServerStream) readerAdd(
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch protocol {
|
switch protocol {
|
||||||
case TransportUDP:
|
case ProtocolUDP:
|
||||||
// check whether UDP ports and IP are already assigned to another reader
|
// check whether UDP ports and IP are already assigned to another reader
|
||||||
for r := range st.readers {
|
for r := range st.readers {
|
||||||
if protocol == TransportUDP &&
|
if protocol == ProtocolUDP &&
|
||||||
r.author.ip().Equal(ss.author.ip()) &&
|
r.author.ip().Equal(ss.author.ip()) &&
|
||||||
r.author.zone() == ss.author.zone() {
|
r.author.zone() == ss.author.zone() {
|
||||||
for _, rt := range r.setuppedMedias {
|
for _, rt := range r.setuppedMedias {
|
||||||
@@ -202,7 +202,7 @@ func (st *ServerStream) readerAdd(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case TransportUDPMulticast:
|
case ProtocolUDPMulticast:
|
||||||
if st.multicastReaderCount == 0 {
|
if st.multicastReaderCount == 0 {
|
||||||
for _, media := range st.medias {
|
for _, media := range st.medias {
|
||||||
mw := &serverMulticastWriter{
|
mw := &serverMulticastWriter{
|
||||||
@@ -233,7 +233,7 @@ func (st *ServerStream) readerRemove(ss *ServerSession) {
|
|||||||
|
|
||||||
delete(st.readers, ss)
|
delete(st.readers, ss)
|
||||||
|
|
||||||
if ss.setuppedTransport.Protocol == TransportUDPMulticast {
|
if ss.setuppedTransport.Protocol == ProtocolUDPMulticast {
|
||||||
st.multicastReaderCount--
|
st.multicastReaderCount--
|
||||||
if st.multicastReaderCount == 0 {
|
if st.multicastReaderCount == 0 {
|
||||||
for _, media := range st.medias {
|
for _, media := range st.medias {
|
||||||
@@ -252,7 +252,7 @@ func (st *ServerStream) readerSetActive(ss *ServerSession) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ss.setuppedTransport.Protocol == TransportUDPMulticast {
|
if ss.setuppedTransport.Protocol == ProtocolUDPMulticast {
|
||||||
for medi, sm := range ss.setuppedMedias {
|
for medi, sm := range ss.setuppedMedias {
|
||||||
streamMedia := st.medias[medi]
|
streamMedia := st.medias[medi]
|
||||||
streamMedia.multicastWriter.rtcpl.addClient(
|
streamMedia.multicastWriter.rtcpl.addClient(
|
||||||
@@ -271,7 +271,7 @@ func (st *ServerStream) readerSetInactive(ss *ServerSession) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ss.setuppedTransport.Protocol == TransportUDPMulticast {
|
if ss.setuppedTransport.Protocol == ProtocolUDPMulticast {
|
||||||
for medi := range ss.setuppedMedias {
|
for medi := range ss.setuppedMedias {
|
||||||
streamMedia := st.medias[medi]
|
streamMedia := st.medias[medi]
|
||||||
streamMedia.multicastWriter.rtcpl.removeClient(ss.author.ip(), streamMedia.multicastWriter.rtcpl.port())
|
streamMedia.multicastWriter.rtcpl.removeClient(ss.author.ip(), streamMedia.multicastWriter.rtcpl.port())
|
||||||
|
@@ -7,15 +7,15 @@ type Protocol int
|
|||||||
|
|
||||||
// transport protocols.
|
// transport protocols.
|
||||||
const (
|
const (
|
||||||
TransportUDP Protocol = iota
|
ProtocolUDP Protocol = iota
|
||||||
TransportUDPMulticast
|
ProtocolUDPMulticast
|
||||||
TransportTCP
|
ProtocolTCP
|
||||||
)
|
)
|
||||||
|
|
||||||
var transportLabels = map[Protocol]string{
|
var transportLabels = map[Protocol]string{
|
||||||
TransportUDP: "UDP",
|
ProtocolUDP: "UDP",
|
||||||
TransportUDPMulticast: "UDP-multicast",
|
ProtocolUDPMulticast: "UDP-multicast",
|
||||||
TransportTCP: "TCP",
|
ProtocolTCP: "TCP",
|
||||||
}
|
}
|
||||||
|
|
||||||
// String implements fmt.Stringer.
|
// String implements fmt.Stringer.
|
||||||
|
@@ -7,7 +7,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestProtocolString(t *testing.T) {
|
func TestProtocolString(t *testing.T) {
|
||||||
tr := TransportUDPMulticast
|
tr := ProtocolUDPMulticast
|
||||||
require.NotEqual(t, "unknown", tr.String())
|
require.NotEqual(t, "unknown", tr.String())
|
||||||
|
|
||||||
tr = Protocol(15)
|
tr = Protocol(15)
|
||||||
|
Reference in New Issue
Block a user