| 245 | } |
| 246 | |
| 247 | char *fmt_wireaddr_internal(const tal_t *ctx, |
| 248 | const struct wireaddr_internal *a) |
| 249 | { |
| 250 | switch (a->itype) { |
| 251 | case ADDR_INTERNAL_SOCKNAME: |
| 252 | return tal_fmt(ctx, "%s", a->u.sockname); |
| 253 | case ADDR_INTERNAL_ALLPROTO: |
| 254 | return tal_fmt(ctx, "%s:%u", a->u.allproto.is_websocket ? "(ws)": "", |
| 255 | a->u.allproto.port); |
| 256 | case ADDR_INTERNAL_WIREADDR: |
| 257 | if (a->u.wireaddr.is_websocket) |
| 258 | return tal_fmt(ctx, "(ws)%s", |
| 259 | fmt_wireaddr(tmpctx, &a->u.wireaddr.wireaddr)); |
| 260 | return fmt_wireaddr(ctx, &a->u.wireaddr.wireaddr); |
| 261 | case ADDR_INTERNAL_FORPROXY: |
| 262 | return tal_fmt(ctx, "%s:%u", |
| 263 | a->u.unresolved.name, a->u.unresolved.port); |
| 264 | case ADDR_INTERNAL_AUTOTOR: |
| 265 | return tal_fmt(ctx, "autotor:%s", |
| 266 | fmt_wireaddr(tmpctx, &a->u.torservice.address)); |
| 267 | case ADDR_INTERNAL_STATICTOR: |
| 268 | return tal_fmt(ctx, "statictor:%s", |
| 269 | fmt_wireaddr(tmpctx, &a->u.torservice.address)); |
| 270 | } |
| 271 | abort(); |
| 272 | } |
| 273 | |
| 274 | char *fmt_wireaddr_without_port(const tal_t * ctx, const struct wireaddr *a) |
| 275 | { |
no test coverage detected