package ice

Import Path
	github.com/pion/ice/v4 (on go.dev)

Dependency Relation
	imports 34 packages, and imported by 3 packages


Package-Level Type Names (total 47)
/* sort by: | */
AddrPort is an IP and a port number.
Agent represents the ICE agent. Accept connects to the remote agent, acting as the controlled ice agent. Accept blocks until at least one ice candidate pair has successfully connected. AddRemoteCandidate adds a new remote candidate. Close cleans up the Agent. Dial connects to the remote agent, acting as the controlling ice agent. Dial blocks until at least one ice candidate pair has successfully connected. GatherCandidates initiates the trickle based gathering process. GetCandidatePairsStats returns a list of candidate pair stats. GetLocalCandidates returns the local candidates. GetLocalCandidatesStats returns a list of local candidates stats. GetLocalUserCredentials returns the local user credentials. GetRemoteCandidates returns the remote candidates. GetRemoteCandidatesStats returns a list of remote candidates stats. GetRemoteUserCredentials returns the remote user credentials. GetSelectedCandidatePair returns the selected pair or nil if there is none. GetSelectedCandidatePairStats returns a candidate pair stats for selected candidate pair. Returns false if there is no selected pair. GracefulClose cleans up the Agent and waits for any goroutines it started to complete. This is only safe to call outside of Agent callbacks or if in a callback, in its own goroutine. OnCandidate sets a handler that is fired when new candidates gathered. When the gathering process complete the last candidate is nil. OnConnectionStateChange sets a handler that is fired when the connection state changes. OnSelectedCandidatePairChange sets a handler that is fired when the final candidate. pair is selected. Restart restarts the ICE Agent with the provided ufrag/pwd If no ufrag/pwd is provided the Agent will generate one itself If there is a gatherer routine currently running, Restart will cancel it. After a Restart, the user must then call GatherCandidates explicitly to start generating new ones. SetRemoteCredentials sets the credentials of the remote agent. *Agent : github.com/prometheus/common/expfmt.Closer *Agent : io.Closer func NewAgent(config *AgentConfig) (*Agent, error)
AgentConfig collects the arguments to ice.Agent construction into a single structure, for future-proofness of the interface. Deprecated: AcceptAggressiveNomination always enabled. BindingRequestHandler allows applications to perform logic on incoming STUN Binding Requests This was implemented to allow users to * Log incoming Binding Requests for debugging * Implement draft-thatcher-ice-renomination * Implement custom CandidatePair switching logic CandidateTypes is an optional configuration for disabling or enabling support for specific candidate types. CheckInterval controls how often our task loop runs when in the connecting state. DisableActiveTCP can be used to disable Active TCP candidates. Otherwise when TCP is enabled Active TCP candidates will be created when a new passive TCP remote candidate is added. DisconnectedTimeout defaults to 5 seconds when this property is nil. If the duration is 0, the ICE Agent will never go to disconnected EnableUseCandidateCheckPriority can be used to enable checking for equal or higher priority to switch selected candidate pair if the peer requests USE-CANDIDATE and agent is a lite agent. This is disabled by default, i. e. when peer requests USE-CANDIDATE, the selected pair will be switched to that irrespective of relative priority between current selected pair and priority of the pair being switched to. FailedTimeout defaults to 25 seconds when this property is nil. If the duration is 0, we will never go to failed. HostAcceptanceMinWait specify a minimum wait time before selecting host candidates IPFilter is a function that you can use in order to whitelist or blacklist the ips which are used to gather ICE candidates. Include loopback addresses in the candidate list. InsecureSkipVerify controls if self-signed certificates are accepted when connecting to TURN servers via TLS or DTLS InterfaceFilter is a function that you can use in order to whitelist or blacklist the interfaces which are used to gather ICE candidates. KeepaliveInterval determines how often should we send ICE keepalives (should be less then connectiontimeout above) when this is nil, it defaults to 2 seconds. A keepalive interval of 0 means we never send keepalive packets Lite agents do not perform connectivity check and only provide host candidates. LocalPwd string LocalUfrag and LocalPwd values used to perform connectivity checks. The values MUST be unguessable, with at least 128 bits of random number generator output used to generate the password, and at least 24 bits of output to generate the username fragment. LoggerFactory logging.LoggerFactory MaxBindingRequests is the max amount of binding requests the agent will send over a candidate pair for validation or nomination, if after MaxBindingRequests the candidate is yet to answer a binding request or a nomination we set the pair as failed MulticastDNSHostName controls the hostname for this agent. If none is specified a random one will be generated MulticastDNSMode controls mDNS behavior for the ICE agent NAT1To1IPCandidateType is used along with NAT1To1IPs to specify which candidate type the 1:1 NAT IP addresses should be mapped to. If unspecified or CandidateTypeHost, NAT1To1IPs are used to replace host candidate IPs. If CandidateTypeServerReflexive, it will insert a srflx candidate (as if it was derived from a STUN server) with its port number being the one for the actual host candidate. Other values will result in an error. NAT1To1IPs contains a list of public IP addresses that are to be used as a host candidate or srflx candidate. This is used typically for servers that are behind 1:1 D-NAT (e.g. AWS EC2 instances) and to eliminate the need of server reflexive candidate gathering. Net is the our abstracted network interface for internal development purpose only (see https://github.com/pion/transport) NetworkTypes is an optional configuration for disabling or enabling support for specific network types. PortMax uint16 PortMin and PortMax are optional. Leave them 0 for the default UDP port allocation strategy. PrflxAcceptanceMinWait specify a minimum wait time before selecting prflx candidates Proxy Dialer is a dialer that should be implemented by the user based on golang.org/x/net/proxy dial interface in order to support corporate proxies RelayAcceptanceMinWait specify a minimum wait time before selecting relay candidates STUNGatherTimeout specify a minimum wait time for STUN responses SrflxAcceptanceMinWait specify a minimum wait time before selecting srflx candidates TCPMux will be used for multiplexing incoming TCP connections for ICE TCP. Currently only passive candidates are supported. This functionality is experimental and the API might change in the future. TCPPriorityOffset is a number which is subtracted from the default (UDP) candidate type preference for host, srflx and prfx candidate types. It helps to configure relative preference of UDP candidates against TCP ones. Relay candidates for TCP and UDP are always 0 and not affected by this setting. When this is nil, defaultTCPPriorityOffset is used. UDPMux is used for multiplexing multiple incoming UDP connections on a single port when this is set, the agent ignores PortMin and PortMax configurations and will defer to UDPMux for incoming connections UDPMuxSrflx is used for multiplexing multiple incoming UDP connections of server reflexive candidates on a single port when this is set, the agent ignores PortMin and PortMax configurations and will defer to UDPMuxSrflx for incoming connections It embeds UDPMux to do the actual connection multiplexing Urls []*stun.URI func NewAgent(config *AgentConfig) (*Agent, error)
AllConnsGetter allows multiple fixed TCP ports to be used, each of which is multiplexed like TCPMux. AllConnsGetter also acts as a TCPMux, in which case it will return a single connection for one of the ports. ( AllConnsGetter) GetAllConns(ufrag string, isIPv6 bool, localIP net.IP) ([]net.PacketConn, error) *MultiTCPMuxDefault
AttrControl is helper that wraps ICE-{CONTROLLED,CONTROLLING}. Role Role Tiebreaker uint64 AddTo adds ICE-CONTROLLED or ICE-CONTROLLING attribute depending on Role. GetFrom decodes Role and Tiebreaker value from message. *AttrControl : github.com/pion/stun/v3.Getter AttrControl : github.com/pion/stun/v3.Setter
AttrControlled represents ICE-CONTROLLED attribute. AddTo adds ICE-CONTROLLED to message. GetFrom decodes ICE-CONTROLLED from message. *AttrControlled : github.com/pion/stun/v3.Getter AttrControlled : github.com/pion/stun/v3.Setter
AttrControlling represents ICE-CONTROLLING attribute. AddTo adds ICE-CONTROLLING to message. GetFrom decodes ICE-CONTROLLING from message. *AttrControlling : github.com/pion/stun/v3.Getter AttrControlling : github.com/pion/stun/v3.Setter
Candidate represents an ICE candidate. AddExtension adds an extension attribute to the ICECandidate. If an extension with the same key already exists, it will be overwritten. Extension attributes are defined in RFC 5245, Section 15.1: ( Candidate) Address() string A component is a piece of a data stream. An example is one for RTP, and one for RTCP DeepEqual same as Equal, But it also compares the candidate extensions. ( Candidate) Equal(other Candidate) bool Extensions returns a copy of all extension attributes associated with the ICECandidate. In the order of insertion, *(key value). Extension attributes are defined in RFC 5245, Section 15.1: https://datatracker.ietf.org/doc/html/rfc5245#section-15.1 . An arbitrary string used in the freezing algorithm to group similar candidates. It is the same for two candidates that have the same type, base IP address, protocol (UDP, TCP, etc.), and STUN or TURN server. GetExtension returns the value of the extension attribute associated with the ICECandidate. Extension attributes are defined in RFC 5245, Section 15.1: https://datatracker.ietf.org/doc/html/rfc5245#section-15.1 . ID is a unique identifier for just this candidate Unlike the foundation this is different for each candidate The last time this candidate received traffic The last time this candidate sent traffic ( Candidate) Marshal() string ( Candidate) NetworkType() NetworkType ( Candidate) Port() int ( Candidate) Priority() uint32 A transport address related to a candidate, which is useful for diagnostics and other purposes RemoveExtension removes an extension attribute from the ICECandidate. Extension attributes are defined in RFC 5245, Section 15.1: ( Candidate) SetComponent(uint16) ( Candidate) String() string ( Candidate) TCPType() TCPType ( Candidate) Type() CandidateType *CandidateHost *CandidatePeerReflexive *CandidateRelay *CandidateServerReflexive Candidate : expvar.Var Candidate : fmt.Stringer func UnmarshalCandidate(raw string) (Candidate, error) func (*Agent).GetLocalCandidates() ([]Candidate, error) func (*Agent).GetRemoteCandidates() ([]Candidate, error) func github.com/pion/webrtc/v4.ICECandidate.ToICE() (cand Candidate, err error) func (*Agent).AddRemoteCandidate(cand Candidate) error func Candidate.DeepEqual(other Candidate) bool func Candidate.Equal(other Candidate) bool
CandidateExtension represents a single candidate extension as defined in https://tools.ietf.org/html/rfc5245#section-15.1 . Key string Value string func Candidate.Extensions() []CandidateExtension func Candidate.GetExtension(key string) (value CandidateExtension, ok bool) func Candidate.AddExtension(extension CandidateExtension) error
CandidateHost is a candidate of type host. (*CandidateHost) AddExtension(ext CandidateExtension) error Address returns Candidate Address. Component returns candidate component. Deadline implements context.Context. DeepEqual is same as Equal but also compares the extensions. Done implements context.Context. Equal is used to compare two candidateBases. Err implements context.Context. (*CandidateHost) Extensions() []CandidateExtension (*CandidateHost) Foundation() string Get returns the value of the given key if it exists. ID returns Candidate ID. LastReceived returns a time.Time indicating the last time this candidate was received. LastSent returns a time.Time indicating the last time this candidate was sent. LocalPreference returns the local preference for this candidate. Marshal returns the string representation of the ICECandidate. NetworkType returns candidate NetworkType. Port returns Candidate Port. Priority computes the priority for this ICE Candidate See: https://www.rfc-editor.org/rfc/rfc8445#section-5.1.2.1 RelatedAddress returns *CandidateRelatedAddress. (*CandidateHost) RemoveExtension(key string) (ok bool) (*CandidateHost) SetComponent(component uint16) String makes the candidateBase printable. (*CandidateHost) TCPType() TCPType Type returns candidate type. TypePreference returns the type preference for this candidate. Value implements context.Context. *CandidateHost : Candidate *CandidateHost : context.Context *CandidateHost : expvar.Var *CandidateHost : fmt.Stringer func NewCandidateHost(config *CandidateHostConfig) (*CandidateHost, error)
CandidateHostConfig is the config required to create a new CandidateHost. Address string CandidateID string Component uint16 Foundation string IsLocationTracked bool Network string Port int Priority uint32 TCPType TCPType func NewCandidateHost(config *CandidateHostConfig) (*CandidateHost, error)
CandidatePair is a combination of a local and remote candidate. Local Candidate Remote Candidate CurrentRoundTripTime returns the current round trip time in seconds https://www.w3.org/TR/webrtc-stats/#dom-rtcicecandidatepairstats-currentroundtriptime FirstReponseReceivedAt returns the timestamp of the first connectivity response received. FirstRequestReceivedAt returns the timestamp of the first connectivity check received. FirstRequestSentAt returns the timestamp of the first connectivity check sent. LastRequestReceivedAt returns the timestamp of the last connectivity check received. LastRequestSentAt returns the timestamp of the last connectivity check sent. LastResponseReceivedAt returns the timestamp of the last connectivity response received. RequestsReceived returns the total number of connectivity checks received https://www.w3.org/TR/webrtc-stats/#dom-rtcicecandidatepairstats-requestsreceived RequestsSent returns the total number of connectivity checks sent https://www.w3.org/TR/webrtc-stats/#dom-rtcicecandidatepairstats-requestssent ResponsesReceived returns the total number of connectivity responses received https://www.w3.org/TR/webrtc-stats/#dom-rtcicecandidatepairstats-responsesreceived ResponsesSent returns the total number of connectivity responses sent https://www.w3.org/TR/webrtc-stats/#dom-rtcicecandidatepairstats-responsessent (*CandidatePair) String() string TotalRoundTripTime returns the current round trip time in seconds https://www.w3.org/TR/webrtc-stats/#dom-rtcicecandidatepairstats-totalroundtriptime UpdateRequestReceived increments the number of requests received and updates the timestamp. UpdateRequestSent increments the number of requests sent and updates the timestamp. UpdateResponseSent increments the number of responses sent. UpdateRoundTripTime sets the current round time of this pair and accumulates total round trip time and responses received. (*CandidatePair) Write(b []byte) (int, error) *CandidatePair : github.com/miekg/dns.Writer *CandidatePair : expvar.Var *CandidatePair : fmt.Stringer *CandidatePair : internal/bisect.Writer *CandidatePair : io.Writer func (*Agent).GetSelectedCandidatePair() (*CandidatePair, error)
CandidatePairState represent the ICE candidate pair state. ( CandidatePairState) String() string CandidatePairState : expvar.Var CandidatePairState : fmt.Stringer const CandidatePairStateFailed const CandidatePairStateInProgress const CandidatePairStateSucceeded const CandidatePairStateWaiting
CandidatePairStats contains ICE candidate pair statistics. AvailableIncomingBitrate is calculated by the underlying congestion control by combining the available bitrate for all the incoming RTP streams using this candidate pair. The bitrate measurement does not count the size of the IP or other transport layers like TCP or UDP. It is similar to the TIAS defined in RFC 3890, i.e., it is measured in bits per second and the bitrate is calculated over a 1 second window. AvailableOutgoingBitrate is calculated by the underlying congestion control by combining the available bitrate for all the outgoing RTP streams using this candidate pair. The bitrate measurement does not count the size of the IP or other transport layers like TCP or UDP. It is similar to the TIAS defined in RFC 3890, i.e., it is measured in bits per second and the bitrate is calculated over a 1 second window. BytesReceived represents the total number of payload bytes received on this candidate pair not including headers or padding. BytesSent represents the total number of payload bytes sent on this candidate pair not including headers or padding. CircuitBreakerTriggerCount represents the number of times the circuit breaker is triggered for this particular 5-tuple, ceasing transmission. ConsentExpiredTimestamp represents the timestamp at which the latest valid STUN binding response expired. ConsentRequestsSent represents the total number of consent requests sent. CurrentRoundTripTime represents the latest round trip time measured in seconds, computed from both STUN connectivity checks, including those that are sent for consent verification. FirstRequestReceivedTimestamp represents the timestamp at which the first connectivity check request was received. FirstRequestTimestamp represents the timestamp at which the first STUN request was sent on this particular candidate pair. FirstResponseTimestamp represents the timestamp at which the first STUN response was received on this particular candidate pair. LastPacketReceivedTimestamp represents the timestamp at which the last packet was received on this particular candidate pair, excluding STUN packets. LastPacketSentTimestamp represents the timestamp at which the last packet was sent on this particular candidate pair, excluding STUN packets. LastRequestReceivedTimestamp represents the timestamp at which the last connectivity check request was received. LastRequestTimestamp represents the timestamp at which the last STUN request was sent on this particular candidate pair. The average interval between two consecutive connectivity checks sent can be calculated with (LastRequestTimestamp - FirstRequestTimestamp) / RequestsSent. LastResponseTimestamp represents the timestamp at which the last STUN response was received on this particular candidate pair. LocalCandidateID is the ID of the local candidate Nominated is true when this valid pair that should be used for media if it is the highest-priority one amongst those whose nominated flag is set PacketsReceived represents the total number of packets received on this candidate pair. PacketsSent represents the total number of packets sent on this candidate pair. RemoteCandidateID is the ID of the remote candidate RequestsReceived represents the total number of connectivity check requests received (including retransmissions). It is impossible for the receiver to tell whether the request was sent in order to check connectivity or check consent, so all connectivity checks requests are counted here. RequestsSent represents the total number of connectivity check requests sent (not including retransmissions). ResponsesReceived represents the total number of connectivity check responses received. ResponsesSent represents the total number of connectivity check responses sent. Since we cannot distinguish connectivity check requests and consent requests, all responses are counted. RetransmissionsReceived represents the total number of connectivity check request retransmissions received. RetransmissionsSent represents the total number of connectivity check request retransmissions sent. State represents the state of the checklist for the local and remote candidates in a pair. Timestamp is the timestamp associated with this object. TotalRoundTripTime represents the sum of all round trip time measurements in seconds since the beginning of the session, based on STUN connectivity check responses (ResponsesReceived), including those that reply to requests that are sent in order to verify consent. The average round trip time can be computed from TotalRoundTripTime by dividing it by ResponsesReceived. func (*Agent).GetCandidatePairsStats() []CandidatePairStats func (*Agent).GetSelectedCandidatePairStats() (CandidatePairStats, bool)
CandidatePeerReflexive ... (*CandidatePeerReflexive) AddExtension(ext CandidateExtension) error Address returns Candidate Address. Component returns candidate component. Deadline implements context.Context. DeepEqual is same as Equal but also compares the extensions. Done implements context.Context. Equal is used to compare two candidateBases. Err implements context.Context. (*CandidatePeerReflexive) Extensions() []CandidateExtension (*CandidatePeerReflexive) Foundation() string Get returns the value of the given key if it exists. ID returns Candidate ID. LastReceived returns a time.Time indicating the last time this candidate was received. LastSent returns a time.Time indicating the last time this candidate was sent. LocalPreference returns the local preference for this candidate. Marshal returns the string representation of the ICECandidate. NetworkType returns candidate NetworkType. Port returns Candidate Port. Priority computes the priority for this ICE Candidate See: https://www.rfc-editor.org/rfc/rfc8445#section-5.1.2.1 RelatedAddress returns *CandidateRelatedAddress. (*CandidatePeerReflexive) RemoveExtension(key string) (ok bool) (*CandidatePeerReflexive) SetComponent(component uint16) String makes the candidateBase printable. (*CandidatePeerReflexive) TCPType() TCPType Type returns candidate type. TypePreference returns the type preference for this candidate. Value implements context.Context. *CandidatePeerReflexive : Candidate *CandidatePeerReflexive : context.Context *CandidatePeerReflexive : expvar.Var *CandidatePeerReflexive : fmt.Stringer func NewCandidatePeerReflexive(config *CandidatePeerReflexiveConfig) (*CandidatePeerReflexive, error)
CandidatePeerReflexiveConfig is the config required to create a new CandidatePeerReflexive. Address string CandidateID string Component uint16 Foundation string Network string Port int Priority uint32 RelAddr string RelPort int func NewCandidatePeerReflexive(config *CandidatePeerReflexiveConfig) (*CandidatePeerReflexive, error)
CandidateRelatedAddress convey transport addresses related to the candidate, useful for diagnostics and other purposes. Address string Port int Equal allows comparing two CandidateRelatedAddresses. The CandidateRelatedAddress are allowed to be nil. String makes CandidateRelatedAddress printable. *CandidateRelatedAddress : expvar.Var *CandidateRelatedAddress : fmt.Stringer func Candidate.RelatedAddress() *CandidateRelatedAddress func (*CandidateRelatedAddress).Equal(other *CandidateRelatedAddress) bool
CandidateRelay ... (*CandidateRelay) AddExtension(ext CandidateExtension) error Address returns Candidate Address. Component returns candidate component. Deadline implements context.Context. DeepEqual is same as Equal but also compares the extensions. Done implements context.Context. Equal is used to compare two candidateBases. Err implements context.Context. (*CandidateRelay) Extensions() []CandidateExtension (*CandidateRelay) Foundation() string Get returns the value of the given key if it exists. ID returns Candidate ID. LastReceived returns a time.Time indicating the last time this candidate was received. LastSent returns a time.Time indicating the last time this candidate was sent. LocalPreference returns the local preference for this candidate. Marshal returns the string representation of the ICECandidate. NetworkType returns candidate NetworkType. Port returns Candidate Port. Priority computes the priority for this ICE Candidate See: https://www.rfc-editor.org/rfc/rfc8445#section-5.1.2.1 RelatedAddress returns *CandidateRelatedAddress. RelayProtocol returns the protocol used between the endpoint and the relay server. (*CandidateRelay) RemoveExtension(key string) (ok bool) (*CandidateRelay) SetComponent(component uint16) String makes the candidateBase printable. (*CandidateRelay) TCPType() TCPType Type returns candidate type. TypePreference returns the type preference for this candidate. Value implements context.Context. *CandidateRelay : Candidate *CandidateRelay : context.Context *CandidateRelay : expvar.Var *CandidateRelay : fmt.Stringer func NewCandidateRelay(config *CandidateRelayConfig) (*CandidateRelay, error)
CandidateRelayConfig is the config required to create a new CandidateRelay. Address string CandidateID string Component uint16 Foundation string Network string OnClose func() error Port int Priority uint32 RelAddr string RelPort int RelayProtocol string func NewCandidateRelay(config *CandidateRelayConfig) (*CandidateRelay, error)
CandidateServerReflexive ... (*CandidateServerReflexive) AddExtension(ext CandidateExtension) error Address returns Candidate Address. Component returns candidate component. Deadline implements context.Context. DeepEqual is same as Equal but also compares the extensions. Done implements context.Context. Equal is used to compare two candidateBases. Err implements context.Context. (*CandidateServerReflexive) Extensions() []CandidateExtension (*CandidateServerReflexive) Foundation() string Get returns the value of the given key if it exists. ID returns Candidate ID. LastReceived returns a time.Time indicating the last time this candidate was received. LastSent returns a time.Time indicating the last time this candidate was sent. LocalPreference returns the local preference for this candidate. Marshal returns the string representation of the ICECandidate. NetworkType returns candidate NetworkType. Port returns Candidate Port. Priority computes the priority for this ICE Candidate See: https://www.rfc-editor.org/rfc/rfc8445#section-5.1.2.1 RelatedAddress returns *CandidateRelatedAddress. (*CandidateServerReflexive) RemoveExtension(key string) (ok bool) (*CandidateServerReflexive) SetComponent(component uint16) String makes the candidateBase printable. (*CandidateServerReflexive) TCPType() TCPType Type returns candidate type. TypePreference returns the type preference for this candidate. Value implements context.Context. *CandidateServerReflexive : Candidate *CandidateServerReflexive : context.Context *CandidateServerReflexive : expvar.Var *CandidateServerReflexive : fmt.Stringer func NewCandidateServerReflexive(config *CandidateServerReflexiveConfig) (*CandidateServerReflexive, error)
CandidateServerReflexiveConfig is the config required to create a new CandidateServerReflexive. Address string CandidateID string Component uint16 Foundation string Network string Port int Priority uint32 RelAddr string RelPort int func NewCandidateServerReflexive(config *CandidateServerReflexiveConfig) (*CandidateServerReflexive, error)
CandidateStats contains ICE candidate statistics related to the ICETransport objects. CandidateType is the "Type" field of the ICECandidate. Deleted is true if the candidate has been deleted/freed. For host candidates, this means that any network resources (typically a socket) associated with the candidate have been released. For TURN candidates, this means the TURN allocation is no longer active. Only defined for local candidates. For remote candidates, this property is not applicable. ID is the candidate ID IP is the IP address of the candidate, allowing for IPv4 addresses and IPv6 addresses, but fully qualified domain names (FQDNs) are not allowed. NetworkType represents the type of network interface used by the base of a local candidate (the address the ICE agent sends from). Only present for local candidates; it's not possible to know what type of network interface a remote candidate is using. Note: This stat only tells you about the network interface used by the first "hop"; it's possible that a connection will be bottlenecked by another type of network. For example, when using Wi-Fi tethering, the networkType of the relevant candidate would be "wifi", even when the next hop is over a cellular connection. Port is the port number of the candidate. Priority is the "Priority" field of the ICECandidate. RelayProtocol is the protocol used by the endpoint to communicate with the TURN server. This is only present for local candidates. Valid values for the TURN URL protocol is one of UDP, TCP, or TLS. Timestamp is the timestamp associated with this object. URL is the URL of the TURN or STUN server indicated in the that translated this IP address. It is the URL address surfaced in an PeerConnectionICEEvent. func (*Agent).GetLocalCandidatesStats() []CandidateStats func (*Agent).GetRemoteCandidatesStats() []CandidateStats
CandidateType represents the type of candidate. Preference returns the preference weight of a CandidateType 4.1.2.2. Guidelines for Choosing Type and Local Preferences The RECOMMENDED values are 126 for host candidates, 100 for server reflexive candidates, 110 for peer reflexive candidates, and 0 for relayed candidates. String makes CandidateType printable. CandidateType : expvar.Var CandidateType : fmt.Stringer func Candidate.Type() CandidateType const CandidateTypeHost const CandidateTypePeerReflexive const CandidateTypeRelay const CandidateTypeServerReflexive const CandidateTypeUnspecified
Conn represents the ICE connection. At the moment the lifetime of the Conn is equal to the Agent. BytesReceived returns the number of bytes received. BytesSent returns the number of bytes sent. Close implements the Conn Close method. It is used to close the connection. Any calls to Read and Write will be unblocked and return an error. LocalAddr returns the local address of the current selected pair or nil if there is none. Read implements the Conn Read method. RemoteAddr returns the remote address of the current selected pair or nil if there is none. SetDeadline is a stub. SetReadDeadline is a stub. SetWriteDeadline is a stub. Write implements the Conn Write method. *Conn : github.com/pion/datachannel.ReadDeadliner *Conn : github.com/pion/datachannel.WriteDeadliner *Conn : github.com/pion/stun.Connection *Conn : github.com/pion/stun/v3.Connection *Conn : github.com/miekg/dns.Writer *Conn : github.com/prometheus/common/expfmt.Closer *Conn : internal/bisect.Writer *Conn : io.Closer *Conn : io.ReadCloser *Conn : io.Reader *Conn : io.ReadWriteCloser *Conn : io.ReadWriter *Conn : io.WriteCloser *Conn : io.Writer *Conn : net.Conn func (*Agent).Accept(ctx context.Context, remoteUfrag, remotePwd string) (*Conn, error) func (*Agent).Dial(ctx context.Context, remoteUfrag, remotePwd string) (*Conn, error)
ConnectionState is an enum showing the state of a ICE Connection. ( ConnectionState) String() string ConnectionState : expvar.Var ConnectionState : fmt.Stringer const ConnectionStateChecking const ConnectionStateClosed const ConnectionStateCompleted const ConnectionStateConnected const ConnectionStateDisconnected const ConnectionStateFailed const ConnectionStateNew const ConnectionStateUnknown
GatheringState describes the state of the candidate gathering process. ( GatheringState) String() string GatheringState : expvar.Var GatheringState : fmt.Stringer const GatheringStateComplete const GatheringStateGathering const GatheringStateNew const GatheringStateUnknown
MulticastDNSMode represents the different Multicast modes ICE can run in. func github.com/pion/webrtc/v4.(*SettingEngine).SetICEMulticastDNSMode(multicastDNSMode MulticastDNSMode) const MulticastDNSModeDisabled const MulticastDNSModeQueryAndGather const MulticastDNSModeQueryOnly
MultiTCPMuxDefault implements both TCPMux and AllConnsGetter, allowing users to pass multiple TCPMux instances to the ICE agent configuration. Close the multi mux, no further connections could be created. GetAllConns returns a PacketConn for each underlying TCPMux. GetConnByUfrag returns a PacketConn given the connection's ufrag, network and local address creates the connection if an existing one can't be found. This, unlike GetAllConns, will only return a single PacketConn from the first mux that was passed in to NewMultiTCPMuxDefault. RemoveConnByUfrag stops and removes the muxed packet connection from all underlying TCPMux instances. *MultiTCPMuxDefault : AllConnsGetter *MultiTCPMuxDefault : TCPMux *MultiTCPMuxDefault : github.com/prometheus/common/expfmt.Closer *MultiTCPMuxDefault : io.Closer func NewMultiTCPMuxDefault(muxes ...TCPMux) *MultiTCPMuxDefault
MultiUDPMuxDefault implements both UDPMux and AllConnsGetter, allowing users to pass multiple UDPMux instances to the ICE agent configuration. Close the multi mux, no further connections could be created. GetConn returns a PacketConn given the connection's ufrag and network creates the connection if an existing one can't be found. GetListenAddresses returns the list of addresses that this mux is listening on. RemoveConnByUfrag stops and removes the muxed packet connection from all underlying UDPMux instances. *MultiUDPMuxDefault : UDPMux *MultiUDPMuxDefault : github.com/prometheus/common/expfmt.Closer *MultiUDPMuxDefault : io.Closer func NewMultiUDPMuxDefault(muxes ...UDPMux) *MultiUDPMuxDefault func NewMultiUDPMuxFromPort(port int, opts ...UDPMuxFromPortOption) (*MultiUDPMuxDefault, error)
NetworkType represents the type of network. IsIPv4 returns whether the network type is IPv4 or not. IsIPv6 returns whether the network type is IPv6 or not. IsReliable returns true if the network is reliable. IsTCP returns true when network is TCP4 or TCP6. IsUDP returns true when network is UDP4 or UDP6. NetworkShort returns the short network description. ( NetworkType) String() string NetworkType : expvar.Var NetworkType : fmt.Stringer func Candidate.NetworkType() NetworkType func UDPMuxFromPortWithNetworks(networks ...NetworkType) UDPMuxFromPortOption const NetworkTypeTCP4 const NetworkTypeTCP6 const NetworkTypeUDP4 const NetworkTypeUDP6
PriorityAttr represents PRIORITY attribute. AddTo adds PRIORITY attribute to message. GetFrom decodes PRIORITY attribute from message. *PriorityAttr : github.com/pion/stun/v3.Getter PriorityAttr : github.com/pion/stun/v3.Setter
ProtoType indicates the transport protocol type that is used in the ice.URL structure. Deprecated: TPlease use pion/stun.ProtoType.
Role represents ICE agent role, which can be controlling or controlled. MarshalText implements TextMarshaler. ( Role) String() string UnmarshalText implements TextUnmarshaler. Role : encoding.TextMarshaler *Role : encoding.TextUnmarshaler Role : expvar.Var Role : fmt.Stringer const Controlled const Controlling
SchemeType indicates the type of server used in the ice.URL structure. Deprecated: Please use pion/stun.SchemeType.
TCPMux is allows grouping multiple TCP net.Conns and using them like UDP net.PacketConns. The main implementation of this is TCPMuxDefault, and this interface exists to allow mocking in tests. ( TCPMux) Close() error ( TCPMux) GetConnByUfrag(ufrag string, isIPv6 bool, local net.IP) (net.PacketConn, error) ( TCPMux) RemoveConnByUfrag(ufrag string) *MultiTCPMuxDefault *TCPMuxDefault TCPMux : github.com/prometheus/common/expfmt.Closer TCPMux : io.Closer func github.com/pion/webrtc/v4.NewICETCPMux(logger logging.LeveledLogger, listener net.Listener, readBufferSize int) TCPMux func NewMultiTCPMuxDefault(muxes ...TCPMux) *MultiTCPMuxDefault func github.com/pion/webrtc/v4.(*SettingEngine).SetICETCPMux(tcpMux TCPMux)
TCPMuxDefault muxes TCP net.Conns into net.PacketConns and groups them by Ufrag. It is a default implementation of TCPMux interface. Close closes the listener and waits for all goroutines to exit. GetConnByUfrag retrieves an existing or creates a new net.PacketConn. LocalAddr returns the listening address of this TCPMuxDefault. RemoveConnByUfrag closes and removes a net.PacketConn by Ufrag. *TCPMuxDefault : TCPMux *TCPMuxDefault : github.com/prometheus/common/expfmt.Closer *TCPMuxDefault : io.Closer func NewTCPMuxDefault(params TCPMuxParams) *TCPMuxDefault
TCPMuxParams are parameters for TCPMux. TCPMux will create connection from STUN binding request with an unknown username, if the connection is not used in the timeout, it will be removed to avoid resource leak / attack. Default 30s timeout will be used if not set. A new established connection will be removed if the first STUN binding request is not received within this timeout, avoiding the client with bad network or attacker to create a lot of empty connections. Default 30s timeout will be used if not set. Listener net.Listener Logger logging.LeveledLogger ReadBufferSize int Maximum buffer size for write op. 0 means no write buffer, the write op will block until the whole packet is written if the write buffer is full, the subsequent write packet will be dropped until it has enough space. a default 4MB is recommended. func NewTCPMuxDefault(params TCPMuxParams) *TCPMuxDefault
TCPType is the type of ICE TCP candidate as described in https://tools.ietf.org/html/rfc6544#section-4.5 ( TCPType) String() string TCPType : expvar.Var TCPType : fmt.Stringer func NewTCPType(value string) TCPType func Candidate.TCPType() TCPType const TCPTypeActive const TCPTypePassive const TCPTypeSimultaneousOpen const TCPTypeUnspecified
UDPMux allows multiple connections to go over a single UDP port. ( UDPMux) Close() error ( UDPMux) GetConn(ufrag string, addr net.Addr) (net.PacketConn, error) ( UDPMux) GetListenAddresses() []net.Addr ( UDPMux) RemoveConnByUfrag(ufrag string) *MultiUDPMuxDefault *UDPMuxDefault UniversalUDPMux (interface) UniversalUDPMuxDefault *github.com/libp2p/go-libp2p/p2p/transport/webrtc/udpmux.UDPMux UDPMux : github.com/prometheus/common/expfmt.Closer UDPMux : io.Closer func github.com/pion/webrtc/v4.NewICEUDPMux(logger logging.LeveledLogger, udpConn net.PacketConn) UDPMux func NewMultiUDPMuxDefault(muxes ...UDPMux) *MultiUDPMuxDefault func github.com/pion/webrtc/v4.(*SettingEngine).SetICEUDPMux(udpMux UDPMux)
UDPMuxDefault is an implementation of the interface. Close the mux, no further connections could be created. GetConn returns a PacketConn given the connection's ufrag and network address. creates the connection if an existing one can't be found. GetListenAddresses returns the list of addresses that this mux is listening on. IsClosed returns true if the mux had been closed. LocalAddr returns the listening address of this UDPMuxDefault. RemoveConnByUfrag stops and removes the muxed packet connection. *UDPMuxDefault : UDPMux *UDPMuxDefault : github.com/prometheus/common/expfmt.Closer *UDPMuxDefault : io.Closer func NewUDPMuxDefault(params UDPMuxParams) *UDPMuxDefault
UDPMuxFromPortOption provide options for NewMultiUDPMuxFromPort. func UDPMuxFromPortWithInterfaceFilter(f func(string) (keep bool)) UDPMuxFromPortOption func UDPMuxFromPortWithIPFilter(f func(ip net.IP) (keep bool)) UDPMuxFromPortOption func UDPMuxFromPortWithLogger(logger logging.LeveledLogger) UDPMuxFromPortOption func UDPMuxFromPortWithLoopback() UDPMuxFromPortOption func UDPMuxFromPortWithNet(n transport.Net) UDPMuxFromPortOption func UDPMuxFromPortWithNetworks(networks ...NetworkType) UDPMuxFromPortOption func UDPMuxFromPortWithReadBufferSize(size int) UDPMuxFromPortOption func UDPMuxFromPortWithWriteBufferSize(size int) UDPMuxFromPortOption func NewMultiUDPMuxFromPort(port int, opts ...UDPMuxFromPortOption) (*MultiUDPMuxDefault, error)
UDPMuxParams are parameters for UDPMux. Logger logging.LeveledLogger Required for gathering local addresses in case a un UDPConn is passed which does not bind to a specific local address. UDPConn net.PacketConn UDPConnString string func NewUDPMuxDefault(params UDPMuxParams) *UDPMuxDefault
UniversalUDPMux allows multiple connections to go over a single UDP port for host, server reflexive and relayed candidates. Actual connection muxing is happening in the UDPMux. ( UniversalUDPMux) Close() error ( UniversalUDPMux) GetConn(ufrag string, addr net.Addr) (net.PacketConn, error) ( UniversalUDPMux) GetConnForURL(ufrag string, url string, addr net.Addr) (net.PacketConn, error) ( UniversalUDPMux) GetListenAddresses() []net.Addr ( UniversalUDPMux) GetRelayedAddr(turnAddr net.Addr, deadline time.Duration) (*net.Addr, error) ( UniversalUDPMux) GetXORMappedAddr(stunAddr net.Addr, deadline time.Duration) (*stun.XORMappedAddress, error) ( UniversalUDPMux) RemoveConnByUfrag(ufrag string) *UniversalUDPMuxDefault UniversalUDPMux : UDPMux UniversalUDPMux : github.com/prometheus/common/expfmt.Closer UniversalUDPMux : io.Closer
UniversalUDPMuxDefault handles STUN and TURN servers packets by wrapping the original UDPConn overriding ReadFrom. It the passes packets to the UDPMux that does the actual connection muxing. UDPMuxDefault *UDPMuxDefault Close the mux, no further connections could be created. GetConn returns a PacketConn given the connection's ufrag and network address. creates the connection if an existing one can't be found. GetConnForURL add uniques to the muxed connection by concatenating ufrag and URL (e.g. STUN URL) to be able to support multiple STUN/TURN servers and return a unique connection per server. GetListenAddresses returns the list of addresses that this mux is listening on. GetRelayedAddr creates relayed connection to the given TURN service and returns the relayed addr. Not implemented yet. GetXORMappedAddr returns *stun.XORMappedAddress if already present for a given STUN server. Makes a STUN binding request to discover mapped address otherwise. Blocks until the stun.XORMappedAddress has been discovered or deadline. Method is safe for concurrent use. IsClosed returns true if the mux had been closed. LocalAddr returns the listening address of this UDPMuxDefault. RemoveConnByUfrag stops and removes the muxed packet connection. UniversalUDPMuxDefault : UDPMux *UniversalUDPMuxDefault : UniversalUDPMux UniversalUDPMuxDefault : github.com/prometheus/common/expfmt.Closer UniversalUDPMuxDefault : io.Closer func NewUniversalUDPMuxDefault(params UniversalUDPMuxParams) *UniversalUDPMuxDefault
UniversalUDPMuxParams are parameters for UniversalUDPMux server reflexive. Logger logging.LeveledLogger Net transport.Net UDPConn net.PacketConn XORMappedAddrCacheTTL time.Duration func NewUniversalUDPMuxDefault(params UniversalUDPMuxParams) *UniversalUDPMuxDefault
URL represents a STUN (rfc7064) or TURN (rfc7065) URI. Deprecated: Please use pion/stun.URI.
UseCandidateAttr represents USE-CANDIDATE attribute. AddTo adds USE-CANDIDATE attribute to message. IsSet returns true if USE-CANDIDATE attribute is set. UseCandidateAttr : github.com/pion/stun/v3.Setter func UseCandidate() UseCandidateAttr
Package-Level Functions (total 22)
NewAgent creates a new Agent.
NewCandidateHost creates a new host candidate.
NewCandidatePeerReflexive creates a new peer reflective candidate.
NewCandidateRelay creates a new relay candidate.
NewCandidateServerReflexive creates a new server reflective candidate.
NewMultiTCPMuxDefault creates an instance of MultiTCPMuxDefault that uses the provided TCPMux instances.
NewMultiUDPMuxDefault creates an instance of MultiUDPMuxDefault that uses the provided UDPMux instances.
NewMultiUDPMuxFromPort creates an instance of MultiUDPMuxDefault that listen all interfaces on the provided port.
NewTCPMuxDefault creates a new instance of TCPMuxDefault.
NewTCPType creates a new TCPType from string.
NewUDPMuxDefault creates an implementation of UDPMux.
NewUniversalUDPMuxDefault creates an implementation of UniversalUDPMux embedding UDPMux.
UDPMuxFromPortWithInterfaceFilter set the filter to filter out interfaces that should not be used.
UDPMuxFromPortWithIPFilter set the filter to filter out IP addresses that should not be used.
UDPMuxFromPortWithLogger set the logger for the created UDPMux.
UDPMuxFromPortWithLoopback set loopback interface should be included.
UDPMuxFromPortWithNet sets the network transport to use.
UDPMuxFromPortWithNetworks set the networks that should be used. default is both IPv4 and IPv6.
UDPMuxFromPortWithReadBufferSize set the UDP connection read buffer size.
UDPMuxFromPortWithWriteBufferSize set the UDP connection write buffer size.
UnmarshalCandidate Parses a candidate from a string https://datatracker.ietf.org/doc/html/rfc5245#section-15.1
UseCandidate is shorthand for UseCandidateAttr.
Package-Level Variables (total 37)
ErrAddressParseFailed indicates we were unable to parse a candidate address.
ErrCanceledByCaller indicates agent connection was canceled by the caller.
ErrClosed indicates the agent is closed.
ErrDetermineNetworkType indicates that the NetworkType was not able to be parsed.
ErrExternalMappedIPNotFound in NAT1To1IPMapping.
ErrGetTransportAddress can't convert net.Addr to underlying type (UDPAddr or TCPAddr).
ErrHost indicates malformed hostname is provided.
ErrIneffectiveNAT1To1IPMappingHost indicates that 1:1 NAT IP mapping for host candidate is requested, but the host candidate type is disabled.
ErrIneffectiveNAT1To1IPMappingSrflx indicates that 1:1 NAT IP mapping for srflx candidate is requested, but the srflx candidate type is disabled.
ErrInvalidMulticastDNSHostName indicates an invalid MulticastDNSHostName.
ErrInvalidNAT1To1IPMapping indicates that the given 1:1 NAT IP mapping is invalid.
ErrInvalidQuery indicates an malformed query is provided.
ErrLiteUsingNonHostCandidates indicates non host candidates were selected for a lite agent.
ErrLocalPwdInsufficientBits indicates local password insufficient bits are provided. Have to be at least 128 bits long.
ErrLocalUfragInsufficientBits indicates local username fragment insufficient bits are provided. Have to be at least 24 bits long.
ErrMulticastDNSWithNAT1To1IPMapping indicates that the mDNS gathering cannot be used along with 1:1 NAT IP mapping for host candidate.
ErrMultipleGatherAttempted indicates GatherCandidates has been called multiple times.
ErrMultipleStart indicates agent was started twice.
ErrNoCandidatePairs indicates agent does not have a valid candidate pair.
ErrNoOnCandidateHandler indicates agent was started without OnCandidate.
ErrPasswordEmpty indicates agent was give TURN URL with an empty Password.
ErrPort indicates malformed port is provided.
ErrProtoType indicates an unsupported transport type was provided.
ErrRemotePwdEmpty indicates agent was started with an empty remote pwd.
ErrRemoteUfragEmpty indicates agent was started with an empty remote ufrag.
ErrRunCanceled indicates a run operation was canceled by its individual done.
ErrSchemeType indicates the scheme type could not be parsed.
ErrSTUNQuery indicates query arguments are provided in a STUN URL.
ErrTCPRemoteAddrAlreadyExists indicates we already have the connection with same remote addr.
ErrUnknownCandidateTyp indicates that a candidate had a unknown type value.
ErrUnknownType indicates an error with Unknown info.
ErrUnsupportedNAT1To1IPCandidateType indicates that the specified NAT1To1IPCandidateType is unsupported.
ErrUselessUrlsProvided indicates that one or more URL was provided to the agent but no host candidate required them.
ErrUsernameEmpty indicates agent was give TURN URL with an empty Username.
NewProtoType defines a procedure for creating a new ProtoType from a raw. string naming the transport protocol type. Deprecated: Please use pion/stun.NewProtoType.
NewSchemeType defines a procedure for creating a new SchemeType from a raw. string naming the scheme type. Deprecated: Please use pion/stun.NewSchemeType.
ParseURL parses a STUN or TURN urls following the ABNF syntax described in. https://tools.ietf.org/html/rfc7064 and https://tools.ietf.org/html/rfc7065 respectively. Deprecated: Please use pion/stun.ParseURI.
Package-Level Constants (total 43)
CandidatePairStateFailed means a check for this pair was already done and failed, either never producing any response or producing an unrecoverable failure response.
CandidatePairStateInProgress means a check has been sent for this pair, but the transaction is in progress.
CandidatePairStateSucceeded means a check for this pair was already done and produced a successful result.
CandidatePairStateWaiting means a check has not been performed for this pair.
CandidateType enum.
CandidateType enum.
CandidateType enum.
CandidateType enum.
CandidateType enum.
ComponentRTCP indicates that the candidate is used for RTCP.
ComponentRTP indicates that the candidate is used for RTP.
ConnectionStateChecking ICE agent has been given local and remote candidates, and is attempting to find a match.
ConnectionStateClosed ICE agent has finished and is no longer handling requests.
ConnectionStateCompleted ICE agent has finished.
ConnectionStateConnected ICE agent has a pairing, but is still checking other pairs.
ConnectionStateDisconnected ICE agent connected successfully, but has entered a failed state.
ConnectionStateFailed ICE agent never could successfully connect.
ConnectionStateNew ICE agent is gathering addresses.
ConnectionStateUnknown represents an unknown state.
Possible ICE agent roles.
Possible ICE agent roles.
GatheringStateComplete indicates candidate gathering has been completed.
GatheringStateGathering indicates candidate gathering is ongoing.
GatheringStateNew indicates candidate gathering is not yet started.
GatheringStateUnknown represents an unknown state.
MulticastDNSModeDisabled means remote mDNS candidates will be discarded, and local host candidates will use IPs.
MulticastDNSModeQueryAndGather means remote mDNS candidates will be accepted, and local host candidates will use mDNS.
MulticastDNSModeQueryOnly means remote mDNS candidates will be accepted, and local host candidates will use IPs.
NetworkTypeTCP4 indicates TCP over IPv4.
NetworkTypeTCP6 indicates TCP over IPv6.
NetworkTypeUDP4 indicates UDP over IPv4.
NetworkTypeUDP6 indicates UDP over IPv6.
ProtoTypeTCP indicates the URL uses a TCP transport. Deprecated: Please use pion/stun.ProtoTypeTCP.
ProtoTypeUDP indicates the URL uses a UDP transport. Deprecated: Please use pion/stun.ProtoTypeUDP.
SchemeTypeSTUN indicates the URL represents a STUN server. Deprecated: Please use pion/stun.SchemeTypeSTUN.
SchemeTypeSTUNS indicates the URL represents a STUNS (secure) server. Deprecated: Please use pion/stun.SchemeTypeSTUNS.
SchemeTypeTURN indicates the URL represents a TURN server. Deprecated: Please use pion/stun.SchemeTypeTURN.
SchemeTypeTURNS indicates the URL represents a TURNS (secure) server. Deprecated: Please use pion/stun.SchemeTypeTURNS.
TCPTypeActive is active TCP candidate, which initiates TCP connections.
TCPTypePassive is passive TCP candidate, only accepts TCP connections.
TCPTypeSimultaneousOpen is like active and passive at the same time.
TCPTypeUnspecified is the default value. For example UDP candidates do not need this field.
Unknown represents and unknown ProtoType or SchemeType. Deprecated: Please use pion/stun.SchemeTypeUnknown or pion/stun.ProtoTypeUnknown.