errors.go 7.4 KB

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