Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // proxy support for nawp's autisticube client
- // by uf ok
- //
- // at the moment this only supports TCP. which is what i'm pretty sure assaultcube uses
- // since its netcode sucks
- //
- // this is a new and improved version of old socks5 code i wrote circa 2006. the original
- // sucks ass so this new version should work a lot better.
- //
- // TODO:
- // - everything
- // - automatic fetching of proxy lists from certain locations
- #include <stdio.h>
- #include <winsock.h>
- typedef struct {
- IN_ADDR address;
- UINT16 port;
- socks5pxy_t* nextproxy;
- } socks5pxy_t;
- socks5pxy_t* firstproxy;
- static BOOL DetokenizeProxy( const char * szInput, IN_ADDR* pAddress, UINT16* pPort ) {
- // this should be the correct format or we will be dying a painful death
- // format is ip:port
- char buffer[ 256 ];
- char* pPointerToPortSeparator = strchr( szInput, ':' );
- if (!pPointerToPortSeparator) {
- printf("Invalid proxy entry, skipping\n");
- return FALSE;
- }
- // split it
- strncpy( buffer, szInput, ( pPointerToPortSeparator - szInput )
- return FALSE;
- }
- //
- // Socks5Init: Loads the proxy lists etc.
- //
- BOOL Socks5Init() {
- FILE * f = fopen("Socks5.txt", "r");
- if (!f) return FALSE;
- char buffer [ 1024 ];
- while (!feof( f ) ) {
- fgets( buffer, 1024, f );
- // ignore comments
- if (!strncmp( buffer, "//", 2 )) continue;
- // parse this as an entry
- // TODO: Complete this
- }
- }
- //
- // Socks5Test: Tests all proxies on the list.
- // All invalid proxies will be removed from the list, then the list
- // file will be saved.
- //
- void Socks5Test() {
- }
- // Opens a socket to a proxy.
- BOOL Socks5Connect( const char* szAddress, UINT32 dwPort ) {
- // pick a random proxy from the list
- // connect to it, and handshake.
- // we should also do checks to see if it supports UDP.
- return FALSE;
- }
Advertisement
Add Comment
Please, Sign In to add comment