| 554 | } |
| 555 | |
| 556 | bool wireaddr_internal_eq(const struct wireaddr_internal *a, |
| 557 | const struct wireaddr_internal *b) |
| 558 | { |
| 559 | if (a->itype != b->itype) |
| 560 | return false; |
| 561 | |
| 562 | switch (a->itype) { |
| 563 | case ADDR_INTERNAL_SOCKNAME: |
| 564 | return streq(a->u.sockname, b->u.sockname); |
| 565 | case ADDR_INTERNAL_ALLPROTO: |
| 566 | return a->u.port == b->u.port; |
| 567 | case ADDR_INTERNAL_STATICTOR: |
| 568 | if (!memeq(a->u.torservice.blob, sizeof(a->u.torservice.blob), |
| 569 | b->u.torservice.blob, sizeof(b->u.torservice.blob))) |
| 570 | return false; |
| 571 | /* fall thru */ |
| 572 | case ADDR_INTERNAL_AUTOTOR: |
| 573 | if (!wireaddr_eq(&a->u.torservice.address, |
| 574 | &b->u.torservice.address)) |
| 575 | return false; |
| 576 | return a->u.torservice.port == b->u.torservice.port; |
| 577 | case ADDR_INTERNAL_FORPROXY: |
| 578 | if (!streq(a->u.unresolved.name, b->u.unresolved.name)) |
| 579 | return false; |
| 580 | return a->u.unresolved.port == b->u.unresolved.port; |
| 581 | case ADDR_INTERNAL_WIREADDR: |
| 582 | return wireaddr_eq(&a->u.wireaddr, &b->u.wireaddr); |
| 583 | } |
| 584 | abort(); |
| 585 | } |
| 586 | |
| 587 | bool parse_wireaddr_internal(const char *arg, struct wireaddr_internal *addr, |
| 588 | u16 port, bool wildcard_ok, bool dns_ok, |