Commit dde5d88
anng: adapt to NNG v2.0.0-alpha.7 API (#42)
* anng: adapt to NNG v2.0.0-alpha.7 API
Refactor address handling to use URL strings instead of a complex enum:
- Update nng-sys to 0.4.0-v2pre.2 (path dependency)
- Replace `Addr` enum (Inproc, Ipc, Inet, Inet6, Zt, Abstract) with `Url`
wrapper around String, matching NNG's URL-based addressing model.
Use `nng_url_sprintf` for URL formatting in `Listener::local_addr()`
- Use `nng_pipe_peer_addr` instead of deprecated `nng_pipe_get_addr`
- Retrieve URL scheme from pipe's listener/dialer endpoint
- Check pipe validity with `nng_pipe_id()` instead of internal field
- Enable full feature-powerset CI checks for anng
* anng: use unreachable! for validated pipe in remote_addr
The NNG_ENOENT branch in nng_pipe_peer_addr cannot be reached
because self.pipe() already validates the pipe before this point.
* anng: use unreachable! for invalid dialer/listener error paths
Replace verbose error-logging-and-debug-assert patterns with
unreachable! in remote_addr URL retrieval, consistent with the
approach taken for the validated pipe path.
* anng: make log message capitalization consistent
* anng: add TODO for upstream NNG issue #2228
* anng: accept &CStr in Url::from_nng to avoid caller conversion
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* anng: handle stale pipe in remote_addr gracefully
nng_pipe_peer_addr can return NNG_ENOENT when the pipe was closed
after self.pipe() returned a stale ID. Return None instead of
panicking.
* anng: replace unwrap with expect in Url::from_nng write! calls
* anng: use SocketAddrV6 Display for IPv6 URL formatting
* anng: restore lifetime nuance in CStr SAFETY comments
* anng: use split_once for URL scheme parsing in parse_tcp_url
* anng: use unreachable! for NNG_ENOENT in Listener::local_addr
&self guarantees the listener cannot be closed, so NNG_ENOENT
is unreachable.
* anng: take &nng_sockaddr by reference in Url::from_nng
* anng: validate UTF-8 on stack before allocating in local_addr
* anng: add TODO
* anng: preserve IPv6 scope_id in parse_tcp_url
SocketAddr::from_str() supports numeric IPv6 scope IDs, so there's no need
to strip them during parsing. This fixes data loss and maintains consistency
with Url::from_nng() which already preserves scope_id.
* anng: fix MSRV issue (core vs std)
---------
Co-authored-by: Felix Obenhuber <felix.obenhuber@helsing.ai>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 42a73c1 commit dde5d88
File tree
6 files changed
+542
-398
lines changed- .github/workflows
- anng
- src
- tests
6 files changed
+542
-398
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
| 130 | + | |
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
145 | | - | |
146 | | - | |
| 144 | + | |
147 | 145 | | |
148 | 146 | | |
149 | 147 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 30 | + | |
| 31 | + | |
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
| |||
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
43 | | - | |
44 | 42 | | |
45 | 43 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
389 | | - | |
390 | | - | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
391 | 393 | | |
392 | 394 | | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
416 | 468 | | |
417 | 469 | | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
422 | 486 | | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
423 | 501 | | |
| 502 | + | |
| 503 | + | |
424 | 504 | | |
425 | 505 | | |
426 | | - | |
| 506 | + | |
427 | 507 | | |
428 | 508 | | |
429 | 509 | | |
| |||
0 commit comments