Skip to content
This repository has been archived by the owner on Jun 5, 2021. It is now read-only.

gortc/turn

Repository files navigation

Master status GoDev codecov

TURN

Package turn implements TURN [RFC5766] Traversal Using Relays around NAT. Based on gortc/stun package. See gortcd for TURN server and turnc for TURN client.

Supported RFCs

  • RFC 5766 — Traversal Using Relays around NAT
    • UDP transport for client
    • TCP or TLS transport for client
  • RFC 6156 — TURN Extension for IPv6
  • RFC 7065 — TURN URI
  • RFC 5928 — TURN Resolution Mechanism #13
  • RFC 6062 — TURN Extension for TCP Allocations #14

Testing

Client behavior is tested and verified in many ways:

  • End-To-End with long-term credentials
    • coturn: The coturn server (linux)
    • gortcd: The gortcd server (windows)
  • Bunch of code static checkers (linters)
  • Unit-tests (linux {amd64, arm64}, windows}
  • Explicit API backward compatibility check, see api directory (relaxed until v1)

See TeamCity project and e2e directory for more information. Also the Wireshark .pcap files are available for some of e2e tests in artifacts for build.

Benchmarks

goos: linux
goarch: amd64
pkg: github.com/gortc/turn
PASS
benchmark                                 iter     time/iter     throughput   bytes alloc        allocs
---------                                 ----     ---------     ----------   -----------        ------
BenchmarkIsChannelData-12           2000000000    1.64 ns/op   6694.29 MB/s        0 B/op   0 allocs/op
BenchmarkChannelData_Encode-12       200000000    9.11 ns/op   1317.35 MB/s        0 B/op   0 allocs/op
BenchmarkChannelData_Decode-12       500000000    3.92 ns/op   3061.45 MB/s        0 B/op   0 allocs/op
BenchmarkChannelNumber/AddTo-12      100000000   12.60 ns/op                       0 B/op   0 allocs/op
BenchmarkChannelNumber/GetFrom-12    200000000    7.23 ns/op                       0 B/op   0 allocs/op
BenchmarkData/AddTo-12               100000000   18.80 ns/op                       0 B/op   0 allocs/op
BenchmarkData/AddToRaw-12            100000000   16.80 ns/op                       0 B/op   0 allocs/op
BenchmarkLifetime/AddTo-12           100000000   13.70 ns/op                       0 B/op   0 allocs/op
BenchmarkLifetime/GetFrom-12         200000000    7.10 ns/op                       0 B/op   0 allocs/op
ok  	github.com/gortc/turn	19.110s

Auxiliary statuses

  • Master status — TeamCity aggregated status
  • Build Status — Travis (fast checks)
  • Build status — Appveyor (fast checks, Windows)