mom040267 11 lat temu
rodzic
commit
064aca0fa7
3 zmienionych plików z 15 dodań i 1 usunięć
  1. 2 0
      README.turnutils
  2. 10 1
      src/apps/uclient/mainuclient.c
  3. 3 0
      src/apps/uclient/uclient.h

+ 2 - 0
README.turnutils

@@ -117,6 +117,8 @@ Flags:
 
 
 -Z	Dual allocation (SSODA draft support).
 -Z	Dual allocation (SSODA draft support).
 
 
+-J	Use oAuth.
+
 Options with required values:  
 Options with required values:  
 
 
 -l      Message length (Default: 100 Bytes).
 -l      Message length (Default: 100 Bytes).

+ 10 - 1
src/apps/uclient/mainuclient.c

@@ -97,6 +97,11 @@ band_limit_t bps = 0;
 
 
 int dual_allocation = 0;
 int dual_allocation = 0;
 
 
+int oauth = 0;
+oauth_key_data_raw okdr = {
+		"north","Y2FybGVvbg==",0,0,"SHA-256","AES-256-CBC","","HMAC-SHA-256-128",""
+};
+
 //////////////// local definitions /////////////////
 //////////////// local definitions /////////////////
 
 
 static char Usage[] =
 static char Usage[] =
@@ -130,6 +135,7 @@ static char Usage[] =
   "	-G	Generate extra requests (create permissions, channel bind).\n"
   "	-G	Generate extra requests (create permissions, channel bind).\n"
   " -B  Random disconnect after a few initial packets.\n"
   " -B  Random disconnect after a few initial packets.\n"
   " -Z  Dual allocation.\n"
   " -Z  Dual allocation.\n"
+  " -J	Use oAuth.\n"
   "Options:\n"
   "Options:\n"
   "	-l	Message length (Default: 100 Bytes).\n"
   "	-l	Message length (Default: 100 Bytes).\n"
   "	-i	Certificate file (for secure connections only, optional).\n"
   "	-i	Certificate file (for secure connections only, optional).\n"
@@ -204,8 +210,11 @@ int main(int argc, char **argv)
 
 
 	ns_bzero(local_addr, sizeof(local_addr));
 	ns_bzero(local_addr, sizeof(local_addr));
 
 
-	while ((c = getopt(argc, argv, "a:d:p:l:n:L:m:e:r:u:w:i:k:z:W:C:E:F:o:ZvsyhcxXgtTSAPDNOUHMRIGB")) != -1) {
+	while ((c = getopt(argc, argv, "a:d:p:l:n:L:m:e:r:u:w:i:k:z:W:C:E:F:o:ZvsyhcxXgtTSAPDNOUHMRIGBJ")) != -1) {
 		switch (c){
 		switch (c){
+		case 'J':
+			oauth = 1;
+			break;
 		case 'a':
 		case 'a':
 			bps = (band_limit_t)atol(optarg);
 			bps = (band_limit_t)atol(optarg);
 			break;
 			break;

+ 3 - 0
src/apps/uclient/uclient.h

@@ -86,6 +86,9 @@ extern int dual_allocation;
 
 
 extern char origin[STUN_MAX_ORIGIN_SIZE+1];
 extern char origin[STUN_MAX_ORIGIN_SIZE+1];
 
 
+extern int oauth;
+extern oauth_key_data_raw okdr;
+
 #define is_TCP_relay() (relay_transport == STUN_ATTRIBUTE_TRANSPORT_TCP_VALUE)
 #define is_TCP_relay() (relay_transport == STUN_ATTRIBUTE_TRANSPORT_TCP_VALUE)
 
 
 void start_mclient(const char *remote_address, int port,
 void start_mclient(const char *remote_address, int port,