1 #include <netinet/in.h>
4 #include <event2/event.h>
5 #include <event2/dns.h>
6 #include <event2/util.h>
13 main(int argc
, char **argv
)
15 struct sockaddr_in sin
;
16 struct event_base
*base
;
17 struct evdns_base
*dns
;
19 base
= event_base_new();
20 dns
= evdns_base_new(base
, 1);
21 log_set_min_level(LOG_DEBUG
);
26 enum socks_ver socksv
;
28 url
= url_tokenize(argv
[1]);
30 log_error("shim: bad socks server, %s", argv
[1]);
36 if (!evutil_ascii_strcasecmp(url
->scheme
, "socks4"))
38 else if (!evutil_ascii_strcasecmp(url
->scheme
, "socks4a"))
41 log_error("shim: unknown socks version, %s",
46 if (conn_set_socks_server(url
->host
, url
->port
, socksv
) < 0)
52 memset(&sin
, 0, sizeof(sin
));
53 sin
.sin_family
= AF_INET
;
54 sin
.sin_port
= htons(8888);
56 proxy_init(base
, dns
, (struct sockaddr
*)&sin
, sizeof(sin
));
58 event_base_dispatch(base
);