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