2021-08-25 23:28:58 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-08-30 17:55:33 +00:00
|
|
|
#include "route_manager.hpp"
|
2023-10-24 13:18:03 +00:00
|
|
|
#include "vpn_interface.hpp"
|
|
|
|
|
|
|
|
#include <llarp/vpn/platform.hpp>
|
2021-08-25 23:28:58 +00:00
|
|
|
|
|
|
|
namespace llarp::apple
|
|
|
|
{
|
|
|
|
class VPNPlatform final : public vpn::Platform
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit VPNPlatform(
|
|
|
|
Context& ctx,
|
|
|
|
VPNInterface::packet_write_callback packet_writer,
|
2021-08-30 17:55:33 +00:00
|
|
|
VPNInterface::on_readable_callback on_readable,
|
|
|
|
llarp_route_callbacks route_callbacks,
|
2021-09-01 18:10:08 +00:00
|
|
|
void* callback_context);
|
2021-08-25 23:28:58 +00:00
|
|
|
|
2021-12-07 16:17:20 +00:00
|
|
|
std::shared_ptr<vpn::NetworkInterface>
|
2023-09-15 14:55:32 +00:00
|
|
|
ObtainInterface(vpn::InterfaceInfo, Router*) override;
|
2021-08-25 23:28:58 +00:00
|
|
|
|
2023-09-19 20:09:18 +00:00
|
|
|
vpn::AbstractRouteManager&
|
2021-09-01 18:31:45 +00:00
|
|
|
RouteManager() override
|
|
|
|
{
|
2023-09-19 20:09:18 +00:00
|
|
|
return _route_manager;
|
2021-09-01 18:31:45 +00:00
|
|
|
}
|
2021-08-30 17:55:33 +00:00
|
|
|
|
2021-08-25 23:28:58 +00:00
|
|
|
private:
|
2023-09-19 20:09:18 +00:00
|
|
|
Context& _context;
|
|
|
|
apple::RouteManager _route_manager;
|
|
|
|
VPNInterface::packet_write_callback _packet_writer;
|
|
|
|
VPNInterface::on_readable_callback _read_cb;
|
2021-08-25 23:28:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace llarp::apple
|