mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-03 23:15:52 +00:00
388fc53380
on win32/apple reading packets from the interface does not count as an io operation. manually trigger pump on win32/apple to pretend that it is an io event. add platform quark function MaybeWakeUpperLayers on vpn::Interface to manaully wake up the other components on platforms that need that (ones on which packet io is not done via io events). on non linux platforms, use uv_prepare_t instead of uv_check_t as the former triggers before blocking for io, instead of after. this better matches linux's order of operations in libuv.
36 lines
859 B
C++
36 lines
859 B
C++
#pragma once
|
|
|
|
#include <llarp/ev/vpn.hpp>
|
|
#include "vpn_interface.hpp"
|
|
#include "route_manager.hpp"
|
|
|
|
namespace llarp::apple
|
|
{
|
|
class VPNPlatform final : public vpn::Platform
|
|
{
|
|
public:
|
|
explicit VPNPlatform(
|
|
Context& ctx,
|
|
VPNInterface::packet_write_callback packet_writer,
|
|
VPNInterface::on_readable_callback on_readable,
|
|
llarp_route_callbacks route_callbacks,
|
|
void* callback_context);
|
|
|
|
std::shared_ptr<vpn::NetworkInterface>
|
|
ObtainInterface(vpn::InterfaceInfo, AbstractRouter*) override;
|
|
|
|
vpn::IRouteManager&
|
|
RouteManager() override
|
|
{
|
|
return m_RouteManager;
|
|
}
|
|
|
|
private:
|
|
Context& m_Context;
|
|
apple::RouteManager m_RouteManager;
|
|
VPNInterface::packet_write_callback m_PacketWriter;
|
|
VPNInterface::on_readable_callback m_OnReadable;
|
|
};
|
|
|
|
} // namespace llarp::apple
|