errors.go 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
  2. // SPDX-License-Identifier: MIT
  3. package ice
  4. import "errors"
  5. var (
  6. // ErrUnknownType indicates an error with Unknown info.
  7. ErrUnknownType = errors.New("Unknown")
  8. // ErrSchemeType indicates the scheme type could not be parsed.
  9. ErrSchemeType = errors.New("unknown scheme type")
  10. // ErrSTUNQuery indicates query arguments are provided in a STUN URL.
  11. ErrSTUNQuery = errors.New("queries not supported in STUN address")
  12. // ErrInvalidQuery indicates an malformed query is provided.
  13. ErrInvalidQuery = errors.New("invalid query")
  14. // ErrHost indicates malformed hostname is provided.
  15. ErrHost = errors.New("invalid hostname")
  16. // ErrPort indicates malformed port is provided.
  17. ErrPort = errors.New("invalid port")
  18. // ErrLocalUfragInsufficientBits indicates local username fragment insufficient bits are provided.
  19. // Have to be at least 24 bits long
  20. ErrLocalUfragInsufficientBits = errors.New("local username fragment is less than 24 bits long")
  21. // ErrLocalPwdInsufficientBits indicates local password insufficient bits are provided.
  22. // Have to be at least 128 bits long
  23. ErrLocalPwdInsufficientBits = errors.New("local password is less than 128 bits long")
  24. // ErrProtoType indicates an unsupported transport type was provided.
  25. ErrProtoType = errors.New("invalid transport protocol type")
  26. // ErrClosed indicates the agent is closed
  27. ErrClosed = errors.New("the agent is closed")
  28. // ErrNoCandidatePairs indicates agent does not have a valid candidate pair
  29. ErrNoCandidatePairs = errors.New("no candidate pairs available")
  30. // ErrCanceledByCaller indicates agent connection was canceled by the caller
  31. ErrCanceledByCaller = errors.New("connecting canceled by caller")
  32. // ErrMultipleStart indicates agent was started twice
  33. ErrMultipleStart = errors.New("attempted to start agent twice")
  34. // ErrRemoteUfragEmpty indicates agent was started with an empty remote ufrag
  35. ErrRemoteUfragEmpty = errors.New("remote ufrag is empty")
  36. // ErrRemotePwdEmpty indicates agent was started with an empty remote pwd
  37. ErrRemotePwdEmpty = errors.New("remote pwd is empty")
  38. // ErrNoOnCandidateHandler indicates agent was started without OnCandidate
  39. ErrNoOnCandidateHandler = errors.New("no OnCandidate provided")
  40. // ErrMultipleGatherAttempted indicates GatherCandidates has been called multiple times
  41. ErrMultipleGatherAttempted = errors.New("attempting to gather candidates during gathering state")
  42. // ErrUsernameEmpty indicates agent was give TURN URL with an empty Username
  43. ErrUsernameEmpty = errors.New("username is empty")
  44. // ErrPasswordEmpty indicates agent was give TURN URL with an empty Password
  45. ErrPasswordEmpty = errors.New("password is empty")
  46. // ErrAddressParseFailed indicates we were unable to parse a candidate address
  47. ErrAddressParseFailed = errors.New("failed to parse address")
  48. // ErrLiteUsingNonHostCandidates indicates non host candidates were selected for a lite agent
  49. ErrLiteUsingNonHostCandidates = errors.New("lite agents must only use host candidates")
  50. // ErrUselessUrlsProvided indicates that one or more URL was provided to the agent but no host
  51. // candidate required them
  52. ErrUselessUrlsProvided = errors.New("agent does not need URL with selected candidate types")
  53. // ErrUnsupportedNAT1To1IPCandidateType indicates that the specified NAT1To1IPCandidateType is
  54. // unsupported
  55. ErrUnsupportedNAT1To1IPCandidateType = errors.New("unsupported 1:1 NAT IP candidate type")
  56. // ErrInvalidNAT1To1IPMapping indicates that the given 1:1 NAT IP mapping is invalid
  57. ErrInvalidNAT1To1IPMapping = errors.New("invalid 1:1 NAT IP mapping")
  58. // ErrExternalMappedIPNotFound in NAT1To1IPMapping
  59. ErrExternalMappedIPNotFound = errors.New("external mapped IP not found")
  60. // ErrMulticastDNSWithNAT1To1IPMapping indicates that the mDNS gathering cannot be used along
  61. // with 1:1 NAT IP mapping for host candidate.
  62. ErrMulticastDNSWithNAT1To1IPMapping = errors.New("mDNS gathering cannot be used with 1:1 NAT IP mapping for host candidate")
  63. // ErrIneffectiveNAT1To1IPMappingHost indicates that 1:1 NAT IP mapping for host candidate is
  64. // requested, but the host candidate type is disabled.
  65. ErrIneffectiveNAT1To1IPMappingHost = errors.New("1:1 NAT IP mapping for host candidate ineffective")
  66. // ErrIneffectiveNAT1To1IPMappingSrflx indicates that 1:1 NAT IP mapping for srflx candidate is
  67. // requested, but the srflx candidate type is disabled.
  68. ErrIneffectiveNAT1To1IPMappingSrflx = errors.New("1:1 NAT IP mapping for srflx candidate ineffective")
  69. // ErrInvalidMulticastDNSHostName indicates an invalid MulticastDNSHostName
  70. ErrInvalidMulticastDNSHostName = errors.New("invalid mDNS HostName, must end with .local and can only contain a single '.'")
  71. // ErrRunCanceled indicates a run operation was canceled by its individual done
  72. ErrRunCanceled = errors.New("run was canceled by done")
  73. // ErrTCPRemoteAddrAlreadyExists indicates we already have the connection with same remote addr.
  74. ErrTCPRemoteAddrAlreadyExists = errors.New("conn with same remote addr already exists")
  75. // ErrUnknownCandidateTyp indicates that a candidate had a unknown type value.
  76. ErrUnknownCandidateTyp = errors.New("unknown candidate typ")
  77. // ErrDetermineNetworkType indicates that the NetworkType was not able to be parsed
  78. ErrDetermineNetworkType = errors.New("unable to determine networkType")
  79. errAttributeTooShortICECandidate = errors.New("attribute not long enough to be ICE candidate")
  80. errClosingConnection = errors.New("failed to close connection")
  81. errConnectionAddrAlreadyExist = errors.New("connection with same remote address already exists")
  82. errGetXorMappedAddrResponse = errors.New("failed to get XOR-MAPPED-ADDRESS response")
  83. errInvalidAddress = errors.New("invalid address")
  84. errNoTCPMuxAvailable = errors.New("no TCP mux is available")
  85. errNotImplemented = errors.New("not implemented yet")
  86. errNoUDPMuxAvailable = errors.New("no UDP mux is available")
  87. errNoXorAddrMapping = errors.New("no address mapping")
  88. errParseComponent = errors.New("failed to parse component")
  89. errParsePort = errors.New("failed to parse port")
  90. errParsePriority = errors.New("failed to parse priority")
  91. errParseRelatedAddr = errors.New("failed to parse related addresses")
  92. errParseTCPType = errors.New("failed to parse TCP type")
  93. errRead = errors.New("failed to read")
  94. errUDPMuxDisabled = errors.New("UDPMux is not enabled")
  95. errUnknownRole = errors.New("unknown role")
  96. errWrite = errors.New("failed to write")
  97. errWriteSTUNMessage = errors.New("failed to send STUN message")
  98. errWriteSTUNMessageToIceConn = errors.New("failed to write STUN message to ICE connection")
  99. errXORMappedAddrTimeout = errors.New("timeout while waiting for XORMappedAddr")
  100. // UDPMuxDefault should not listen on unspecified address, but to keep backward compatibility, don't return error now.
  101. // will be used in the future.
  102. // errListenUnspecified = errors.New("can't listen on unspecified address")
  103. )