Overview
TheAgent represents the ICE agent responsible for gathering candidates, performing connectivity checks, and establishing peer-to-peer connections according to RFC 5245.
Creating an Agent
NewAgent (Deprecated)
*AgentConfig
Configuration for the agent. See AgentConfig for details.
(*Agent, error)
NewAgentWithOptions
...AgentOption
Variable number of configuration options. See Agent Options for available options.
(*Agent, error)
Example:
Key Methods
GatherCandidates
GetLocalCandidates
AddRemoteCandidate
Candidate
Remote candidate to add. Can be nil (ignored).
GetSelectedCandidatePair
SetRemoteCredentials
string
required
Remote username fragment (must not be empty)
string
required
Remote password (must not be empty)
GetLocalUserCredentials
GetRemoteUserCredentials
SetRemoteCredentials.
GetRemoteCandidates
Dial
Conn that can be used to send and receive data.
Parameters:
context.Context
Context for controlling the dial operation lifetime.
string
Remote username fragment (from remote agent’s GetLocalUserCredentials).
string
Remote password (from remote agent’s GetLocalUserCredentials).
(*Conn, error) - Connection for data transfer
Example:
Accept
Conn that can be used to send and receive data.
Parameters:
context.Context
Context for controlling the accept operation lifetime.
string
Remote username fragment (from remote agent’s GetLocalUserCredentials).
string
Remote password (from remote agent’s GetLocalUserCredentials).
(*Conn, error) - Connection for data transfer
Restart
string
New username fragment. Empty string generates a random value.
string
New password. Empty string generates a random value.
Credentials must meet minimum entropy requirements: ufrag >= 24 bits, pwd >= 128 bits.
UpdateOptions
WithUrls).
Close
GracefulClose
State Management
GetGatheringState
OnConnectionStateChange
OnSelectedCandidatePairChange
OnCandidate
Renomination
RenominateCandidate
Type Definition
Related Types
- AgentConfig - Legacy configuration struct
- AgentOption - Functional options for agent creation
- ConnectionState - Connection state enum
- GatheringState - Gathering state enum
- Candidate - Candidate interface