| 45 | }; |
| 46 | |
| 47 | static const char* socks5strerror(const tal_t *ctx, u8 code) |
| 48 | { |
| 49 | /* Error codes defined in https://tools.ietf.org/html/rfc1928#section-6 */ |
| 50 | switch (code) { |
| 51 | case 0: |
| 52 | return tal_strdup(ctx, "success"); |
| 53 | case 1: |
| 54 | return tal_strdup(ctx, "general SOCKS server failure"); |
| 55 | case 2: |
| 56 | return tal_strdup(ctx, "connection not allowed by ruleset"); |
| 57 | case 3: |
| 58 | return tal_strdup(ctx, "network unreachable"); |
| 59 | case 4: |
| 60 | return tal_strdup(ctx, "host unreachable"); |
| 61 | case 5: |
| 62 | return tal_strdup(ctx, "connection refused"); |
| 63 | case 6: |
| 64 | return tal_strdup(ctx, "TTL expired"); |
| 65 | case 7: |
| 66 | return tal_strdup(ctx, "command not supported"); |
| 67 | case 8: |
| 68 | return tal_strdup(ctx, "address type not supported"); |
| 69 | } |
| 70 | return tal_fmt(ctx, "unknown error: %" PRIu8, code); |
| 71 | } |
| 72 | |
| 73 | static struct io_plan *connect_finish2(struct io_conn *conn, |
| 74 | struct connecting_socks *connect) |