mirror of
https://github.com/pion/ice.git
synced 2025-09-27 03:45:54 +08:00
Fix goconst lint error
Fix goconst lint error
This commit is contained in:
@@ -9,6 +9,10 @@ import (
|
||||
const (
|
||||
udp = "udp"
|
||||
tcp = "tcp"
|
||||
udp4 = "udp4"
|
||||
udp6 = "udp6"
|
||||
tcp4 = "tcp4"
|
||||
tcp6 = "tcp6"
|
||||
)
|
||||
|
||||
func supportedNetworkTypes() []NetworkType {
|
||||
@@ -40,13 +44,13 @@ const (
|
||||
func (t NetworkType) String() string {
|
||||
switch t {
|
||||
case NetworkTypeUDP4:
|
||||
return "udp4"
|
||||
return udp4
|
||||
case NetworkTypeUDP6:
|
||||
return "udp6"
|
||||
return udp6
|
||||
case NetworkTypeTCP4:
|
||||
return "tcp4"
|
||||
return tcp4
|
||||
case NetworkTypeTCP6:
|
||||
return "tcp6"
|
||||
return tcp6
|
||||
default:
|
||||
return ErrUnknownType.Error()
|
||||
}
|
||||
|
@@ -63,13 +63,13 @@ func TestMultiUDPMux(t *testing.T) {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
testMultiUDPMuxConnections(t, udpMuxMulti, "ufrag2", "udp4")
|
||||
testMultiUDPMuxConnections(t, udpMuxMulti, "ufrag2", udp4)
|
||||
}()
|
||||
|
||||
// skip ipv6 test on i386
|
||||
const ptrSize = 32 << (^uintptr(0) >> 63)
|
||||
if ptrSize != 32 {
|
||||
testMultiUDPMuxConnections(t, udpMuxMulti, "ufrag3", "udp6")
|
||||
testMultiUDPMuxConnections(t, udpMuxMulti, "ufrag3", udp6)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
@@ -87,9 +87,9 @@ func testMultiUDPMuxConnections(t *testing.T, udpMuxMulti *MultiUDPMuxDefault, u
|
||||
for _, addr := range addrs {
|
||||
udpAddr, ok := addr.(*net.UDPAddr)
|
||||
require.True(t, ok)
|
||||
if network == "udp4" && udpAddr.IP.To4() == nil {
|
||||
if network == udp4 && udpAddr.IP.To4() == nil {
|
||||
continue
|
||||
} else if network == "udp6" && udpAddr.IP.To4() != nil {
|
||||
} else if network == udp6 && udpAddr.IP.To4() != nil {
|
||||
continue
|
||||
}
|
||||
c, err := udpMuxMulti.GetConn(ufrag, addr)
|
||||
@@ -138,13 +138,13 @@ func TestUnspecifiedUDPMux(t *testing.T) {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
testMultiUDPMuxConnections(t, udpMuxMulti, "ufrag2", "udp4")
|
||||
testMultiUDPMuxConnections(t, udpMuxMulti, "ufrag2", udp4)
|
||||
}()
|
||||
|
||||
// skip ipv6 test on i386
|
||||
const ptrSize = 32 << (^uintptr(0) >> 63)
|
||||
if ptrSize != 32 {
|
||||
testMultiUDPMuxConnections(t, udpMuxMulti, "ufrag3", "udp6")
|
||||
testMultiUDPMuxConnections(t, udpMuxMulti, "ufrag3", udp6)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
|
@@ -33,8 +33,8 @@ func TestUDPMux(t *testing.T) {
|
||||
t.Log("IPv6 is not supported on this machine")
|
||||
}
|
||||
|
||||
for network, c := range map[string]net.PacketConn{"udp4": conn4, "udp6": conn6} {
|
||||
if c == nil {
|
||||
for network, c := range map[string]net.PacketConn{udp4: conn4, udp6: conn6} {
|
||||
if udpConn, ok := c.(*net.UDPConn); !ok || udpConn == nil {
|
||||
continue
|
||||
}
|
||||
conn := c
|
||||
@@ -63,7 +63,7 @@ func TestUDPMux(t *testing.T) {
|
||||
|
||||
// skip ipv6 test on i386
|
||||
const ptrSize = 32 << (^uintptr(0) >> 63)
|
||||
if ptrSize != 32 || network != "udp6" {
|
||||
if ptrSize != 32 || network != udp6 {
|
||||
testMuxConnection(t, udpMux, "ufrag2", network)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user