MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / ShowLeaseSetDestination

Function ShowLeaseSetDestination

daemon/HTTPServer.cpp:479–629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

477 }
478
479 static void ShowLeaseSetDestination (std::stringstream& s, std::shared_ptr<const i2p::client::LeaseSetDestination> dest, uint32_t token)
480 {
481 std::string webroot; i2p::config::GetOption("http.webroot", webroot);
482 s << "<b>Base32:</b><br>\r\n<textarea readonly cols=\"80\" rows=\"1\">";
483 s << dest->GetIdentHash ().ToBase32 () << "</textarea><br>\r\n<br>\r\n";
484
485 s << "<b>Base64:</b><br>\r\n<textarea readonly cols=\"80\" rows=\"8\">";
486 s << dest->GetIdentity ()->ToBase64 () << "</textarea><br>\r\n<br>\r\n";
487
488 if (dest->IsEncryptedLeaseSet ())
489 {
490 i2p::data::BlindedPublicKey blinded (dest->GetIdentity (), dest->IsPerClientAuth ());
491 s << "<div class='slide'><label for='slide-b33'><b>" << tr("Encrypted B33 address") << ":</b></label>\r\n";
492 s << "<input type=\"checkbox\" id=\"slide-b33\" />\r\n";
493 s << "<div class=\"slidecontent\">\r\n";
494 s << blinded.ToB33 () << ".b32.i2p<br>\r\n";
495 s << "</div>\r\n</div>\r\n";
496 }
497
498 if (dest->IsPublic() && token && !dest->IsEncryptedLeaseSet ())
499 {
500 std::string webroot; i2p::config::GetOption("http.webroot", webroot);
501 s << "<div class='slide'><label for='slide-regaddr'><b>" << tr("Address registration line") << "</b></label>\r\n"
502 "<input type=\"checkbox\" id=\"slide-regaddr\" />\r\n"
503 "<div class=\"slidecontent\">\r\n"
504 "<form method=\"get\" action=\"" << webroot << "\">\r\n"
505 " <input type=\"hidden\" name=\"cmd\" value=\"" << HTTP_COMMAND_GET_REG_STRING << "\">\r\n"
506 " <input type=\"hidden\" name=\"token\" value=\"" << token << "\">\r\n"
507 " <input type=\"hidden\" name=\"b32\" value=\"" << dest->GetIdentHash ().ToBase32 () << "\">\r\n"
508 " <b>" << tr("Domain") << ":</b>\r\n<input type=\"text\" maxlength=\"67\" name=\"name\" placeholder=\"domain.i2p\" required>\r\n"
509 " <button type=\"submit\">" << tr("Generate") << "</button>\r\n"
510 "</form>\r\n"
511 "<small>" << tr("<b>Note:</b> result string can be used only for registering 2LD domains (example.i2p). For registering subdomains please use i2pd-tools.") << "</small>\r\n"
512 "</div>\r\n</div>\r\n<br>\r\n";
513 }
514
515 if (dest->GetNumRemoteLeaseSets())
516 {
517 s << "<div class='slide'><label for='slide-lease'><b>" << tr("LeaseSets") << ":</b> <i>" << dest->GetNumRemoteLeaseSets ()
518 << "</i></label>\r\n<input type=\"checkbox\" id=\"slide-lease\" />\r\n"
519 << "<div class=\"slidecontent\">\r\n"
520 << "<table>\r\n<thead><tr>"
521 << "<th>" << tr("Address") << "</th>"
522 << "<th style=\"width:5px;\">&nbsp;</th>" // LeaseSet expiration button column
523 << "<th>" << tr("Type") << "</th>"
524 << "<th>" << tr("EncType") << "</th>"
525 << "</tr></thead>\r\n<tbody class=\"tableitem\">";
526 for(auto& it: dest->GetLeaseSets ())
527 {
528 s << "<tr>"
529 << "<td>" << it.first.ToBase32 () << "</td>"
530 << "<td><a class=\"button\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_EXPIRELEASE<< "&b32=" << dest->GetIdentHash ().ToBase32 ()
531 << "&lease=" << it.first.ToBase32 () << "&token=" << token << "\" title=\"" << tr("Expire LeaseSet") << "\"> &#10008; </a></td>"
532 << "<td>" << (int)it.second->GetStoreType () << "</td>"
533 << "<td>" << (int)it.second->GetEncryptionType () <<"</td>"
534 << "</tr>\r\n";
535 }
536 s << "</tbody>\r\n</table>\r\n";

Callers 2

ShowLocalDestinationFunction · 0.85
ShowI2CPLocalDestinationFunction · 0.85

Calls 15

GetOptionFunction · 0.85
trFunction · 0.85
ShowHopFunction · 0.85
ShowTunnelDetailsFunction · 0.85
ToBase64Method · 0.80
IsEncryptedLeaseSetMethod · 0.80
IsPerClientAuthMethod · 0.80
ToB33Method · 0.80
GetNumRemoteLeaseSetsMethod · 0.80
GetInboundTunnelsMethod · 0.80
VisitTunnelHopsMethod · 0.80
LatencyIsKnownMethod · 0.80

Tested by

no test coverage detected