Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add remotenet #573

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Keep all original whitespaces.
  • Loading branch information
robot-dot-win committed Jul 3, 2024
commit 53f5e0757465750e3dee36d4b9e49bbafbd1320d
104 changes: 52 additions & 52 deletions src/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
core.h - description
-------------------
begin : Tue May 14 2002
copyright : netcreature (C) 2002
email : netcreature@users.sourceforge.net
copyright : netcreature (C) 2002
email : netcreature@users.sourceforge.net
***************************************************************************
***************************************************************************
* *
Expand Down Expand Up @@ -31,72 +31,72 @@

/*error codes*/
typedef enum {
SUCCESS=0,
MEMORY_FAIL, // malloc failed
SOCKET_ERROR, // look errno for more
CHAIN_DOWN, // no proxy in chain responds to tcp
CHAIN_EMPTY, // if proxy_count = 0
BLOCKED // target's port blocked on last proxy in the chain
SUCCESS=0,
MEMORY_FAIL, // malloc failed
SOCKET_ERROR, // look errno for more
CHAIN_DOWN, // no proxy in chain responds to tcp
CHAIN_EMPTY, // if proxy_count = 0
BLOCKED // target's port blocked on last proxy in the chain
} ERR_CODE;

typedef enum {
HTTP_TYPE,
SOCKS4_TYPE,
SOCKS5_TYPE,
RAW_TYPE
HTTP_TYPE,
SOCKS4_TYPE,
SOCKS5_TYPE,
RAW_TYPE
} proxy_type;

typedef enum {
DYNAMIC_TYPE,
STRICT_TYPE,
RANDOM_TYPE,
ROUND_ROBIN_TYPE
DYNAMIC_TYPE,
STRICT_TYPE,
RANDOM_TYPE,
ROUND_ROBIN_TYPE
} chain_type;

typedef enum {
PLAY_STATE,
DOWN_STATE,
BLOCKED_STATE,
BUSY_STATE
PLAY_STATE,
DOWN_STATE,
BLOCKED_STATE,
BUSY_STATE
} proxy_state;

typedef enum {
RANDOMLY,
FIFOLY
RANDOMLY,
FIFOLY
} select_type;

typedef struct {
sa_family_t family;
unsigned short port;
union {
struct {
struct in_addr in_addr;
struct in_addr in_mask;
};
struct {
struct in6_addr in6_addr;
unsigned char in6_prefix;
};
};
sa_family_t family;
unsigned short port;
union {
struct {
struct in_addr in_addr;
struct in_addr in_mask;
};
struct {
struct in6_addr in6_addr;
unsigned char in6_prefix;
};
};
} addr_arg;

typedef struct {
struct in_addr orig_dst, new_dst;
unsigned short orig_port, new_port;
struct in_addr orig_dst, new_dst;
unsigned short orig_port, new_port;
} dnat_arg;

typedef struct {
ip_type ip;
unsigned short port;
proxy_type pt;
proxy_state ps;
char user[256];
char pass[256];
ip_type ip;
unsigned short port;
proxy_type pt;
proxy_state ps;
char user[256];
char pass[256];
} proxy_data;

int connect_proxy_chain (int sock, ip_type target_ip, unsigned short target_port,
proxy_data * pd, unsigned int proxy_count, chain_type ct,
unsigned int max_chain );
proxy_data * pd, unsigned int proxy_count, chain_type ct,
unsigned int max_chain );

void proxychains_write_log(char *str, ...);

Expand All @@ -108,13 +108,13 @@ typedef void (*freeaddrinfo_t)(struct addrinfo *);
typedef struct hostent *(*gethostbyaddr_t) (const void *, socklen_t, int);

typedef int (*getaddrinfo_t)(const char *, const char *, const struct addrinfo *,
struct addrinfo **);
struct addrinfo **);

typedef int (*getnameinfo_t) (const struct sockaddr *, socklen_t, char *,
GN_NODELEN_T, char *, GN_SERVLEN_T, GN_FLAGS_T);
GN_NODELEN_T, char *, GN_SERVLEN_T, GN_FLAGS_T);

typedef ssize_t (*sendto_t) (int sockfd, const void *buf, size_t len, int flags,
const struct sockaddr *dest_addr, socklen_t addrlen);
const struct sockaddr *dest_addr, socklen_t addrlen);



Expand All @@ -126,17 +126,17 @@ extern getnameinfo_t true_getnameinfo;
extern gethostbyaddr_t true_gethostbyaddr;

struct gethostbyname_data {
struct hostent hostent_space;
in_addr_t resolved_addr;
char *resolved_addr_p[2];
char addr_name[256];
struct hostent hostent_space;
in_addr_t resolved_addr;
char *resolved_addr_p[2];
char addr_name[256];
};

struct hostent* proxy_gethostbyname(const char *name, struct gethostbyname_data *data);
struct hostent* proxy_gethostbyname_old(const char *name);

int proxy_getaddrinfo(const char *node, const char *service,
const struct addrinfo *hints, struct addrinfo **res);
const struct addrinfo *hints, struct addrinfo **res);
void proxy_freeaddrinfo(struct addrinfo *res);

void core_initialize(void);
Expand Down
Loading