Skip to content

Commit

Permalink
Remove unportable code from internal/ipnet
Browse files Browse the repository at this point in the history
Upgraded pion/transport to v0.8.6
Relates to pion/webrtc#740
  • Loading branch information
enobufs committed Jul 17, 2019
1 parent 62b9d71 commit e6c745d
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 159 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/gortc/turn v0.8.0
github.com/pion/logging v0.2.2
github.com/pion/stun v0.3.1
github.com/pion/transport v0.8.5
github.com/pion/transport v0.8.6
github.com/pkg/errors v0.8.1
github.com/stretchr/testify v1.3.0
golang.org/x/net v0.0.0-20190403144856-b630fd6fe46b
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY=
github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms=
github.com/pion/stun v0.3.1 h1:d09JJzOmOS8ZzIp8NppCMgrxGZpJ4Ix8qirfNYyI3BA=
github.com/pion/stun v0.3.1/go.mod h1:xrCld6XM+6GWDZdvjPlLMsTU21rNxnO6UO8XsAvHr/M=
github.com/pion/transport v0.8.5 h1:uo7g9BH6+Nm7DaJ1qX8+sv1o5rYREIM41kzrPVQYg14=
github.com/pion/transport v0.8.5/go.mod h1:nAmRRnn+ArVtsoNuwktvAD+jrjSD7pA+H3iRmZwdUno=
github.com/pion/transport v0.8.6 h1:xHQq2mxAjB+UrFs90aUBaXwlmIACfQAZnOiVAX3uqMw=
github.com/pion/transport v0.8.6/go.mod h1:nAmRRnn+ArVtsoNuwktvAD+jrjSD7pA+H3iRmZwdUno=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
22 changes: 8 additions & 14 deletions internal/allocation/allocation_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ import (

"github.com/gortc/turn"
"github.com/pion/logging"
"github.com/pion/turn/internal/ipnet"
)

func TestManager(t *testing.T) {
tt := []struct {
name string
f func(*testing.T, ipnet.PacketConn)
f func(*testing.T, net.PacketConn)
}{
{"CreateInvalidAllocation", subTestCreateInvalidAllocation},
{"CreateAllocation", subTestCreateAllocation},
Expand All @@ -27,16 +26,11 @@ func TestManager(t *testing.T) {
}

network := "udp4"
c, err := net.ListenPacket(network, "0.0.0.0:0")
turnSocket, err := net.ListenPacket(network, "0.0.0.0:0")
if err != nil {
panic(err)
}

turnSocket, err := ipnet.NewPacketConn(network, c)
if err != nil {
t.Fatal(err)
}

for _, tc := range tt {
f := tc.f
t.Run(tc.name, func(t *testing.T) {
Expand All @@ -46,7 +40,7 @@ func TestManager(t *testing.T) {
}

// test invalid Allocation creations
func subTestCreateInvalidAllocation(t *testing.T, turnSocket ipnet.PacketConn) {
func subTestCreateInvalidAllocation(t *testing.T, turnSocket net.PacketConn) {
m := newTestManager()
if a, err := m.CreateAllocation(nil, turnSocket, net.IPv4zero, 0, turn.DefaultLifetime); a != nil || err == nil {
t.Errorf("Illegally created allocation with nil FiveTuple")
Expand All @@ -60,7 +54,7 @@ func subTestCreateInvalidAllocation(t *testing.T, turnSocket ipnet.PacketConn) {
}

// test valid Allocation creations
func subTestCreateAllocation(t *testing.T, turnSocket ipnet.PacketConn) {
func subTestCreateAllocation(t *testing.T, turnSocket net.PacketConn) {
m := newTestManager()
fiveTuple := randomFiveTuple()
if a, err := m.CreateAllocation(fiveTuple, turnSocket, net.IPv4zero, 0, turn.DefaultLifetime); a == nil || err != nil {
Expand All @@ -73,7 +67,7 @@ func subTestCreateAllocation(t *testing.T, turnSocket ipnet.PacketConn) {
}

// test that two allocations can't be created with the same FiveTuple
func subTestCreateAllocationDuplicateFiveTuple(t *testing.T, turnSocket ipnet.PacketConn) {
func subTestCreateAllocationDuplicateFiveTuple(t *testing.T, turnSocket net.PacketConn) {
m := newTestManager()
fiveTuple := randomFiveTuple()
if a, err := m.CreateAllocation(fiveTuple, turnSocket, net.IPv4zero, 0, turn.DefaultLifetime); a == nil || err != nil {
Expand All @@ -85,7 +79,7 @@ func subTestCreateAllocationDuplicateFiveTuple(t *testing.T, turnSocket ipnet.Pa
}
}

func subTestDeleteAllocation(t *testing.T, turnSocket ipnet.PacketConn) {
func subTestDeleteAllocation(t *testing.T, turnSocket net.PacketConn) {
m := newTestManager()
fiveTuple := randomFiveTuple()
if a, err := m.CreateAllocation(fiveTuple, turnSocket, net.IPv4zero, 0, turn.DefaultLifetime); a == nil || err != nil {
Expand All @@ -103,7 +97,7 @@ func subTestDeleteAllocation(t *testing.T, turnSocket ipnet.PacketConn) {
}

// test that allocation should be closed if timeout
func subTestAllocationTimeout(t *testing.T, turnSocket ipnet.PacketConn) {
func subTestAllocationTimeout(t *testing.T, turnSocket net.PacketConn) {
m := newTestManager()
allocations := make([]*Allocation, 5)
lifetime := time.Second
Expand All @@ -129,7 +123,7 @@ func subTestAllocationTimeout(t *testing.T, turnSocket ipnet.PacketConn) {
}

// test for manager close
func subTestManagerClose(t *testing.T, turnSocket ipnet.PacketConn) {
func subTestManagerClose(t *testing.T, turnSocket net.PacketConn) {
m := newTestManager()
allocations := make([]*Allocation, 2)

Expand Down
8 changes: 0 additions & 8 deletions internal/ipnet/controlmessage.go

This file was deleted.

69 changes: 0 additions & 69 deletions internal/ipnet/ipv4.go

This file was deleted.

22 changes: 0 additions & 22 deletions internal/ipnet/ipv4_unix.go

This file was deleted.

19 changes: 0 additions & 19 deletions internal/ipnet/ipv4_windows.go

This file was deleted.

24 changes: 0 additions & 24 deletions internal/ipnet/packetconn.go

This file was deleted.

0 comments on commit e6c745d

Please sign in to comment.