2021-08-25 23:28:58 +00:00
|
|
|
#pragma once
|
|
|
|
|
2022-09-15 21:30:33 +00:00
|
|
|
#include <llarp/vpn/platform.hpp>
|
2021-08-25 23:28:58 +00:00
|
|
|
#include "vpn_interface.hpp"
|
2021-08-30 17:55:33 +00:00
|
|
|
#include "route_manager.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>
|
|
|
|
ObtainInterface(vpn::InterfaceInfo, AbstractRouter*) override;
|
2021-08-25 23:28:58 +00:00
|
|
|
|
2021-09-01 18:31:45 +00:00
|
|
|
vpn::IRouteManager&
|
|
|
|
RouteManager() override
|
|
|
|
{
|
|
|
|
return m_RouteManager;
|
|
|
|
}
|
2021-08-30 17:55:33 +00:00
|
|
|
|
2021-08-25 23:28:58 +00:00
|
|
|
private:
|
|
|
|
Context& m_Context;
|
2021-08-30 17:55:33 +00:00
|
|
|
apple::RouteManager m_RouteManager;
|
2021-08-25 23:28:58 +00:00
|
|
|
VPNInterface::packet_write_callback m_PacketWriter;
|
|
|
|
VPNInterface::on_readable_callback m_OnReadable;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace llarp::apple
|