-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
267 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,6 @@ | |
|
||
*.swp | ||
.ycm_extra_conf.pyc | ||
.vscode | ||
/core | ||
/xTun | ||
/xTund |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
v0.5.2 (2017-8-30) | ||
----------- | ||
* Feature: NAT Keepalive | ||
|
||
|
||
v0.5.1 (2016-7-23) | ||
----------- | ||
* Fix: Free buffer | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <netinet/ip.h> | ||
#include "tun.h" | ||
|
||
int | ||
check_incoming_packet(uint8_t *buf, ssize_t len) { | ||
if (sizeof(struct iphdr) + 1 <= len) { | ||
if ((len == sizeof(struct iphdr) + 1) && *buf == 0) { // keepalive | ||
return 1; | ||
} | ||
return -1; | ||
} | ||
return 0; | ||
} | ||
|
||
void | ||
construct_keepalive_packet(struct tundev *tun, uint8_t *buf) { | ||
struct iphdr *iphdr = (struct iphdr *)buf; | ||
iphdr->saddr = tun->s_addr; | ||
iphdr->daddr = tun->network; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef _COMMON_H | ||
#define _COMMON_H | ||
|
||
#include <stdint.h> | ||
#include "tun.h" | ||
|
||
int check_incoming_packet(uint8_t *buf, ssize_t len); | ||
void construct_keepalive_packet(struct tundev *tun, uint8_t *buf); | ||
|
||
#ifdef ANDROID | ||
int protect_socket(int fd); | ||
#endif | ||
|
||
#endif // for #ifndef _COMMON_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef _TCP_H | ||
#define _TCP_H | ||
|
||
#include "uv.h" | ||
|
||
int tcp_client_start(struct tundev_context *ctx, uv_loop_t *loop); | ||
void tcp_client_stop(struct tundev_context *ctx); | ||
void tcp_client_connect(struct tundev_context *ctx); | ||
void tcp_client_send(struct tundev_context *ctx, uint8_t *buf, int len); | ||
|
||
int tcp_server_start(struct tundev_context *ctx, uv_loop_t *loop); | ||
void tcp_server_stop(struct tundev_context *ctx); | ||
void tcp_server_send(struct peer *peer, uint8_t *buf, int len); | ||
|
||
void tcp_send(uv_stream_t *stream, uint8_t *buf, int len); | ||
|
||
#endif // for #ifndef _TCP_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.