Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. stun

stun

BSD-3-ClauseGov1.23.0

A high-performance, zero-allocation Go implementation of the RFC 5389 STUN protocol for NAT traversal.

GitHubGitHub
495 stars53 forks0 contributors

What is stun?

STUN is a Go library that implements the Session Traversal Utilities for NAT (STUN) protocol, enabling applications to discover their public IP addresses and ports when behind network address translators (NATs). It solves the problem of NAT traversal, which is critical for establishing direct peer-to-peer connections in real-time communication systems like VoIP and WebRTC.

Target Audience

Go developers building real-time communication applications, VoIP systems, or any networked software requiring NAT traversal capabilities.

Value Proposition

Developers choose this library for its high performance with zero allocations in hot paths, lack of external dependencies, and comprehensive RFC compliance. It's a mature, stable implementation that integrates seamlessly into Go-based networking stacks.

Overview

Fast RFC 5389 STUN implementation in go

Use Cases

Best For

  • Building WebRTC applications that require NAT traversal
  • Implementing STUN clients in Go for real-time communication
  • Developing peer-to-peer networking libraries
  • Creating VoIP or video conferencing systems
  • Testing NAT behavior in network applications
  • Integrating with TURN servers for relayed connections

Not Ideal For

  • Projects requiring NAT behavior discovery as per RFC 5780, which is not implemented and marked as an open issue.
  • Applications needing ALTERNATE-SERVER support for automatic failover in STUN requests, a missing feature acknowledged in the README.
  • Teams seeking a drop-in, full-featured STUN/TURN bundle without integrating separate packages like gortc/turn or gortcd.
  • Developers who prefer extensive tutorials and hand-holding documentation over minimal, example-based guidance.

Pros & Cons

Pros

Zero Allocation Performance

Benchmarks demonstrate no memory allocations in hot paths, optimizing for high-throughput and low-latency operations critical in real-time communication.

Automatic Retransmission Support

Client includes configurable retransmission timeouts (via WithRTO), enhancing reliability in unreliable network conditions without manual handling.

No External Dependencies

Self-contained implementation avoids third-party packages, simplifying dependency management and reducing potential conflicts in Go projects.

Comprehensive RFC Compliance

Supports RFCs 5389, 5769, 6062, and 7064 with TLS-over-TCP client functionality, ensuring interoperability with standard STUN servers.

Cons

Missing Advanced Features

Lacks support for ALTERNATE-SERVER and RFC 5780 (NAT behavior discovery), limiting functionality for failover and detailed NAT diagnostics.

Limited Extensibility

The README states that additional STUN attributes are unlikely to be implemented, restricting customization for non-standard or future extensions.

Sparse Documentation

Relies on a basic example and godoc references, offering little guidance for beginners or complex use cases beyond simple IP discovery.

Frequently Asked Questions

Quick Stats

Stars495
Forks53
Contributors0
Open Issues1
Last commit5 years ago
CreatedSince 2016

Tags

#nat-traversal#real-time-communication#stun#golang#webrtc#go#p2p#networking

Built With

G
Go

Included in

Go169.1k
Auto-fetched 6 hours ago

Related Projects

fasthttpfasthttp

Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http

Stars23,420
Forks1,841
Last commit3 days ago
webrtcwebrtc

Pure Go implementation of the WebRTC API

Stars16,661
Forks1,872
Last commit1 day ago
cloudflaredcloudflared

Cloudflare Tunnel client

Stars14,949
Forks1,363
Last commit1 day ago
kcptunkcptun

Reliable UDP Transmission Optimizer based on KCP: Enhancing network efficiency in poor connectivity environments.

Stars14,403
Forks2,631
Last commit3 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub