lib/fetch: add socks5 support

This commit is contained in:
Duncaen
2016-08-31 23:40:31 +02:00
parent 3a1892028a
commit 30ace44394
4 changed files with 154 additions and 5 deletions

View File

@ -37,6 +37,28 @@
#define FTP_DEFAULT_PROXY_PORT 21
#define HTTP_DEFAULT_PROXY_PORT 3128
#define SOCKS5_VERSION 0x05
#define SOCKS5_NO_AUTH 0x00
#define SOCKS5_USER_PASS 0x02
#define SOCKS5_NO_ACCEPT_METHOD 0xFF
#define SOCKS5_TCP_STREAM 0x01
#define SOCKS5_ATYPE_IPV4 0x01
#define SOCKS5_ATYPE_DOMAIN 0x03
#define SOCKS5_ATYPE_IPV6 0x04
#define SOCKS5_REPLY_SUCCESS 0x00
#define SOCKS5_REPLY_FAILURE 0x01
#define SOCKS5_REPLY_DENY 0x02
#define SOCKS5_REPLY_NO_NET 0x03
#define SOCKS5_REPLY_NO_HOST 0x04
#define SOCKS5_REPLY_REFUSED 0x05
#define SOCKS5_REPLY_TIMEOUT 0x06
#define SOCKS5_REPLY_CMD_NOTSUP 0x07
#define SOCKS5_REPLY_ADR_NOTSUP 0x08
#ifdef WITH_SSL
#include <openssl/crypto.h>
#include <openssl/x509.h>
@ -98,6 +120,7 @@ int fetch_default_proxy_port(const char *);
int fetch_bind(int, int, const char *);
conn_t *fetch_cache_get(const struct url *, int);
void fetch_cache_put(conn_t *, int (*)(conn_t *));
int fetch_socks5(conn_t *, struct url *, int);
conn_t *fetch_connect(struct url *, int, int);
conn_t *fetch_reopen(int);
#ifdef WITH_SSL