Skip to content

Commit

Permalink
server_def move to common.h
Browse files Browse the repository at this point in the history
  • Loading branch information
breakwa11 committed Mar 28, 2017
1 parent 4577025 commit db893a5
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 34 deletions.
36 changes: 36 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
#define MODULE_LOCAL
#endif

#include <libcork/ds.h>

#include "encrypt.h"
#include "obfs/obfs.h"

int init_udprelay(const char *server_host, const char *server_port,
#ifdef MODULE_LOCAL
Expand All @@ -46,6 +49,39 @@ int init_udprelay(const char *server_host, const char *server_port,

void free_udprelay(void);

typedef struct server_def {
char *host;
int port;
int udp_port;
struct sockaddr_storage *addr; // resolved address
struct sockaddr_storage *addr_udp; // resolved address
int addr_len;
int addr_udp_len;

char *psw; // raw password
cipher_env_t cipher;

struct cork_dllist connections;

// SSR
char *protocol_name; // for logging use only?
char *obfs_name; // for logging use only?

char *protocol_param;
char *obfs_param;

obfs_class *protocol_plugin;
obfs_class *obfs_plugin;

void *protocol_global;
void *obfs_global;

int enable;
char *id;
char *group;
int udp_over_tcp;
} server_def_t;

#ifdef ANDROID
int protect_socket(int fd);
int send_traffic_stat(uint64_t tx, uint64_t rx);
Expand Down
34 changes: 0 additions & 34 deletions src/local.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,45 +27,11 @@
#include <libcork/ds.h>

#include "encrypt.h"
#include "obfs/obfs.h"
#include "jconf.h"
#include "protocol.h"

#include "common.h"

typedef struct server_def {
char *host;
int port;
int udp_port;
struct sockaddr_storage *addr; // resolved address
struct sockaddr_storage *addr_udp; // resolved address
int addr_len;
int addr_udp_len;

char *psw; // raw password
cipher_env_t cipher;

struct cork_dllist connections;

// SSR
char *protocol_name; // for logging use only?
char *obfs_name; // for logging use only?

char *protocol_param;
char *obfs_param;

obfs_class *protocol_plugin;
obfs_class *obfs_plugin;

void *protocol_global;
void *obfs_global;

int enable;
char *id;
char *group;
int udp_over_tcp;
} server_def_t;

// use this as a profile or environment
typedef struct listen_ctx{
ev_io io;
Expand Down
2 changes: 2 additions & 0 deletions src/redir.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include "obfs/obfs.h"
#include "jconf.h"

#include "common.h"

typedef struct listen_ctx {
ev_io io;
int remote_num;
Expand Down

0 comments on commit db893a5

Please sign in to comment.