2021-05-14 17:07:44 +00:00
|
|
|
|
2022-07-28 16:07:38 +00:00
|
|
|
#include "platform.hpp"
|
2021-05-14 17:07:44 +00:00
|
|
|
|
2021-01-11 23:13:22 +00:00
|
|
|
#ifdef _WIN32
|
2021-03-09 22:24:35 +00:00
|
|
|
#include "win32.hpp"
|
2021-01-11 23:13:22 +00:00
|
|
|
#endif
|
|
|
|
#ifdef __linux__
|
|
|
|
#ifdef ANDROID
|
2021-03-09 22:24:35 +00:00
|
|
|
#include "android.hpp"
|
2021-01-11 23:13:22 +00:00
|
|
|
#else
|
2021-03-09 22:24:35 +00:00
|
|
|
#include "linux.hpp"
|
2021-01-11 23:13:22 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
2021-05-14 17:07:44 +00:00
|
|
|
|
2021-01-11 23:13:22 +00:00
|
|
|
namespace llarp::vpn
|
|
|
|
{
|
2022-07-09 15:05:52 +00:00
|
|
|
const llarp::net::Platform*
|
2023-09-19 20:09:18 +00:00
|
|
|
AbstractRouteManager::Net_ptr() const
|
2022-07-09 15:05:52 +00:00
|
|
|
{
|
|
|
|
return llarp::net::Platform::Default_ptr();
|
|
|
|
}
|
|
|
|
|
2021-02-02 14:35:40 +00:00
|
|
|
std::shared_ptr<Platform>
|
2021-01-11 23:13:22 +00:00
|
|
|
MakeNativePlatform(llarp::Context* ctx)
|
|
|
|
{
|
|
|
|
(void)ctx;
|
2021-02-02 14:35:40 +00:00
|
|
|
std::shared_ptr<Platform> plat;
|
2021-01-11 23:13:22 +00:00
|
|
|
#ifdef _WIN32
|
2022-07-28 16:07:38 +00:00
|
|
|
plat = std::make_shared<llarp::win32::VPNPlatform>(ctx);
|
2021-01-11 23:13:22 +00:00
|
|
|
#endif
|
|
|
|
#ifdef __linux__
|
|
|
|
#ifdef ANDROID
|
2021-03-02 18:18:22 +00:00
|
|
|
plat = std::make_shared<vpn::AndroidPlatform>(ctx);
|
2021-01-11 23:13:22 +00:00
|
|
|
#else
|
2021-02-02 14:35:40 +00:00
|
|
|
plat = std::make_shared<vpn::LinuxPlatform>();
|
2021-01-11 23:13:22 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifdef __APPLE__
|
2021-05-14 17:07:44 +00:00
|
|
|
throw std::runtime_error{"not supported"};
|
2021-01-11 23:13:22 +00:00
|
|
|
#endif
|
|
|
|
return plat;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace llarp::vpn
|