mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-22 16:19:20 +02:00
update client code #75
This commit is contained in:
parent
2c2dd6f06e
commit
55cfed9956
|
@ -26,6 +26,8 @@ const char *client_get_raw_addr();
|
||||||
void client_set_nameserver(const char *cp, int port);
|
void client_set_nameserver(const char *cp, int port);
|
||||||
void client_set_topdomain(const char *cp);
|
void client_set_topdomain(const char *cp);
|
||||||
void client_set_password(const char *cp);
|
void client_set_password(const char *cp);
|
||||||
|
void set_qtype(char *qtype);
|
||||||
|
void set_downenc(char *encoding);
|
||||||
|
|
||||||
int client_handshake(int dns_fd, int raw_mode, int autodetect_frag_size, int fragsize);
|
int client_handshake(int dns_fd, int raw_mode, int autodetect_frag_size, int fragsize);
|
||||||
int client_tunnel(int tun_fd, int dns_fd);
|
int client_tunnel(int tun_fd, int dns_fd);
|
||||||
|
|
16
src/iodine.c
16
src/iodine.c
|
@ -61,7 +61,7 @@ usage() {
|
||||||
extern char *__progname;
|
extern char *__progname;
|
||||||
|
|
||||||
fprintf(stderr, "Usage: %s [-v] [-h] [-f] [-r] [-u user] [-t chrootdir] [-d device] "
|
fprintf(stderr, "Usage: %s [-v] [-h] [-f] [-r] [-u user] [-t chrootdir] [-d device] "
|
||||||
"[-P password] [-m maxfragsize] [-z context] [-F pidfile] "
|
"[-P password] [-m maxfragsize] [-T type] [-O enc] [-z context] [-F pidfile] "
|
||||||
"[nameserver] topdomain\n", __progname);
|
"[nameserver] topdomain\n", __progname);
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ help() {
|
||||||
|
|
||||||
fprintf(stderr, "iodine IP over DNS tunneling client\n");
|
fprintf(stderr, "iodine IP over DNS tunneling client\n");
|
||||||
fprintf(stderr, "Usage: %s [-v] [-h] [-f] [-r] [-u user] [-t chrootdir] [-d device] "
|
fprintf(stderr, "Usage: %s [-v] [-h] [-f] [-r] [-u user] [-t chrootdir] [-d device] "
|
||||||
"[-P password] [-m maxfragsize] [-z context] [-F pidfile] "
|
"[-P password] [-m maxfragsize] [-T type] [-O enc] [-z context] [-F pidfile] "
|
||||||
"[nameserver] topdomain\n", __progname);
|
"[nameserver] topdomain\n", __progname);
|
||||||
fprintf(stderr, " -v to print version info and exit\n");
|
fprintf(stderr, " -v to print version info and exit\n");
|
||||||
fprintf(stderr, " -h to print this help and exit\n");
|
fprintf(stderr, " -h to print this help and exit\n");
|
||||||
|
@ -83,6 +83,8 @@ help() {
|
||||||
fprintf(stderr, " -d device to set tunnel device name\n");
|
fprintf(stderr, " -d device to set tunnel device name\n");
|
||||||
fprintf(stderr, " -P password used for authentication (max 32 chars will be used)\n");
|
fprintf(stderr, " -P password used for authentication (max 32 chars will be used)\n");
|
||||||
fprintf(stderr, " -m maxfragsize, to limit size of downstream packets\n");
|
fprintf(stderr, " -m maxfragsize, to limit size of downstream packets\n");
|
||||||
|
fprintf(stderr, " -T dns type: NULL (default, fastest), TXT, CNAME, A (CNAME answer), MX\n");
|
||||||
|
fprintf(stderr, " -O downstream encoding (!NULL): Base32(default), Base64, or Raw (only TXT)\n");
|
||||||
fprintf(stderr, " -z context, to apply specified SELinux context after initialization\n");
|
fprintf(stderr, " -z context, to apply specified SELinux context after initialization\n");
|
||||||
fprintf(stderr, " -F pidfile to write pid to a file\n");
|
fprintf(stderr, " -F pidfile to write pid to a file\n");
|
||||||
fprintf(stderr, "nameserver is the IP number of the relaying nameserver, if absent /etc/resolv.conf is used\n");
|
fprintf(stderr, "nameserver is the IP number of the relaying nameserver, if absent /etc/resolv.conf is used\n");
|
||||||
|
@ -133,6 +135,7 @@ main(int argc, char **argv)
|
||||||
#endif
|
#endif
|
||||||
username = NULL;
|
username = NULL;
|
||||||
memset(password, 0, 33);
|
memset(password, 0, 33);
|
||||||
|
srand(time(NULL));
|
||||||
foreground = 0;
|
foreground = 0;
|
||||||
newroot = NULL;
|
newroot = NULL;
|
||||||
context = NULL;
|
context = NULL;
|
||||||
|
@ -159,7 +162,7 @@ main(int argc, char **argv)
|
||||||
__progname++;
|
__progname++;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while ((choice = getopt(argc, argv, "vfhru:t:d:P:m:F:")) != -1) {
|
while ((choice = getopt(argc, argv, "vfhru:t:d:P:m:F:T:O:")) != -1) {
|
||||||
switch(choice) {
|
switch(choice) {
|
||||||
case 'v':
|
case 'v':
|
||||||
version();
|
version();
|
||||||
|
@ -200,6 +203,12 @@ main(int argc, char **argv)
|
||||||
case 'F':
|
case 'F':
|
||||||
pidfile = optarg;
|
pidfile = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'T':
|
||||||
|
set_qtype(optarg);
|
||||||
|
break;
|
||||||
|
case 'O': /* not -D, is Debug in server */
|
||||||
|
set_downenc(optarg);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
|
@ -234,6 +243,7 @@ main(int argc, char **argv)
|
||||||
if (nameserv_addr) {
|
if (nameserv_addr) {
|
||||||
client_set_nameserver(nameserv_addr, DNS_PORT);
|
client_set_nameserver(nameserv_addr, DNS_PORT);
|
||||||
} else {
|
} else {
|
||||||
|
warnx("No nameserver found - not connected to any network?\n");
|
||||||
usage();
|
usage();
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue