| 581 | } |
| 582 | |
| 583 | bool wireaddr_internal_eq(const struct wireaddr_internal *a, |
| 584 | const struct wireaddr_internal *b) |
| 585 | { |
| 586 | if (a->itype != b->itype) |
| 587 | return false; |
| 588 | |
| 589 | switch (a->itype) { |
| 590 | case ADDR_INTERNAL_SOCKNAME: |
| 591 | return streq(a->u.sockname, b->u.sockname); |
| 592 | case ADDR_INTERNAL_ALLPROTO: |
| 593 | return a->u.allproto.is_websocket == b->u.allproto.is_websocket |
| 594 | && a->u.allproto.port == b->u.allproto.port; |
| 595 | case ADDR_INTERNAL_STATICTOR: |
| 596 | if (!memeq(a->u.torservice.blob, sizeof(a->u.torservice.blob), |
| 597 | b->u.torservice.blob, sizeof(b->u.torservice.blob))) |
| 598 | return false; |
| 599 | /* fall thru */ |
| 600 | case ADDR_INTERNAL_AUTOTOR: |
| 601 | if (!wireaddr_eq(&a->u.torservice.address, |
| 602 | &b->u.torservice.address)) |
| 603 | return false; |
| 604 | return a->u.torservice.port == b->u.torservice.port; |
| 605 | case ADDR_INTERNAL_FORPROXY: |
| 606 | if (!streq(a->u.unresolved.name, b->u.unresolved.name)) |
| 607 | return false; |
| 608 | return a->u.unresolved.port == b->u.unresolved.port; |
| 609 | case ADDR_INTERNAL_WIREADDR: |
| 610 | return a->u.wireaddr.is_websocket == b->u.wireaddr.is_websocket |
| 611 | && wireaddr_eq(&a->u.wireaddr.wireaddr, &b->u.wireaddr.wireaddr); |
| 612 | } |
| 613 | abort(); |
| 614 | } |
| 615 | |
| 616 | const char *parse_wireaddr_internal(const tal_t *ctx, |
| 617 | const char *arg, |