Documentation ¶
Overview ¶
Package ice implements the Interactive Connectivity Establishment (ICE) protocol defined in rfc5245.
Index ¶
- Constants
- Variables
- type Agent
- func (a *Agent) Accept(ctx context.Context, remoteUfrag, remotePwd string) (*Conn, error)
- func (a *Agent) AddRemoteCandidate(c Candidate) error
- func (a *Agent) Close() error
- func (a *Agent) Dial(ctx context.Context, remoteUfrag, remotePwd string) (*Conn, error)
- func (a *Agent) GatherCandidates() error
- func (a *Agent) GetCandidatePairsStats() []CandidatePairStats
- func (a *Agent) GetLocalCandidates() ([]Candidate, error)
- func (a *Agent) GetLocalCandidatesStats() []CandidateStats
- func (a *Agent) GetLocalUserCredentials() (frag string, pwd string)
- func (a *Agent) GetRemoteCandidatesStats() []CandidateStats
- func (a *Agent) OnCandidate(f func(Candidate)) error
- func (a *Agent) OnConnectionStateChange(f func(ConnectionState)) error
- func (a *Agent) OnSelectedCandidatePairChange(f func(Candidate, Candidate)) error
- type AgentConfig
- type AttrControl
- type AttrControlled
- type AttrControlling
- type Candidate
- type CandidateHost
- func (c *CandidateHost) Address() string
- func (c *CandidateHost) Component() uint16
- func (c *CandidateHost) Equal(other Candidate) bool
- func (c *CandidateHost) ID() string
- func (c *CandidateHost) LastReceived() time.Time
- func (c *CandidateHost) LastSent() time.Time
- func (c *CandidateHost) LocalPreference() uint16
- func (c *CandidateHost) NetworkType() NetworkType
- func (c *CandidateHost) Port() int
- func (c *CandidateHost) Priority() uint32
- func (c *CandidateHost) RelatedAddress() *CandidateRelatedAddress
- func (c *CandidateHost) String() string
- func (c *CandidateHost) Type() CandidateType
- type CandidatePairState
- type CandidatePairStats
- type CandidatePeerReflexive
- func (c *CandidatePeerReflexive) Address() string
- func (c *CandidatePeerReflexive) Component() uint16
- func (c *CandidatePeerReflexive) Equal(other Candidate) bool
- func (c *CandidatePeerReflexive) ID() string
- func (c *CandidatePeerReflexive) LastReceived() time.Time
- func (c *CandidatePeerReflexive) LastSent() time.Time
- func (c *CandidatePeerReflexive) LocalPreference() uint16
- func (c *CandidatePeerReflexive) NetworkType() NetworkType
- func (c *CandidatePeerReflexive) Port() int
- func (c *CandidatePeerReflexive) Priority() uint32
- func (c *CandidatePeerReflexive) RelatedAddress() *CandidateRelatedAddress
- func (c *CandidatePeerReflexive) String() string
- func (c *CandidatePeerReflexive) Type() CandidateType
- type CandidateRelatedAddress
- type CandidateRelay
- func (c *CandidateRelay) Address() string
- func (c *CandidateRelay) Component() uint16
- func (c *CandidateRelay) Equal(other Candidate) bool
- func (c *CandidateRelay) ID() string
- func (c *CandidateRelay) LastReceived() time.Time
- func (c *CandidateRelay) LastSent() time.Time
- func (c *CandidateRelay) LocalPreference() uint16
- func (c *CandidateRelay) NetworkType() NetworkType
- func (c *CandidateRelay) Port() int
- func (c *CandidateRelay) Priority() uint32
- func (c *CandidateRelay) RelatedAddress() *CandidateRelatedAddress
- func (c *CandidateRelay) String() string
- func (c *CandidateRelay) Type() CandidateType
- type CandidateServerReflexive
- func (c *CandidateServerReflexive) Address() string
- func (c *CandidateServerReflexive) Component() uint16
- func (c *CandidateServerReflexive) Equal(other Candidate) bool
- func (c *CandidateServerReflexive) ID() string
- func (c *CandidateServerReflexive) LastReceived() time.Time
- func (c *CandidateServerReflexive) LastSent() time.Time
- func (c *CandidateServerReflexive) LocalPreference() uint16
- func (c *CandidateServerReflexive) NetworkType() NetworkType
- func (c *CandidateServerReflexive) Port() int
- func (c *CandidateServerReflexive) Priority() uint32
- func (c *CandidateServerReflexive) RelatedAddress() *CandidateRelatedAddress
- func (c *CandidateServerReflexive) String() string
- func (c *CandidateServerReflexive) Type() CandidateType
- type CandidateStats
- type CandidateType
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) Read(p []byte) (int, error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) Write(p []byte) (int, error)
- type ConnectionState
- type GatheringState
- type MulticastDNSMode
- type NetworkType
- type PriorityAttr
- type ProtoType
- type Role
- type SchemeType
- type URL
- type UseCandidateAttr
Constants ¶
const ( // ComponentRTP indicates that the candidate is used for RTP ComponentRTP uint16 = 1 // ComponentRTCP indicates that the candidate is used for RTCP ComponentRTCP )
const ( // CandidatePairStateWaiting means a check has not been performed for // this pair CandidatePairStateWaiting = iota + 1 // CandidatePairStateInProgress means a check has been sent for this pair, // but the transaction is in progress. CandidatePairStateInProgress // CandidatePairStateFailed means a check for this pair was already done // and failed, either never producing any response or producing an unrecoverable // failure response. CandidatePairStateFailed // CandidatePairStateSucceeded means a check for this pair was already // done and produced a successful result. CandidatePairStateSucceeded )
const ( // ConnectionStateNew ICE agent is gathering addresses ConnectionStateNew = iota + 1 // ConnectionStateChecking ICE agent has been given local and remote candidates, and is attempting to find a match ConnectionStateChecking // ConnectionStateConnected ICE agent has a pairing, but is still checking other pairs ConnectionStateConnected // ConnectionStateCompleted ICE agent has finished ConnectionStateCompleted // ConnectionStateFailed ICE agent never could successfully connect ConnectionStateFailed // ConnectionStateDisconnected ICE agent connected successfully, but has entered a failed state ConnectionStateDisconnected // ConnectionStateClosed ICE agent has finished and is no longer handling requests ConnectionStateClosed )
List of supported States
const Unknown = iota
Unknown defines default public constant to use for "enum" like struct comparisons when no value was defined.
Variables ¶
var ( // ErrUnknownType indicates an error with Unknown info. ErrUnknownType = errors.New("Unknown") // ErrSchemeType indicates the scheme type could not be parsed. ErrSchemeType = errors.New("unknown scheme type") // ErrSTUNQuery indicates query arguments are provided in a STUN URL. ErrSTUNQuery = errors.New("queries not supported in stun address") // ErrInvalidQuery indicates an malformed query is provided. ErrInvalidQuery = errors.New("invalid query") // ErrHost indicates malformed hostname is provided. ErrHost = errors.New("invalid hostname") // ErrPort indicates malformed port is provided. ErrPort = errors.New("invalid port") // ErrProtoType indicates an unsupported transport type was provided. ErrProtoType = errors.New("invalid transport protocol type") // ErrClosed indicates the agent is closed ErrClosed = errors.New("the agent is closed") // ErrNoCandidatePairs indicates agent does not have a valid candidate pair ErrNoCandidatePairs = errors.New("no candidate pairs available") // ErrCanceledByCaller indicates agent connection was canceled by the caller ErrCanceledByCaller = errors.New("connecting canceled by caller") // ErrMultipleStart indicates agent was started twice ErrMultipleStart = errors.New("attempted to start agent twice") // ErrRemoteUfragEmpty indicates agent was started with an empty remote ufrag ErrRemoteUfragEmpty = errors.New("remote ufrag is empty") // ErrRemotePwdEmpty indicates agent was started with an empty remote pwd ErrRemotePwdEmpty = errors.New("remote pwd is empty") // ErrNoOnCandidateHandler indicates agent was started without OnCandidate // while running in trickle mode. ErrNoOnCandidateHandler = errors.New("no OnCandidate provided") // ErrMultipleGatherAttempted indicates GatherCandidates has been called multiple times ErrMultipleGatherAttempted = errors.New("attempting to gather candidates during gathering state") // ErrUsernameEmpty indicates agent was give TURN URL with an empty Username ErrUsernameEmpty = errors.New("username is empty") // ErrPasswordEmpty indicates agent was give TURN URL with an empty Password ErrPasswordEmpty = errors.New("password is empty") // ErrAddressParseFailed indicates we were unable to parse a candidate address ErrAddressParseFailed = errors.New("failed to parse address") )
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent represents the ICE agent
func (*Agent) Accept ¶
Accept connects to the remote agent, acting as the controlled ice agent. Accept blocks until at least one ice candidate pair has successfully connected.
func (*Agent) AddRemoteCandidate ¶
AddRemoteCandidate adds a new remote candidate
func (*Agent) Dial ¶
Dial connects to the remote agent, acting as the controlling ice agent. Dial blocks until at least one ice candidate pair has successfully connected.
func (*Agent) GatherCandidates ¶ added in v0.3.2
GatherCandidates initiates the trickle based gathering process.
func (*Agent) GetCandidatePairsStats ¶ added in v0.4.1
func (a *Agent) GetCandidatePairsStats() []CandidatePairStats
GetCandidatePairsStats returns a list of candidate pair stats
func (*Agent) GetLocalCandidates ¶
GetLocalCandidates returns the local candidates
func (*Agent) GetLocalCandidatesStats ¶ added in v0.4.1
func (a *Agent) GetLocalCandidatesStats() []CandidateStats
GetLocalCandidatesStats returns a list of local candidates stats
func (*Agent) GetLocalUserCredentials ¶
GetLocalUserCredentials returns the local user credentials
func (*Agent) GetRemoteCandidatesStats ¶ added in v0.4.1
func (a *Agent) GetRemoteCandidatesStats() []CandidateStats
GetRemoteCandidatesStats returns a list of remote candidates stats
func (*Agent) OnCandidate ¶ added in v0.3.2
OnCandidate sets a handler that is fired when new candidates gathered. When the gathering process complete the last candidate is nil.
func (*Agent) OnConnectionStateChange ¶
func (a *Agent) OnConnectionStateChange(f func(ConnectionState)) error
OnConnectionStateChange sets a handler that is fired when the connection state changes
type AgentConfig ¶
type AgentConfig struct { Urls []*URL // PortMin and PortMax are optional. Leave them 0 for the default UDP port allocation strategy. PortMin uint16 PortMax uint16 // Trickle specifies whether or not ice agent should trickle candidates or // work perform synchronous gathering. Trickle bool // MulticastDNSMode controls mDNS behavior for the ICE agent MulticastDNSMode MulticastDNSMode // ConnectionTimeout defaults to 30 seconds when this property is nil. // If the duration is 0, we will never timeout this connection. ConnectionTimeout *time.Duration // KeepaliveInterval determines how often should we send ICE // keepalives (should be less then connectiontimeout above) // when this is nil, it defaults to 10 seconds. // A keepalive interval of 0 means we never send keepalive packets KeepaliveInterval *time.Duration // NetworkTypes is an optional configuration for disabling or enabling // support for specific network types. NetworkTypes []NetworkType // CandidateTypes is an optional configuration for disabling or enabling // support for specific candidate types. CandidateTypes []CandidateType 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 MaxBindingRequests *uint16 // CandidatesSelectionTimeout specify a timeout for selecting candidates, if no nomination has happen // before this timeout, once hit we will nominate the best valid candidate available, // or mark the connection as failed if no valid candidate is available CandidateSelectionTimeout *time.Duration // HostAcceptanceMinWait specify a minimum wait time before selecting host candidates HostAcceptanceMinWait *time.Duration // HostAcceptanceMinWait specify a minimum wait time before selecting srflx candidates SrflxAcceptanceMinWait *time.Duration // HostAcceptanceMinWait specify a minimum wait time before selecting prflx candidates PrflxAcceptanceMinWait *time.Duration // HostAcceptanceMinWait specify a minimum wait time before selecting relay candidates RelayAcceptanceMinWait *time.Duration // contains filtered or unexported fields }
AgentConfig collects the arguments to ice.Agent construction into a single structure, for future-proofness of the interface
type AttrControl ¶ added in v0.2.9
AttrControl is helper that wraps ICE-{CONTROLLED,CONTROLLING}.
type AttrControlled ¶ added in v0.2.9
type AttrControlled uint64
AttrControlled represents ICE-CONTROLLED attribute.
type AttrControlling ¶ added in v0.2.9
type AttrControlling uint64
AttrControlling represents ICE-CONTROLLING attribute.
type Candidate ¶
type Candidate interface { ID() string Component() uint16 Address() string LastReceived() time.Time LastSent() time.Time NetworkType() NetworkType Port() int Priority() uint32 RelatedAddress() *CandidateRelatedAddress String() string Type() CandidateType Equal(other Candidate) bool // contains filtered or unexported methods }
Candidate represents an ICE candidate
type CandidateHost ¶ added in v0.3.0
type CandidateHost struct {
// contains filtered or unexported fields
}
CandidateHost is a candidate of type host
func NewCandidateHost ¶
func NewCandidateHost(network string, address string, port int, component uint16) (*CandidateHost, error)
NewCandidateHost creates a new host candidate
func (*CandidateHost) Address ¶ added in v0.4.0
func (c *CandidateHost) Address() string
Address returns Candidate Address
func (*CandidateHost) Component ¶ added in v0.3.0
func (c *CandidateHost) Component() uint16
Component returns candidate component
func (*CandidateHost) ID ¶ added in v0.4.1
func (c *CandidateHost) ID() string
ID returns Candidate ID
func (*CandidateHost) LastReceived ¶ added in v0.3.0
LastReceived returns a time.Time indicating the last time this candidate was received
func (*CandidateHost) LastSent ¶ added in v0.3.0
LastSent returns a time.Time indicating the last time this candidate was sent
func (*CandidateHost) LocalPreference ¶ added in v0.3.0
func (c *CandidateHost) LocalPreference() uint16
LocalPreference returns the local preference for this candidate
func (*CandidateHost) NetworkType ¶ added in v0.3.0
func (c *CandidateHost) NetworkType() NetworkType
NetworkType returns candidate NetworkType
func (*CandidateHost) Port ¶ added in v0.3.0
func (c *CandidateHost) Port() int
Port returns Candidate Port
func (*CandidateHost) Priority ¶ added in v0.3.0
func (c *CandidateHost) Priority() uint32
Priority computes the priority for this ICE Candidate
func (*CandidateHost) RelatedAddress ¶ added in v0.3.0
func (c *CandidateHost) RelatedAddress() *CandidateRelatedAddress
RelatedAddress returns *CandidateRelatedAddress
func (*CandidateHost) String ¶ added in v0.3.0
func (c *CandidateHost) String() string
String makes the candidateBase printable
func (*CandidateHost) Type ¶ added in v0.3.0
func (c *CandidateHost) Type() CandidateType
Type returns candidate type
type CandidatePairState ¶ added in v0.4.1
type CandidatePairState int
CandidatePairState represent the ICE candidate pair state
func (CandidatePairState) String ¶ added in v0.4.1
func (c CandidatePairState) String() string
type CandidatePairStats ¶ added in v0.4.1
type CandidatePairStats struct { // Timestamp is the timestamp associated with this object. Timestamp time.Time // LocalCandidateID is the ID of the local candidate LocalCandidateID string // RemoteCandidateID is the ID of the remote candidate RemoteCandidateID string // State represents the state of the checklist for the local and remote // candidates in a pair. State CandidatePairState // 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 Nominated bool // PacketsSent represents the total number of packets sent on this candidate pair. PacketsSent uint32 // PacketsReceived represents the total number of packets received on this candidate pair. PacketsReceived uint32 // BytesSent represents the total number of payload bytes sent on this candidate pair // not including headers or padding. BytesSent uint64 // BytesReceived represents the total number of payload bytes received on this candidate pair // not including headers or padding. BytesReceived uint64 // LastPacketSentTimestamp represents the timestamp at which the last packet was // sent on this particular candidate pair, excluding STUN packets. LastPacketSentTimestamp time.Time // LastPacketReceivedTimestamp represents the timestamp at which the last packet // was received on this particular candidate pair, excluding STUN packets. LastPacketReceivedTimestamp time.Time // FirstRequestTimestamp represents the timestamp at which the first STUN request // was sent on this particular candidate pair. FirstRequestTimestamp time.Time // 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. LastRequestTimestamp time.Time // LastResponseTimestamp represents the timestamp at which the last STUN response // was received on this particular candidate pair. LastResponseTimestamp time.Time // 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. TotalRoundTripTime float64 // CurrentRoundTripTime represents the latest round trip time measured in seconds, // computed from both STUN connectivity checks, including those that are sent // for consent verification. CurrentRoundTripTime float64 // 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. AvailableOutgoingBitrate float64 // 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. AvailableIncomingBitrate float64 // CircuitBreakerTriggerCount represents the number of times the circuit breaker // is triggered for this particular 5-tuple, ceasing transmission. CircuitBreakerTriggerCount uint32 // 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. RequestsReceived uint64 // RequestsSent represents the total number of connectivity check requests // sent (not including retransmissions). RequestsSent uint64 // ResponsesReceived represents the total number of connectivity check responses received. ResponsesReceived uint64 // ResponsesSent epresents the total number of connectivity check responses sent. // Since we cannot distinguish connectivity check requests and consent requests, // all responses are counted. ResponsesSent uint64 // RetransmissionsReceived represents the total number of connectivity check // request retransmissions received. RetransmissionsReceived uint64 // RetransmissionsSent represents the total number of connectivity check // request retransmissions sent. RetransmissionsSent uint64 // ConsentRequestsSent represents the total number of consent requests sent. ConsentRequestsSent uint64 // ConsentExpiredTimestamp represents the timestamp at which the latest valid // STUN binding response expired. ConsentExpiredTimestamp time.Time }
CandidatePairStats contains ICE candidate pair statistics
type CandidatePeerReflexive ¶ added in v0.3.0
type CandidatePeerReflexive struct {
// contains filtered or unexported fields
}
CandidatePeerReflexive ...
func NewCandidatePeerReflexive ¶
func NewCandidatePeerReflexive(network string, address string, port int, component uint16, relAddr string, relPort int) (*CandidatePeerReflexive, error)
NewCandidatePeerReflexive creates a new peer reflective candidate
func (*CandidatePeerReflexive) Address ¶ added in v0.4.0
func (c *CandidatePeerReflexive) Address() string
Address returns Candidate Address
func (*CandidatePeerReflexive) Component ¶ added in v0.3.0
func (c *CandidatePeerReflexive) Component() uint16
Component returns candidate component
func (*CandidatePeerReflexive) ID ¶ added in v0.4.1
func (c *CandidatePeerReflexive) ID() string
ID returns Candidate ID
func (*CandidatePeerReflexive) LastReceived ¶ added in v0.3.0
LastReceived returns a time.Time indicating the last time this candidate was received
func (*CandidatePeerReflexive) LastSent ¶ added in v0.3.0
LastSent returns a time.Time indicating the last time this candidate was sent
func (*CandidatePeerReflexive) LocalPreference ¶ added in v0.3.0
func (c *CandidatePeerReflexive) LocalPreference() uint16
LocalPreference returns the local preference for this candidate
func (*CandidatePeerReflexive) NetworkType ¶ added in v0.3.0
func (c *CandidatePeerReflexive) NetworkType() NetworkType
NetworkType returns candidate NetworkType
func (*CandidatePeerReflexive) Port ¶ added in v0.3.0
func (c *CandidatePeerReflexive) Port() int
Port returns Candidate Port
func (*CandidatePeerReflexive) Priority ¶ added in v0.3.0
func (c *CandidatePeerReflexive) Priority() uint32
Priority computes the priority for this ICE Candidate
func (*CandidatePeerReflexive) RelatedAddress ¶ added in v0.3.0
func (c *CandidatePeerReflexive) RelatedAddress() *CandidateRelatedAddress
RelatedAddress returns *CandidateRelatedAddress
func (*CandidatePeerReflexive) String ¶ added in v0.3.0
func (c *CandidatePeerReflexive) String() string
String makes the candidateBase printable
func (*CandidatePeerReflexive) Type ¶ added in v0.3.0
func (c *CandidatePeerReflexive) Type() CandidateType
Type returns candidate type
type CandidateRelatedAddress ¶
CandidateRelatedAddress convey transport addresses related to the candidate, useful for diagnostics and other purposes.
func (*CandidateRelatedAddress) Equal ¶
func (c *CandidateRelatedAddress) Equal(other *CandidateRelatedAddress) bool
Equal allows comparing two CandidateRelatedAddresses. The CandidateRelatedAddress are allowed to be nil.
func (*CandidateRelatedAddress) String ¶
func (c *CandidateRelatedAddress) String() string
String makes CandidateRelatedAddress printable
type CandidateRelay ¶ added in v0.3.0
type CandidateRelay struct {
// contains filtered or unexported fields
}
CandidateRelay ...
func NewCandidateRelay ¶
func NewCandidateRelay(network string, address string, port int, component uint16, relAddr string, relPort int) (*CandidateRelay, error)
NewCandidateRelay creates a new relay candidate
func (*CandidateRelay) Address ¶ added in v0.4.0
func (c *CandidateRelay) Address() string
Address returns Candidate Address
func (*CandidateRelay) Component ¶ added in v0.3.0
func (c *CandidateRelay) Component() uint16
Component returns candidate component
func (*CandidateRelay) ID ¶ added in v0.4.1
func (c *CandidateRelay) ID() string
ID returns Candidate ID
func (*CandidateRelay) LastReceived ¶ added in v0.3.0
LastReceived returns a time.Time indicating the last time this candidate was received
func (*CandidateRelay) LastSent ¶ added in v0.3.0
LastSent returns a time.Time indicating the last time this candidate was sent
func (*CandidateRelay) LocalPreference ¶ added in v0.3.0
func (c *CandidateRelay) LocalPreference() uint16
LocalPreference returns the local preference for this candidate
func (*CandidateRelay) NetworkType ¶ added in v0.3.0
func (c *CandidateRelay) NetworkType() NetworkType
NetworkType returns candidate NetworkType
func (*CandidateRelay) Port ¶ added in v0.3.0
func (c *CandidateRelay) Port() int
Port returns Candidate Port
func (*CandidateRelay) Priority ¶ added in v0.3.0
func (c *CandidateRelay) Priority() uint32
Priority computes the priority for this ICE Candidate
func (*CandidateRelay) RelatedAddress ¶ added in v0.3.0
func (c *CandidateRelay) RelatedAddress() *CandidateRelatedAddress
RelatedAddress returns *CandidateRelatedAddress
func (*CandidateRelay) String ¶ added in v0.3.0
func (c *CandidateRelay) String() string
String makes the candidateBase printable
func (*CandidateRelay) Type ¶ added in v0.3.0
func (c *CandidateRelay) Type() CandidateType
Type returns candidate type
type CandidateServerReflexive ¶ added in v0.3.0
type CandidateServerReflexive struct {
// contains filtered or unexported fields
}
CandidateServerReflexive ...
func NewCandidateServerReflexive ¶
func NewCandidateServerReflexive(network string, address string, port int, component uint16, relAddr string, relPort int) (*CandidateServerReflexive, error)
NewCandidateServerReflexive creates a new server reflective candidate
func (*CandidateServerReflexive) Address ¶ added in v0.4.0
func (c *CandidateServerReflexive) Address() string
Address returns Candidate Address
func (*CandidateServerReflexive) Component ¶ added in v0.3.0
func (c *CandidateServerReflexive) Component() uint16
Component returns candidate component
func (*CandidateServerReflexive) Equal ¶ added in v0.3.0
Equal is used to compare two candidateBases
func (*CandidateServerReflexive) ID ¶ added in v0.4.1
func (c *CandidateServerReflexive) ID() string
ID returns Candidate ID
func (*CandidateServerReflexive) LastReceived ¶ added in v0.3.0
LastReceived returns a time.Time indicating the last time this candidate was received
func (*CandidateServerReflexive) LastSent ¶ added in v0.3.0
LastSent returns a time.Time indicating the last time this candidate was sent
func (*CandidateServerReflexive) LocalPreference ¶ added in v0.3.0
func (c *CandidateServerReflexive) LocalPreference() uint16
LocalPreference returns the local preference for this candidate
func (*CandidateServerReflexive) NetworkType ¶ added in v0.3.0
func (c *CandidateServerReflexive) NetworkType() NetworkType
NetworkType returns candidate NetworkType
func (*CandidateServerReflexive) Port ¶ added in v0.3.0
func (c *CandidateServerReflexive) Port() int
Port returns Candidate Port
func (*CandidateServerReflexive) Priority ¶ added in v0.3.0
func (c *CandidateServerReflexive) Priority() uint32
Priority computes the priority for this ICE Candidate
func (*CandidateServerReflexive) RelatedAddress ¶ added in v0.3.0
func (c *CandidateServerReflexive) RelatedAddress() *CandidateRelatedAddress
RelatedAddress returns *CandidateRelatedAddress
func (*CandidateServerReflexive) String ¶ added in v0.3.0
func (c *CandidateServerReflexive) String() string
String makes the candidateBase printable
func (*CandidateServerReflexive) Type ¶ added in v0.3.0
func (c *CandidateServerReflexive) Type() CandidateType
Type returns candidate type
type CandidateStats ¶ added in v0.4.1
type CandidateStats struct { // Timestamp is the timestamp associated with this object. Timestamp time.Time // ID is the candidate ID ID string // 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. NetworkType NetworkType // IP is the IP address of the candidate, allowing for IPv4 addresses and // IPv6 addresses, but fully qualified domain names (FQDNs) are not allowed. IP string // Port is the port number of the candidate. Port int // CandidateType is the "Type" field of the ICECandidate. CandidateType CandidateType // Priority is the "Priority" field of the ICECandidate. Priority uint32 // 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. URL string // 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. RelayProtocol string // 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. Deleted bool }
CandidateStats contains ICE candidate statistics related to the ICETransport objects.
type CandidateType ¶
type CandidateType byte
CandidateType represents the type of candidate
const ( CandidateTypeHost CandidateType = iota + 1 CandidateTypeServerReflexive CandidateTypePeerReflexive CandidateTypeRelay )
CandidateType enum
func (CandidateType) Preference ¶
func (c CandidateType) Preference() uint16
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.
func (CandidateType) String ¶
func (c CandidateType) String() string
String makes CandidateType printable
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn represents the ICE connection. At the moment the lifetime of the Conn is equal to the Agent.
func (*Conn) Close ¶
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.
func (*Conn) SetReadDeadline ¶
SetReadDeadline is a stub
func (*Conn) SetWriteDeadline ¶
SetWriteDeadline is a stub
type ConnectionState ¶
type ConnectionState int
ConnectionState is an enum showing the state of a ICE Connection
func (ConnectionState) String ¶
func (c ConnectionState) String() string
type GatheringState ¶
type GatheringState int
GatheringState describes the state of the candidate gathering process
const ( // GatheringStateNew indicates candidate gatering is not yet started GatheringStateNew GatheringState = iota + 1 // GatheringStateGathering indicates candidate gatering is ongoing GatheringStateGathering // GatheringStateComplete indicates candidate gatering has been completed GatheringStateComplete )
func (GatheringState) String ¶
func (t GatheringState) String() string
type MulticastDNSMode ¶ added in v0.4.0
type MulticastDNSMode byte
MulticastDNSMode represents the different Multicast modes ICE can run in
const ( // MulticastDNSModeDisabled means remote mDNS candidates will be discarded, and local host candidates will use IPs MulticastDNSModeDisabled MulticastDNSMode = iota + 1 // MulticastDNSModeQueryOnly means remote mDNS candidates will be accepted, and local host candidates will use IPs MulticastDNSModeQueryOnly // MulticastDNSModeQueryAndGather means remote mDNS candidates will be accepted, and local host candidates will use mDNS MulticastDNSModeQueryAndGather )
MulticastDNSMode enum
type NetworkType ¶
type NetworkType int
NetworkType represents the type of network
const ( // NetworkTypeUDP4 indicates UDP over IPv4. NetworkTypeUDP4 NetworkType = iota + 1 // NetworkTypeUDP6 indicates UDP over IPv6. NetworkTypeUDP6 // NetworkTypeTCP4 indicates TCP over IPv4. NetworkTypeTCP4 // NetworkTypeTCP6 indicates TCP over IPv6. NetworkTypeTCP6 )
func (NetworkType) IsIPv4 ¶
func (t NetworkType) IsIPv4() bool
IsIPv4 returns whether the network type is IPv4 or not.
func (NetworkType) IsIPv6 ¶
func (t NetworkType) IsIPv6() bool
IsIPv6 returns whether the network type is IPv6 or not.
func (NetworkType) IsReliable ¶
func (t NetworkType) IsReliable() bool
IsReliable returns true if the network is reliable
func (NetworkType) NetworkShort ¶
func (t NetworkType) NetworkShort() string
NetworkShort returns the short network description
func (NetworkType) String ¶
func (t NetworkType) String() string
type PriorityAttr ¶ added in v0.2.9
type PriorityAttr uint32
PriorityAttr represents PRIORITY attribute.
type ProtoType ¶
type ProtoType int
ProtoType indicates the transport protocol type that is used in the ice.URL structure.
func NewProtoType ¶
NewProtoType defines a procedure for creating a new ProtoType from a raw string naming the transport protocol type.
type Role ¶ added in v0.2.9
type Role byte
Role represents ICE agent role, which can be controlling or controlled.
func (Role) MarshalText ¶ added in v0.2.9
MarshalText implements TextMarshaler.
func (*Role) UnmarshalText ¶ added in v0.2.9
UnmarshalText implements TextUnmarshaler.
type SchemeType ¶
type SchemeType int
SchemeType indicates the type of server used in the ice.URL structure.
const ( // SchemeTypeSTUN indicates the URL represents a STUN server. SchemeTypeSTUN SchemeType = iota + 1 // SchemeTypeSTUNS indicates the URL represents a STUNS (secure) server. SchemeTypeSTUNS // SchemeTypeTURN indicates the URL represents a TURN server. SchemeTypeTURN // SchemeTypeTURNS indicates the URL represents a TURNS (secure) server. SchemeTypeTURNS )
func NewSchemeType ¶
func NewSchemeType(raw string) SchemeType
NewSchemeType defines a procedure for creating a new SchemeType from a raw string naming the scheme type.
func (SchemeType) String ¶
func (t SchemeType) String() string
type URL ¶
type URL struct { Scheme SchemeType Host string Port int Username string Password string Proto ProtoType }
URL represents a STUN (rfc7064) or TURN (rfc7065) URL
func ParseURL ¶
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.
type UseCandidateAttr ¶ added in v0.2.9
type UseCandidateAttr struct{}
UseCandidateAttr represents USE-CANDIDATE attribute.
var UseCandidate UseCandidateAttr
UseCandidate is shorthand for UseCandidateAttr.
Source Files ¶
- agent.go
- candidate.go
- candidate_base.go
- candidate_host.go
- candidate_peer_reflexive.go
- candidate_relay.go
- candidate_server_reflexive.go
- candidatepair.go
- candidatepair_state.go
- candidaterelatedaddress.go
- candidatetype.go
- errors.go
- gather.go
- ice.go
- icecontrol.go
- mdns.go
- networktype.go
- priority.go
- selection.go
- stats.go
- stun.go
- transport.go
- url.go
- usecandidate.go
- util.go