a simple stun server and client implementation in golang
About this project
stun A minimal STUN server and client implementation in Go, following RFC 5389. What is STUN? STUN (Session Traversal Utilities for NAT) is a protocol that allows a client to discover its public IP address and port as seen from the outside network. It is commonly used in WebRTC and peer-to-peer applications to establish direct connections through NATs and firewalls. How it works The client sends a STUN Binding Request to the server over UDP. The server validates the request (magic cookie, message type) and replies with a Binding Response containing the client's public IP and port encoded as a XOR-MAPPED-ADDRESS attribute. The client decodes the response and prints its public IP and port. Project Structure Requirements Go 1.21+ Running Start the server: The server listens on UDP port 3478 by default. Run the client: Example output:
From the project README on
GitHub
- Stars
- 13
- Forks
- 0
- Last push
- 20 Feb 2026
Add this badge to your README
Show that your project is listed on Made in Algeria.
[](https://www.madeinalgeria.dev/projects/stun)