lokinet/llarp/service/hidden_service_address_lookup.hpp
Jason Rhinelander ac1486d0be Replace absl::optional with optional-lite
Step 1 of removing abseil from lokinet.

For the most part this is a drop-in replacement, but there are also a
few changes here to the JSONRPC layer that were needed to work around
current gcc 10 dev snapshot:

- JSONRPC returns a json now instead of an optional<json>.  It doesn't
  make any sense to have a json rpc call that just closes the connection
  with returning anything.  Invoked functions can return a null (default
  constructed) result now if they don't have anything to return (such a
  null value won't be added as "result").
2020-02-19 18:21:25 -04:00

39 lines
1.1 KiB
C++

#ifndef LLARP_SERVICE_HIDDEN_SERVICE_ADDRESS_LOOKUP_HPP
#define LLARP_SERVICE_HIDDEN_SERVICE_ADDRESS_LOOKUP_HPP
#include <routing/dht_message.hpp>
#include <service/intro_set.hpp>
#include <service/lookup.hpp>
namespace llarp
{
namespace service
{
struct Endpoint;
struct HiddenServiceAddressLookup : public IServiceLookup
{
const PubKey rootkey;
uint64_t relayOrder;
const dht::Key_t location;
using HandlerFunc = std::function< bool(
const Address&, nonstd::optional< IntroSet >, const RouterID&) >;
HandlerFunc handle;
HiddenServiceAddressLookup(Endpoint* p, HandlerFunc h,
const dht::Key_t& location,
const PubKey& rootkey, uint64_t relayOrder,
uint64_t tx);
~HiddenServiceAddressLookup() override = default;
bool
HandleResponse(const std::set< EncryptedIntroSet >& results) override;
std::shared_ptr< routing::IMessage >
BuildRequestMessage() override;
};
} // namespace service
} // namespace llarp
#endif