2021-03-09 22:24:35 +00:00
|
|
|
#pragma once
|
2018-12-12 02:52:51 +00:00
|
|
|
|
2021-03-09 22:24:35 +00:00
|
|
|
#include <llarp/util/bencode.hpp>
|
2018-11-12 16:43:40 +00:00
|
|
|
|
2023-10-24 13:18:03 +00:00
|
|
|
#include <oxenc/bt.h>
|
|
|
|
|
2023-08-31 16:28:02 +00:00
|
|
|
namespace
|
2018-11-12 16:43:40 +00:00
|
|
|
{
|
2023-08-31 16:28:02 +00:00
|
|
|
static auto policy_cat = llarp::log::Cat("lokinet.policy");
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
namespace llarp::exit
|
|
|
|
{
|
|
|
|
struct Policy
|
2018-11-12 16:43:40 +00:00
|
|
|
{
|
2023-08-31 16:28:02 +00:00
|
|
|
uint64_t proto = 0;
|
|
|
|
uint64_t port = 0;
|
|
|
|
uint64_t drop = 0;
|
|
|
|
uint64_t version = llarp::constants::proto_version;
|
2018-11-12 16:43:40 +00:00
|
|
|
|
2023-08-31 16:28:02 +00:00
|
|
|
bool
|
|
|
|
BDecode(llarp_buffer_t* buf)
|
|
|
|
{
|
|
|
|
return bencode_decode_dict(*this, buf);
|
|
|
|
}
|
2018-11-12 16:43:40 +00:00
|
|
|
|
2023-08-31 16:28:02 +00:00
|
|
|
bool
|
|
|
|
decode_key(const llarp_buffer_t& k, llarp_buffer_t* val);
|
2018-11-12 16:43:40 +00:00
|
|
|
|
2023-08-31 16:28:02 +00:00
|
|
|
void
|
|
|
|
bt_encode(oxenc::bt_dict_producer& btdp) const;
|
|
|
|
};
|
|
|
|
} // namespace llarp::exit
|