| 499 | } |
| 500 | |
| 501 | void LuxController::auth_cb(LuxControlConnection& _conn, const LuxControlReply& reply) |
| 502 | { |
| 503 | if (reply.code == 250) { |
| 504 | LogPrint("lux", "lux: Authentication successful\n"); |
| 505 | |
| 506 | // Now that we know Lux is running setup the proxy for onion addresses |
| 507 | // if -onion isn't set to something else. |
| 508 | if (GetArg("-onion", "") == "") { |
| 509 | CService resolved; |
| 510 | assert(LookupNumeric("127.0.0.1", resolved, 9050)); |
| 511 | CService addrOnion = CService(resolved, 9050); |
| 512 | SetProxy(NET_TOR, addrOnion); |
| 513 | SetLimited(NET_TOR, false); |
| 514 | } |
| 515 | |
| 516 | // Finally - now create the service |
| 517 | if (private_key.empty()) // No private key, generate one |
| 518 | private_key = "NEW:RSA1024"; // Explicitly request RSA1024 - see issue #9214 |
| 519 | // Request hidden service, redirect port. |
| 520 | // Note that the 'virtual' port doesn't have to be the same as our internal port, but this is just a convenient |
| 521 | // choice. TODO; refactor the shutdown sequence some day. |
| 522 | _conn.Command(strprintf("ADD_ONION %s Port=%i,127.0.0.1:%i", private_key, GetListenPort(), GetListenPort()), |
| 523 | boost::bind(&LuxController::add_onion_cb, this, _1, _2)); |
| 524 | } else { |
| 525 | LogPrintf("lux: Authentication failed\n"); |
| 526 | } |
| 527 | } |
| 528 | |
| 529 | /** Compute Lux SAFECOOKIE response. |
| 530 | * |
nothing calls this directly
no test coverage detected