Versions in this module Expand all Collapse all v1 v1.0.0 May 15, 2020 Changes in this version + const CandidatePairStateFailed + const CandidatePairStateInProgress + const CandidatePairStateSucceeded + const CandidatePairStateWaiting + const ComponentRTCP + const ComponentRTP + const ConnectionStateChecking + const ConnectionStateClosed + const ConnectionStateCompleted + const ConnectionStateConnected + const ConnectionStateDisconnected + const ConnectionStateFailed + const ConnectionStateNew + const Unknown + var ErrAddressParseFailed = errors.New("failed to parse address") + var ErrCanceledByCaller = errors.New("connecting canceled by caller") + var ErrClosed = errors.New("the agent is closed") + var ErrExternalMappedIPNotFound = errors.New("external mapped IP not found") + var ErrHost = errors.New("invalid hostname") + var ErrIneffectiveNAT1To1IPMappingHost = errors.New("1:1 NAT IP mapping for host candidate ineffective") + var ErrIneffectiveNAT1To1IPMappingSrflx = errors.New("1:1 NAT IP mapping for srflx candidate ineffective") + var ErrInvalidMulticastDNSHostName = errors.New(...) + var ErrInvalidNAT1To1IPMapping = errors.New("invalid 1:1 NAT IP mapping") + var ErrInvalidQuery = errors.New("invalid query") + var ErrLiteUsingNonHostCandidates = errors.New("lite agents must only use host candidates") + var ErrLocalPwdInsufficientBits = errors.New("local password is less than 128 bits long") + var ErrLocalUfragInsufficientBits = errors.New("local username fragment is less than 24 bits long") + var ErrMulticastDNSWithNAT1To1IPMapping = errors.New("mDNS gathering cannot be used with 1:1 NAT IP mapping for host candidate") + var ErrMultipleGatherAttempted = errors.New("attempting to gather candidates during gathering state") + var ErrMultipleStart = errors.New("attempted to start agent twice") + var ErrNoCandidatePairs = errors.New("no candidate pairs available") + var ErrNoOnCandidateHandler = errors.New("no OnCandidate provided") + var ErrPasswordEmpty = errors.New("password is empty") + var ErrPort = errors.New("invalid port") + var ErrProtoType = errors.New("invalid transport protocol type") + var ErrRemotePwdEmpty = errors.New("remote pwd is empty") + var ErrRemoteUfragEmpty = errors.New("remote ufrag is empty") + var ErrSTUNQuery = errors.New("queries not supported in stun address") + var ErrSchemeType = errors.New("unknown scheme type") + var ErrUnknownType = errors.New("Unknown") + var ErrUnsupportedNAT1To1IPCandidateType = errors.New("unsupported 1:1 NAT IP candidate type") + var ErrUselessUrlsProvided = errors.New("agent does not need URL with selected candidate types") + var ErrUsernameEmpty = errors.New("username is empty") + type Agent struct + func NewAgent(config *AgentConfig) (*Agent, error) + 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) ForceDisconnect() + 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 struct + CandidateSelectionTimeout *time.Duration + CandidateTypes []CandidateType + ConnectionTimeout *time.Duration + HostAcceptanceMinWait *time.Duration + InsecureSkipVerify bool + InterfaceFilter func(string) bool + KeepaliveInterval *time.Duration + Lite bool + LocalPwd string + LocalUfrag string + LoggerFactory logging.LoggerFactory + MaxBindingRequests *uint16 + MulticastDNSHostName string + MulticastDNSMode MulticastDNSMode + NAT1To1IPCandidateType CandidateType + NAT1To1IPs []string + Net *vnet.Net + NetworkTypes []NetworkType + PortMax uint16 + PortMin uint16 + PrflxAcceptanceMinWait *time.Duration + RelayAcceptanceMinWait *time.Duration + SrflxAcceptanceMinWait *time.Duration + Trickle bool + Urls []*URL + type AttrControl struct + Role Role + Tiebreaker uint64 + func (c *AttrControl) GetFrom(m *stun.Message) error + func (c AttrControl) AddTo(m *stun.Message) error + type AttrControlled uint64 + func (c *AttrControlled) GetFrom(m *stun.Message) error + func (c AttrControlled) AddTo(m *stun.Message) error + type AttrControlling uint64 + func (c *AttrControlling) GetFrom(m *stun.Message) error + func (c AttrControlling) AddTo(m *stun.Message) error + type Candidate interface + Address func() string + Component func() uint16 + Equal func(other Candidate) bool + ID func() string + LastReceived func() time.Time + LastSent func() time.Time + NetworkType func() NetworkType + Port func() int + Priority func() uint32 + RelatedAddress func() *CandidateRelatedAddress + String func() string + Type func() CandidateType + type CandidateHost struct + func NewCandidateHost(config *CandidateHostConfig) (*CandidateHost, error) + 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 CandidateHostConfig struct + Address string + CandidateID string + Component uint16 + Network string + Port int + type CandidatePairState int + func (c CandidatePairState) String() string + type CandidatePairStats struct + AvailableIncomingBitrate float64 + AvailableOutgoingBitrate float64 + BytesReceived uint64 + BytesSent uint64 + CircuitBreakerTriggerCount uint32 + ConsentExpiredTimestamp time.Time + ConsentRequestsSent uint64 + CurrentRoundTripTime float64 + FirstRequestTimestamp time.Time + LastPacketReceivedTimestamp time.Time + LastPacketSentTimestamp time.Time + LastRequestTimestamp time.Time + LastResponseTimestamp time.Time + LocalCandidateID string + Nominated bool + PacketsReceived uint32 + PacketsSent uint32 + RemoteCandidateID string + RequestsReceived uint64 + RequestsSent uint64 + ResponsesReceived uint64 + ResponsesSent uint64 + RetransmissionsReceived uint64 + RetransmissionsSent uint64 + State CandidatePairState + Timestamp time.Time + TotalRoundTripTime float64 + type CandidatePeerReflexive struct + func NewCandidatePeerReflexive(config *CandidatePeerReflexiveConfig) (*CandidatePeerReflexive, error) + 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 CandidatePeerReflexiveConfig struct + Address string + CandidateID string + Component uint16 + Network string + Port int + RelAddr string + RelPort int + type CandidateRelatedAddress struct + Address string + Port int + func (c *CandidateRelatedAddress) Equal(other *CandidateRelatedAddress) bool + func (c *CandidateRelatedAddress) String() string + type CandidateRelay struct + func NewCandidateRelay(config *CandidateRelayConfig) (*CandidateRelay, error) + 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 CandidateRelayConfig struct + Address string + CandidateID string + Component uint16 + Network string + OnClose func() error + Port int + RelAddr string + RelPort int + type CandidateServerReflexive struct + func NewCandidateServerReflexive(config *CandidateServerReflexiveConfig) (*CandidateServerReflexive, error) + 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 CandidateServerReflexiveConfig struct + Address string + CandidateID string + Component uint16 + Network string + Port int + RelAddr string + RelPort int + type CandidateStats struct + CandidateType CandidateType + Deleted bool + ID string + IP string + NetworkType NetworkType + Port int + Priority uint32 + RelayProtocol string + Timestamp time.Time + URL string + type CandidateType byte + const CandidateTypeHost + const CandidateTypePeerReflexive + const CandidateTypeRelay + const CandidateTypeServerReflexive + const CandidateTypeUnspecified + func (c CandidateType) Preference() uint16 + func (c CandidateType) String() string + type Conn struct + func (c *Conn) BytesReceived() uint64 + func (c *Conn) BytesSent() uint64 + 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 int + func (c ConnectionState) String() string + type GatheringState int + const GatheringStateComplete + const GatheringStateGathering + const GatheringStateNew + func (t GatheringState) String() string + type MulticastDNSMode byte + const MulticastDNSModeDisabled + const MulticastDNSModeQueryAndGather + const MulticastDNSModeQueryOnly + type NetworkType int + const NetworkTypeTCP4 + const NetworkTypeTCP6 + const NetworkTypeUDP4 + const NetworkTypeUDP6 + func (t NetworkType) IsIPv4() bool + func (t NetworkType) IsIPv6() bool + func (t NetworkType) IsReliable() bool + func (t NetworkType) NetworkShort() string + func (t NetworkType) String() string + type PriorityAttr uint32 + func (p *PriorityAttr) GetFrom(m *stun.Message) error + func (p PriorityAttr) AddTo(m *stun.Message) error + type ProtoType int + const ProtoTypeTCP + const ProtoTypeUDP + func NewProtoType(raw string) ProtoType + func (t ProtoType) String() string + type Role byte + const Controlled + const Controlling + func (r *Role) UnmarshalText(text []byte) error + func (r Role) MarshalText() (text []byte, err error) + func (r Role) String() string + type SchemeType int + const SchemeTypeSTUN + const SchemeTypeSTUNS + const SchemeTypeTURN + const SchemeTypeTURNS + func NewSchemeType(raw string) SchemeType + func (t SchemeType) String() string + type URL struct + Host string + Password string + Port int + Proto ProtoType + Scheme SchemeType + Username string + func ParseURL(raw string) (*URL, error) + func (u URL) IsSecure() bool + func (u URL) String() string + type UseCandidateAttr struct + var UseCandidate UseCandidateAttr + func (UseCandidateAttr) AddTo(m *stun.Message) error + func (UseCandidateAttr) IsSet(m *stun.Message) bool