Changeset 5eef43d2
- Timestamp:
- Oct 8, 2008 2:57:02 PM (12 years ago)
- Branches:
- master
- Children:
- 00d537e
- Parents:
- caaf0cc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
apps/BOB/src/net/i2p/BOB/doCMDS.java
rcaaf0cc r5eef43d2 47 47 // FIX ME 48 48 // I need a better way to do versioning, but this will do for now. 49 public static final String BMAJ = "00", BMIN = "00", BREV = "01", BEXT = "- 6";49 public static final String BMAJ = "00", BMIN = "00", BREV = "01", BEXT = "-8pre"; 50 50 public static final String BOBversion = BMAJ + "." + BMIN + "." + BREV + BEXT; 51 51 private Socket server; … … 59 59 private Log _log; 60 60 /* database strings */ 61 private static final String P_DEST = "DESTINATION"; 61 62 private static final String P_INHOST = "INHOST"; 62 63 private static final String P_INPORT = "INPORT"; … … 73 74 private static final String C_help = "help"; 74 75 private static final String C_clear = "clear"; 76 private static final String C_getdest = "getdest"; 75 77 private static final String C_getkeys = "getkeys"; 76 78 private static final String C_getnick = "getnick"; … … 79 81 private static final String C_list = "list"; 80 82 private static final String C_newkeys = "newkeys"; 83 private static final String C_option = "option"; 81 84 private static final String C_outhost = "outhost"; 82 85 private static final String C_outport = "outport"; … … 94 97 {C_help, C_help + " <command> * Get help on a command."}, 95 98 {C_clear, C_clear + " * Clear the current nickname out of the list."}, 99 {C_getdest, C_getdest + " * Return the destination for the current nickname."}, 96 100 {C_getkeys, C_getkeys + " * Return the keypair for the current nickname."}, 97 101 {C_getnick, C_getnick + " tunnelname * Set the nickname from the database."}, … … 100 104 {C_list, C_list + " * List all tunnels."}, 101 105 {C_newkeys, C_newkeys + " * Generate a new keypair for the current nickname."}, 106 {C_option, C_option + " I2CPoption=something * Set an I2CP option. NOTE: Don't use any spaces."}, 102 107 {C_outhost, C_outhost + " hostname | IP * Set the outbound hostname or IP."}, 103 108 {C_outport, C_outport + " port_number * Set the outbound port that nickname contacts."}, 104 {C_quiet, C_quiet + " *"},109 {C_quiet, C_quiet + " True | False * Don't send to the application the incoming destination."}, 105 110 {C_quit, C_quit + " * Quits this session with BOB."}, 106 111 {C_setkeys, C_setkeys + " BASE64_keypair * Sets the keypair for the current nickname."}, … … 113 118 C_help + " " + 114 119 C_clear + " " + 120 C_getdest + " " + 115 121 C_getkeys + " " + 116 122 C_getnick + " " + … … 119 125 C_list + " " + 120 126 C_newkeys + " " + 127 C_option + " " + 121 128 C_outhost + " " + 122 129 C_outport + " " + … … 134 141 135 142 /** 136 * 143 * 137 144 * @param server 138 145 * @param props … … 147 154 } 148 155 149 /** 156 /** 150 157 * Try to print info from the database 151 * 158 * 152 159 * @param out 153 160 * @param info … … 165 172 /** 166 173 * Print true or false if an object exists 167 * 174 * 168 175 * @param out 169 176 * @param info … … 177 184 /** 178 185 * Print an error message 179 * 186 * 180 187 * @param out 181 188 */ … … 186 193 /** 187 194 * Dump various information from the database 188 * 195 * 189 196 * @param out 190 197 * @param info … … 220 227 /** 221 228 * Is this nickname's tunnel active? 222 * 229 * 223 230 * @param Arg 224 231 * @return true if the tunnel is active … … 233 240 /** 234 241 * Does the base64 information look OK 235 * 242 * 236 243 * @param data 237 244 * @return … … 248 255 * The actual parser. 249 256 * It probabbly needs a rewrite into functions, but I kind-of like inline code. 250 * 257 * 251 258 */ 252 259 public void run() { … … 284 291 } 285 292 } 286 293 } else if(Command.equals(C_getdest)) { 294 if(ns) { 295 if(dk) { 296 out.println("OK " + nickinfo.get(P_DEST)); 297 } else { 298 out.println("ERROR keys not set."); 299 } 300 } else { 301 nns(out); 302 } 287 303 } else if(Command.equals(C_list)) { 288 304 // Produce a formatted list of all nicknames … … 312 328 dk = true; 313 329 nickinfo.add(P_KEYS, prikey.toByteArray()); 330 nickinfo.add(P_DEST, d.toBase64()); 314 331 // System.out.println(prikey.toByteArray().length); 315 out.println("OK " + d.toBase64());332 out.println("OK " + nickinfo.get(P_DEST)); 316 333 } catch(IOException ioe) { 317 334 BOB.error("Error generating keys" + ioe); … … 395 412 } else { 396 413 out.println("ERROR tunnel is active"); 414 } 415 } else if(Command.equals(C_option)) { 416 if(ns) { 417 if(tunnelactive(nickinfo)) { 418 out.println("ERROR tunnel is active"); 419 } else { 420 StringTokenizer otoken = new StringTokenizer(Arg, "="); // use a space as a delimiter 421 if(otoken.countTokens() != 2) { 422 out.println("ERROR to many or no options."); 423 } else { 424 String pname = otoken.nextToken(); 425 String pval = otoken.nextToken(); 426 Properties Q = (Properties)nickinfo.get(P_PROPERTIES); 427 Q.setProperty(pname, pval); 428 nickinfo.add(P_PROPERTIES, Q); 429 out.println("OK " + pname + " set to " + pval); 430 } 431 } 432 } else { 433 nns(out); 397 434 } 398 435 } else if(Command.equals(C_getnick)) { … … 505 542 tunnel = new MUXlisten(nickinfo, _log); 506 543 Thread t = new Thread(tunnel); 544 nickinfo.add(P_STARTING, true); 507 545 t.start(); 508 nickinfo.add(P_STARTING, true);509 546 out.println("OK tunnel starting"); 510 547 } catch(I2PException e) {
Note: See TracChangeset
for help on using the changeset viewer.