Requirements
Pion ICE requires Go 1.24.0 or later. Verify your Go version:Install Pion ICE
Add Pion ICE to your Go module:go.mod file.
Version 4 is the current major version. If you’re upgrading from v3 or earlier, see the migration guide for breaking changes.
Project Setup
1
Create a new Go module
If you don’t already have a Go module, initialize one:
2
Install Pion ICE
Add the ICE package to your project:
3
Create your first file
Create a
main.go file with a basic import:main.go
4
Verify installation
Run your program to verify everything works:You should see:
Dependencies
Pion ICE automatically installs these key dependencies:- github.com/pion/stun/v3 - STUN protocol implementation
- github.com/pion/turn/v4 - TURN protocol for relay connections
- github.com/pion/dtls/v3 - DTLS support for secure TURN
- github.com/pion/mdns/v2 - Multicast DNS for local discovery
- github.com/pion/transport/v4 - Network transport abstractions
- github.com/pion/logging - Structured logging interface
Optional: TURN Server Setup
For production applications, you’ll typically need a TURN server for relay connections. While not required for development, consider:Verify Your Environment
Create a quick test to verify your setup:verify.go
Troubleshooting
Module errors
If you see module resolution errors:Go version mismatch
If your Go version is too old, you’ll see:Import errors
Make sure you’re importing the v4 version:Next Steps
Quickstart Guide
Build a complete ICE connection with our step-by-step quickstart