Skip to main content

Requirements

Pion ICE requires Go 1.24.0 or later. Verify your Go version:
If you need to upgrade Go, visit golang.org/dl.

Install Pion ICE

Add Pion ICE to your Go module:
This will download the latest v4 release and add it to your 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
These are managed automatically by Go modules.

Optional: TURN Server Setup

For production applications, you’ll typically need a TURN server for relay connections. While not required for development, consider:
Free TURN Servers: For testing, you can use public TURN servers like:
  • stun:stun.l.google.com:19302 (STUN only)
  • OpenRelay TURN servers (with rate limits)
Production: Run your own TURN server using coturn or Pion TURN.

Verify Your Environment

Create a quick test to verify your setup:
verify.go
Run it:
If you encounter import errors, ensure you’re using the correct import path:
  • github.com/pion/ice/v4
  • github.com/pion/ice (this is v1/v2)

Troubleshooting

Module errors

If you see module resolution errors:

Go version mismatch

If your Go version is too old, you’ll see:
Upgrade Go from golang.org/dl.

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