| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
package tcpip |
| 16 |
|
| 17 |
import ( |
| 18 |
"fmt" |
| 19 |
) |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
type Error interface { |
| 26 |
isError() |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
IgnoreStats() bool |
| 31 |
|
| 32 |
fmt.Stringer |
| 33 |
} |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
type ErrAborted struct{} |
| 41 |
|
| 42 |
func (*ErrAborted) isError() {} |
| 43 |
|
| 44 |
|
| 45 |
func (*ErrAborted) IgnoreStats() bool { |
| 46 |
return false |
| 47 |
} |
| 48 |
func (*ErrAborted) String() string { |
| 49 |
return "operation aborted" |
| 50 |
} |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
type ErrAddressFamilyNotSupported struct{} |
| 57 |
|
| 58 |
func (*ErrAddressFamilyNotSupported) isError() {} |
| 59 |
|
| 60 |
|
| 61 |
func (*ErrAddressFamilyNotSupported) IgnoreStats() bool { |
| 62 |
return false |
| 63 |
} |
| 64 |
func (*ErrAddressFamilyNotSupported) String() string { |
| 65 |
return "address family not supported by protocol" |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
type ErrAlreadyBound struct{} |
| 72 |
|
| 73 |
func (*ErrAlreadyBound) isError() {} |
| 74 |
|
| 75 |
|
| 76 |
func (*ErrAlreadyBound) IgnoreStats() bool { |
| 77 |
return true |
| 78 |
} |
| 79 |
func (*ErrAlreadyBound) String() string { return "endpoint already bound" } |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
type ErrAlreadyConnected struct{} |
| 85 |
|
| 86 |
func (*ErrAlreadyConnected) isError() {} |
| 87 |
|
| 88 |
|
| 89 |
func (*ErrAlreadyConnected) IgnoreStats() bool { |
| 90 |
return true |
| 91 |
} |
| 92 |
func (*ErrAlreadyConnected) String() string { return "endpoint is already connected" } |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
type ErrAlreadyConnecting struct{} |
| 98 |
|
| 99 |
func (*ErrAlreadyConnecting) isError() {} |
| 100 |
|
| 101 |
|
| 102 |
func (*ErrAlreadyConnecting) IgnoreStats() bool { |
| 103 |
return true |
| 104 |
} |
| 105 |
func (*ErrAlreadyConnecting) String() string { return "endpoint is already connecting" } |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
type ErrBadAddress struct{} |
| 111 |
|
| 112 |
func (*ErrBadAddress) isError() {} |
| 113 |
|
| 114 |
|
| 115 |
func (*ErrBadAddress) IgnoreStats() bool { |
| 116 |
return false |
| 117 |
} |
| 118 |
func (*ErrBadAddress) String() string { return "bad address" } |
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
type ErrBadBuffer struct{} |
| 124 |
|
| 125 |
func (*ErrBadBuffer) isError() {} |
| 126 |
|
| 127 |
|
| 128 |
func (*ErrBadBuffer) IgnoreStats() bool { |
| 129 |
return false |
| 130 |
} |
| 131 |
func (*ErrBadBuffer) String() string { return "bad buffer" } |
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
type ErrBadLocalAddress struct{} |
| 137 |
|
| 138 |
func (*ErrBadLocalAddress) isError() {} |
| 139 |
|
| 140 |
|
| 141 |
func (*ErrBadLocalAddress) IgnoreStats() bool { |
| 142 |
return false |
| 143 |
} |
| 144 |
func (*ErrBadLocalAddress) String() string { return "bad local address" } |
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
type ErrBroadcastDisabled struct{} |
| 150 |
|
| 151 |
func (*ErrBroadcastDisabled) isError() {} |
| 152 |
|
| 153 |
|
| 154 |
func (*ErrBroadcastDisabled) IgnoreStats() bool { |
| 155 |
return false |
| 156 |
} |
| 157 |
func (*ErrBroadcastDisabled) String() string { return "broadcast socket option disabled" } |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
type ErrClosedForReceive struct{} |
| 163 |
|
| 164 |
func (*ErrClosedForReceive) isError() {} |
| 165 |
|
| 166 |
|
| 167 |
func (*ErrClosedForReceive) IgnoreStats() bool { |
| 168 |
return false |
| 169 |
} |
| 170 |
func (*ErrClosedForReceive) String() string { return "endpoint is closed for receive" } |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
type ErrClosedForSend struct{} |
| 176 |
|
| 177 |
func (*ErrClosedForSend) isError() {} |
| 178 |
|
| 179 |
|
| 180 |
func (*ErrClosedForSend) IgnoreStats() bool { |
| 181 |
return false |
| 182 |
} |
| 183 |
func (*ErrClosedForSend) String() string { return "endpoint is closed for send" } |
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
type ErrConnectStarted struct{} |
| 189 |
|
| 190 |
func (*ErrConnectStarted) isError() {} |
| 191 |
|
| 192 |
|
| 193 |
func (*ErrConnectStarted) IgnoreStats() bool { |
| 194 |
return true |
| 195 |
} |
| 196 |
func (*ErrConnectStarted) String() string { return "connection attempt started" } |
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
type ErrConnectionAborted struct{} |
| 202 |
|
| 203 |
func (*ErrConnectionAborted) isError() {} |
| 204 |
|
| 205 |
|
| 206 |
func (*ErrConnectionAborted) IgnoreStats() bool { |
| 207 |
return false |
| 208 |
} |
| 209 |
func (*ErrConnectionAborted) String() string { return "connection aborted" } |
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
type ErrConnectionRefused struct{} |
| 215 |
|
| 216 |
func (*ErrConnectionRefused) isError() {} |
| 217 |
|
| 218 |
|
| 219 |
func (*ErrConnectionRefused) IgnoreStats() bool { |
| 220 |
return false |
| 221 |
} |
| 222 |
func (*ErrConnectionRefused) String() string { return "connection was refused" } |
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
type ErrConnectionReset struct{} |
| 228 |
|
| 229 |
func (*ErrConnectionReset) isError() {} |
| 230 |
|
| 231 |
|
| 232 |
func (*ErrConnectionReset) IgnoreStats() bool { |
| 233 |
return false |
| 234 |
} |
| 235 |
func (*ErrConnectionReset) String() string { return "connection reset by peer" } |
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
type ErrDestinationRequired struct{} |
| 242 |
|
| 243 |
func (*ErrDestinationRequired) isError() {} |
| 244 |
|
| 245 |
|
| 246 |
func (*ErrDestinationRequired) IgnoreStats() bool { |
| 247 |
return false |
| 248 |
} |
| 249 |
func (*ErrDestinationRequired) String() string { return "destination address is required" } |
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
type ErrDuplicateAddress struct{} |
| 255 |
|
| 256 |
func (*ErrDuplicateAddress) isError() {} |
| 257 |
|
| 258 |
|
| 259 |
func (*ErrDuplicateAddress) IgnoreStats() bool { |
| 260 |
return false |
| 261 |
} |
| 262 |
func (*ErrDuplicateAddress) String() string { return "duplicate address" } |
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
type ErrDuplicateNICID struct{} |
| 268 |
|
| 269 |
func (*ErrDuplicateNICID) isError() {} |
| 270 |
|
| 271 |
|
| 272 |
func (*ErrDuplicateNICID) IgnoreStats() bool { |
| 273 |
return false |
| 274 |
} |
| 275 |
func (*ErrDuplicateNICID) String() string { return "duplicate nic id" } |
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
type ErrInvalidEndpointState struct{} |
| 281 |
|
| 282 |
func (*ErrInvalidEndpointState) isError() {} |
| 283 |
|
| 284 |
|
| 285 |
func (*ErrInvalidEndpointState) IgnoreStats() bool { |
| 286 |
return false |
| 287 |
} |
| 288 |
func (*ErrInvalidEndpointState) String() string { return "endpoint is in invalid state" } |
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
type ErrInvalidOptionValue struct{} |
| 294 |
|
| 295 |
func (*ErrInvalidOptionValue) isError() {} |
| 296 |
|
| 297 |
|
| 298 |
func (*ErrInvalidOptionValue) IgnoreStats() bool { |
| 299 |
return false |
| 300 |
} |
| 301 |
func (*ErrInvalidOptionValue) String() string { return "invalid option value specified" } |
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
type ErrInvalidPortRange struct{} |
| 307 |
|
| 308 |
func (*ErrInvalidPortRange) isError() {} |
| 309 |
|
| 310 |
|
| 311 |
func (*ErrInvalidPortRange) IgnoreStats() bool { |
| 312 |
return true |
| 313 |
} |
| 314 |
func (*ErrInvalidPortRange) String() string { return "invalid port range" } |
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
type ErrMalformedHeader struct{} |
| 320 |
|
| 321 |
func (*ErrMalformedHeader) isError() {} |
| 322 |
|
| 323 |
|
| 324 |
func (*ErrMalformedHeader) IgnoreStats() bool { |
| 325 |
return false |
| 326 |
} |
| 327 |
func (*ErrMalformedHeader) String() string { return "header is malformed" } |
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
type ErrMessageTooLong struct{} |
| 334 |
|
| 335 |
func (*ErrMessageTooLong) isError() {} |
| 336 |
|
| 337 |
|
| 338 |
func (*ErrMessageTooLong) IgnoreStats() bool { |
| 339 |
return false |
| 340 |
} |
| 341 |
func (*ErrMessageTooLong) String() string { return "message too long" } |
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
type ErrNetworkUnreachable struct{} |
| 348 |
|
| 349 |
func (*ErrNetworkUnreachable) isError() {} |
| 350 |
|
| 351 |
|
| 352 |
func (*ErrNetworkUnreachable) IgnoreStats() bool { |
| 353 |
return false |
| 354 |
} |
| 355 |
func (*ErrNetworkUnreachable) String() string { return "network is unreachable" } |
| 356 |
|
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
type ErrNoBufferSpace struct{} |
| 361 |
|
| 362 |
func (*ErrNoBufferSpace) isError() {} |
| 363 |
|
| 364 |
|
| 365 |
func (*ErrNoBufferSpace) IgnoreStats() bool { |
| 366 |
return false |
| 367 |
} |
| 368 |
func (*ErrNoBufferSpace) String() string { return "no buffer space available" } |
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
type ErrNoPortAvailable struct{} |
| 374 |
|
| 375 |
func (*ErrNoPortAvailable) isError() {} |
| 376 |
|
| 377 |
|
| 378 |
func (*ErrNoPortAvailable) IgnoreStats() bool { |
| 379 |
return false |
| 380 |
} |
| 381 |
func (*ErrNoPortAvailable) String() string { return "no ports are available" } |
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
type ErrNoRoute struct{} |
| 388 |
|
| 389 |
func (*ErrNoRoute) isError() {} |
| 390 |
|
| 391 |
|
| 392 |
func (*ErrNoRoute) IgnoreStats() bool { |
| 393 |
return false |
| 394 |
} |
| 395 |
func (*ErrNoRoute) String() string { return "no route" } |
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
type ErrNoSuchFile struct{} |
| 402 |
|
| 403 |
func (*ErrNoSuchFile) isError() {} |
| 404 |
|
| 405 |
|
| 406 |
func (*ErrNoSuchFile) IgnoreStats() bool { |
| 407 |
return false |
| 408 |
} |
| 409 |
func (*ErrNoSuchFile) String() string { return "no such file" } |
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
type ErrNotConnected struct{} |
| 415 |
|
| 416 |
func (*ErrNotConnected) isError() {} |
| 417 |
|
| 418 |
|
| 419 |
func (*ErrNotConnected) IgnoreStats() bool { |
| 420 |
return false |
| 421 |
} |
| 422 |
func (*ErrNotConnected) String() string { return "endpoint not connected" } |
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
|
| 427 |
type ErrNotPermitted struct{} |
| 428 |
|
| 429 |
func (*ErrNotPermitted) isError() {} |
| 430 |
|
| 431 |
|
| 432 |
func (*ErrNotPermitted) IgnoreStats() bool { |
| 433 |
return false |
| 434 |
} |
| 435 |
func (*ErrNotPermitted) String() string { return "operation not permitted" } |
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
type ErrNotSupported struct{} |
| 441 |
|
| 442 |
func (*ErrNotSupported) isError() {} |
| 443 |
|
| 444 |
|
| 445 |
func (*ErrNotSupported) IgnoreStats() bool { |
| 446 |
return false |
| 447 |
} |
| 448 |
func (*ErrNotSupported) String() string { return "operation not supported" } |
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
|
| 453 |
type ErrPortInUse struct{} |
| 454 |
|
| 455 |
func (*ErrPortInUse) isError() {} |
| 456 |
|
| 457 |
|
| 458 |
func (*ErrPortInUse) IgnoreStats() bool { |
| 459 |
return false |
| 460 |
} |
| 461 |
func (*ErrPortInUse) String() string { return "port is in use" } |
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
type ErrQueueSizeNotSupported struct{} |
| 468 |
|
| 469 |
func (*ErrQueueSizeNotSupported) isError() {} |
| 470 |
|
| 471 |
|
| 472 |
func (*ErrQueueSizeNotSupported) IgnoreStats() bool { |
| 473 |
return false |
| 474 |
} |
| 475 |
func (*ErrQueueSizeNotSupported) String() string { return "queue size querying not supported" } |
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
type ErrTimeout struct{} |
| 481 |
|
| 482 |
func (*ErrTimeout) isError() {} |
| 483 |
|
| 484 |
|
| 485 |
func (*ErrTimeout) IgnoreStats() bool { |
| 486 |
return false |
| 487 |
} |
| 488 |
func (*ErrTimeout) String() string { return "operation timed out" } |
| 489 |
|
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
type ErrUnknownDevice struct{} |
| 494 |
|
| 495 |
func (*ErrUnknownDevice) isError() {} |
| 496 |
|
| 497 |
|
| 498 |
func (*ErrUnknownDevice) IgnoreStats() bool { |
| 499 |
return false |
| 500 |
} |
| 501 |
func (*ErrUnknownDevice) String() string { return "unknown device" } |
| 502 |
|
| 503 |
|
| 504 |
|
| 505 |
|
| 506 |
type ErrUnknownNICID struct{} |
| 507 |
|
| 508 |
func (*ErrUnknownNICID) isError() {} |
| 509 |
|
| 510 |
|
| 511 |
func (*ErrUnknownNICID) IgnoreStats() bool { |
| 512 |
return false |
| 513 |
} |
| 514 |
func (*ErrUnknownNICID) String() string { return "unknown nic id" } |
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
|
| 519 |
type ErrUnknownProtocol struct{} |
| 520 |
|
| 521 |
func (*ErrUnknownProtocol) isError() {} |
| 522 |
|
| 523 |
|
| 524 |
func (*ErrUnknownProtocol) IgnoreStats() bool { |
| 525 |
return false |
| 526 |
} |
| 527 |
func (*ErrUnknownProtocol) String() string { return "unknown protocol" } |
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
|
| 532 |
type ErrUnknownProtocolOption struct{} |
| 533 |
|
| 534 |
func (*ErrUnknownProtocolOption) isError() {} |
| 535 |
|
| 536 |
|
| 537 |
func (*ErrUnknownProtocolOption) IgnoreStats() bool { |
| 538 |
return false |
| 539 |
} |
| 540 |
func (*ErrUnknownProtocolOption) String() string { return "unknown option for protocol" } |
| 541 |
|
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
type ErrWouldBlock struct{} |
| 546 |
|
| 547 |
func (*ErrWouldBlock) isError() {} |
| 548 |
|
| 549 |
|
| 550 |
func (*ErrWouldBlock) IgnoreStats() bool { |
| 551 |
return true |
| 552 |
} |
| 553 |
func (*ErrWouldBlock) String() string { return "operation would block" } |
| 554 |
|
| 555 |
|