Skip to main content

Interactive Connectivity Establishment for Go

A complete implementation of the ICE protocol for peer-to-peer networking and NAT traversal in Go applications

Quick start

Get up and running with Pion ICE in minutes

1

Install the package

Add Pion ICE to your Go project using go get:
go get github.com/pion/ice/v4
2

Create an ICE agent

Initialize a new agent with default configuration:
package main

import (
    "context"
    "github.com/pion/ice/v4"
)

func main() {
    agent, err := ice.NewAgent()
    if err != nil {
        panic(err)
    }
    defer agent.Close()
}
3

Establish connectivity

Exchange candidates and credentials with your peer to establish a connection:
// Get local credentials
ufrag, pwd, err := agent.GetLocalUserCredentials()

// Set remote credentials (from peer)
err = agent.SetRemoteCredentials(remoteUfrag, remotePwd)

// Add remote candidates
err = agent.AddRemoteCandidate(remoteCandidate)

// Get connection
conn, err := agent.Dial(context.Background(), remoteUfrag, remotePwd)
See the quickstart guide for a complete working example with signaling.

Explore the library

Learn about core concepts and advanced features

ICE Protocol

Understand the fundamentals of Interactive Connectivity Establishment

Agents

Learn how ICE agents manage connectivity establishment

Candidates

Explore different candidate types and their priorities

NAT Traversal

Master techniques for traversing NAT and firewalls

Configuration

Customize agent behavior with configuration options

Multiplexing

Share ports across multiple ICE sessions

Key features

Production-ready ICE implementation with comprehensive feature support

RFC 5245 Compliant

Full implementation of the ICE protocol specification

UDP & TCP Support

Works with both UDP and TCP transport protocols

STUN & TURN

Integrated support for STUN and TURN servers

mDNS Discovery

Local network discovery without external servers

Ready to get started?

Follow our quickstart guide to establish your first peer-to-peer connection with Pion ICE

View Quickstart