-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
48c219c
commit 8c1c76b
Showing
6 changed files
with
69 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef IPFS_OPINIONATED_CONTEXT_H_ | ||
#define IPFS_OPINIONATED_CONTEXT_H_ | ||
|
||
#include <ipfs_client/crypto/openssl_signature_verifier.h> | ||
#include <ipfs_client/ctx/ares_dns_txt_lookup.h> | ||
#include <ipfs_client/ctx/boost_beast_http.h> | ||
|
||
#include <ipfs_client/context_api.h> | ||
#include <ipfs_client/orchestrator.h> | ||
|
||
#include <memory> | ||
|
||
#if HAS_BOOST_BEAST && HAS_ARES && HAS_OPENSSL_EVP | ||
|
||
#define HAS_OPINIONATED_CONTEXT 1 | ||
|
||
#include <google/protobuf/stubs/logging.h> | ||
|
||
namespace boost::asio { | ||
class io_context; | ||
} | ||
|
||
namespace google::protobuf { | ||
constexpr LogLevel LOGLEVEL_DEBUG = static_cast<LogLevel>(-1); | ||
constexpr LogLevel LOGLEVEL_TRACE = static_cast<LogLevel>(-2); | ||
} // namespace google::protobuf | ||
|
||
class HttpSession; | ||
|
||
namespace ipfs { | ||
|
||
std::pair<std::shared_ptr<ContextApi>, std::shared_ptr<Orchestrator>> | ||
start_default(boost::asio::io_context& io); | ||
|
||
} // namespace ipfs | ||
|
||
#else | ||
|
||
#warning \ | ||
"You are missing dependencies necessary for using the opinionated context." | ||
|
||
#endif // HAS_BOOST_BEAST && HAS_ARES && HAS_OPENSSL_EVP | ||
|
||
#endif // IPFS_OPINIONATED_CONTEXT_H_ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <ipfs_client/opinionated_context.h> | ||
|
||
#include <ipfs_client/gw/default_requestor.h> | ||
|
||
#if HAS_OPINIONATED_CONTEXT | ||
|
||
auto ipfs::start_default(boost::asio::io_context& io) | ||
-> std::pair<std::shared_ptr<ContextApi>, std::shared_ptr<Orchestrator>> { | ||
auto api = std::make_shared<ContextApi>(); | ||
using SKT = crypto::SigningKeyType; | ||
api->with(std::make_unique<ctx::BoostBeastHttp>(io)) | ||
.with(std::make_unique<ctx::AresDnsTxtLookup>(&io)) | ||
.with(SKT::RSA, | ||
std::make_unique<crypto::OpensslSignatureVerifier>(EVP_PKEY_RSA)) | ||
.with(SKT::Ed25519, std::make_unique<crypto::OpensslSignatureVerifier>( | ||
EVP_PKEY_ED25519)); | ||
auto rtor = gw::default_requestor({}, api); | ||
auto orc = std::make_shared<Orchestrator>(rtor, api); | ||
return {api, orc}; | ||
} | ||
|
||
#endif // HAS_OPINIONATED_CONTEXT |
This file was deleted.
Oops, something went wrong.