diff --git a/agent.go b/agent.go index 90b143c..9727aa1 100644 --- a/agent.go +++ b/agent.go @@ -26,7 +26,7 @@ import ( "github.com/pion/transport/v4/packetio" "github.com/pion/transport/v4/stdnet" "github.com/pion/transport/v4/vnet" - "github.com/pion/turn/v4" + "github.com/pion/turn/v5" "golang.org/x/net/proxy" ) diff --git a/candidate_relay_test.go b/candidate_relay_test.go index a8ab182..471589f 100644 --- a/candidate_relay_test.go +++ b/candidate_relay_test.go @@ -13,12 +13,12 @@ import ( "github.com/pion/stun/v3" "github.com/pion/transport/v4/test" - "github.com/pion/turn/v4" + "github.com/pion/turn/v5" "github.com/stretchr/testify/require" ) -func optimisticAuthHandler(string, string, net.Addr) (key []byte, ok bool) { - return turn.GenerateAuthKey("username", "pion.ly", "password"), true +func optimisticAuthHandler(ra *turn.RequestAttributes) (userID string, key []byte, ok bool) { + return ra.Username, turn.GenerateAuthKey("username", "pion.ly", "password"), true } func TestRelayOnlyConnection(t *testing.T) { diff --git a/candidate_server_reflexive_test.go b/candidate_server_reflexive_test.go index 5a39c32..3b9cc56 100644 --- a/candidate_server_reflexive_test.go +++ b/candidate_server_reflexive_test.go @@ -13,7 +13,7 @@ import ( "github.com/pion/stun/v3" "github.com/pion/transport/v4/test" - "github.com/pion/turn/v4" + "github.com/pion/turn/v5" "github.com/stretchr/testify/require" ) diff --git a/connectivity_vnet_test.go b/connectivity_vnet_test.go index 0a1704d..e8f73d5 100644 --- a/connectivity_vnet_test.go +++ b/connectivity_vnet_test.go @@ -17,7 +17,7 @@ import ( "github.com/pion/stun/v3" "github.com/pion/transport/v4/test" "github.com/pion/transport/v4/vnet" - "github.com/pion/turn/v4" + "github.com/pion/turn/v5" "github.com/stretchr/testify/require" ) @@ -172,12 +172,12 @@ func addVNetSTUN(wanNet *vnet.Net, loggerFactory logging.LoggerFactory) (*turn.S return nil, err } server, err := turn.NewServer(turn.ServerConfig{ - AuthHandler: func(username, realm string, _ net.Addr) (key []byte, ok bool) { - if pw, ok := credMap[username]; ok { - return turn.GenerateAuthKey(username, realm, pw), true + AuthHandler: func(ra *turn.RequestAttributes) (userID string, key []byte, ok bool) { + if pw, found := credMap[ra.Username]; found { + return ra.Username, turn.GenerateAuthKey(ra.Username, ra.Realm, pw), true } - return nil, false + return "", nil, false }, PacketConnConfigs: []turn.PacketConnConfig{ { diff --git a/gather.go b/gather.go index b45eb49..8f85593 100644 --- a/gather.go +++ b/gather.go @@ -20,7 +20,7 @@ import ( "github.com/pion/logging" "github.com/pion/stun/v3" "github.com/pion/transport/v4/stdnet" - "github.com/pion/turn/v4" + "github.com/pion/turn/v5" ) type turnClient interface { diff --git a/gather_test.go b/gather_test.go index 5c44bdb..99e0333 100644 --- a/gather_test.go +++ b/gather_test.go @@ -32,7 +32,7 @@ import ( transport "github.com/pion/transport/v4" "github.com/pion/transport/v4/test" "github.com/pion/transport/v4/vnet" - "github.com/pion/turn/v4" + "github.com/pion/turn/v5" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "golang.org/x/net/proxy" diff --git a/gather_vnet_test.go b/gather_vnet_test.go index bec3363..66f4d39 100644 --- a/gather_vnet_test.go +++ b/gather_vnet_test.go @@ -16,7 +16,7 @@ import ( "github.com/pion/stun/v3" "github.com/pion/transport/v4/test" "github.com/pion/transport/v4/vnet" - "github.com/pion/turn/v4" + "github.com/pion/turn/v5" "github.com/stretchr/testify/require" ) @@ -452,12 +452,12 @@ func TestGatherRelayWithVNet(t *testing.T) { RelayAddressGenerator: relayGenerator, }, }, - AuthHandler: func(username, realm string, srcAddr net.Addr) ([]byte, bool) { - if username != turnUser { - return nil, false + AuthHandler: func(ra *turn.RequestAttributes) (userID string, key []byte, ok bool) { + if ra.Username != turnUser { + return "", nil, false } - return turn.GenerateAuthKey(username, realm, turnPass), true + return ra.Username, turn.GenerateAuthKey(ra.Username, ra.Realm, turnPass), true }, }) require.NoError(t, err) diff --git a/go.mod b/go.mod index 04ad36b..dd790d3 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/pion/randutil v0.1.0 github.com/pion/stun/v3 v3.1.2 github.com/pion/transport/v4 v4.0.1 - github.com/pion/turn/v4 v4.1.4 + github.com/pion/turn/v5 v5.0.3 github.com/stretchr/testify v1.11.1 golang.org/x/net v0.47.0 ) @@ -21,8 +21,8 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/wlynxg/anet v0.0.5 // indirect golang.org/x/crypto v0.45.0 // indirect - golang.org/x/sys v0.38.0 // indirect - golang.org/x/time v0.10.0 // indirect + golang.org/x/sys v0.41.0 // indirect + golang.org/x/time v0.14.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 648c6ac..9d8bc92 100644 --- a/go.sum +++ b/go.sum @@ -21,8 +21,8 @@ github.com/pion/transport/v3 v3.1.1 h1:Tr684+fnnKlhPceU+ICdrw6KKkTms+5qHMgw6bIkY github.com/pion/transport/v3 v3.1.1/go.mod h1:+c2eewC5WJQHiAA46fkMMzoYZSuGzA/7E2FPrOYHctQ= github.com/pion/transport/v4 v4.0.1 h1:sdROELU6BZ63Ab7FrOLn13M6YdJLY20wldXW2Cu2k8o= github.com/pion/transport/v4 v4.0.1/go.mod h1:nEuEA4AD5lPdcIegQDpVLgNoDGreqM/YqmEx3ovP4jM= -github.com/pion/turn/v4 v4.1.4 h1:EU11yMXKIsK43FhcUnjLlrhE4nboHZq+TXBIi3QpcxQ= -github.com/pion/turn/v4 v4.1.4/go.mod h1:ES1DXVFKnOhuDkqn9hn5VJlSWmZPaRJLyBXoOeO/BmQ= +github.com/pion/turn/v5 v5.0.3 h1:I+Nw0fQgdPWF1SXDj0egWDhCkcff7gWiigdQpOK52Ak= +github.com/pion/turn/v5 v5.0.3/go.mod h1:fs4SogUh/aRGQzonc4Lx3Jp4EU3j3t0PfNDEd9KcD/w= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= @@ -33,10 +33,10 @@ golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= -golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= -golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/time v0.10.0 h1:3usCWA8tQn0L8+hFJQNgzpWbd89begxN66o1Ojdn5L4= -golang.org/x/time v0.10.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= +golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= +golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/transport_filtering_matrix_test.go b/transport_filtering_matrix_test.go index 18d3b17..39d7fe4 100644 --- a/transport_filtering_matrix_test.go +++ b/transport_filtering_matrix_test.go @@ -18,7 +18,7 @@ import ( "github.com/pion/stun/v3" transport "github.com/pion/transport/v4" "github.com/pion/transport/v4/test" - "github.com/pion/turn/v4" + "github.com/pion/turn/v5" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "golang.org/x/net/proxy"