ipfs-chromium
Loading...
Searching...
No Matches
gateway_config.h
1#ifndef IPFS_CHROMIUM_GATEWAY_CONFIG_H
2#define IPFS_CHROMIUM_GATEWAY_CONFIG_H
3
4#include <ipfs_client/gateway_spec.h>
5
6#include <cstdint>
7#include <optional>
8#include <string_view>
9
10namespace ipfs::ctx {
14 public:
15 virtual ~GatewayConfig() noexcept {}
20 virtual std::optional<GatewaySpec> GetGateway(std::size_t index) const = 0;
21 virtual unsigned GetGatewayRate(std::string_view url_prefix) = 0;
22 virtual int GetTypeAffinity(std::string_view url_prefix,
23 gw::GatewayRequestType) const = 0;
24 virtual void SetTypeAffinity(std::string_view url_prefix,
25 gw::GatewayRequestType,
26 int) = 0;
27
28 // These 2 calls are similar, but AddGateway will ignore rpm if the gw is
29 // already present,
30 // while SetGatewayRate will override it, as that's its primary purpose.
31 virtual void SetGatewayRate(std::string_view url_prefix, unsigned rpm) = 0;
32 virtual void AddGateway(std::string_view url_prefix, unsigned rpm) = 0;
33
34 // 0 implies off i.e. don't do this discovery
35 virtual unsigned RoutingApiDiscoveryDefaultRate() const = 0;
36 virtual bool RoutingApiDiscoveryOfUnencryptedGateways() const = 0;
37};
38} // namespace ipfs::ctx
39
40#endif // IPFS_CHROMIUM_GATEWAY_CONFIG_H
Definition gateway_config.h:13
virtual std::optional< GatewaySpec > GetGateway(std::size_t index) const =0