2021-05-14 17:07:44 +00:00
|
|
|
|
|
|
|
#include <llarp/ev/vpn.hpp>
|
|
|
|
|
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
|
|
|
|
|
|
|
#include <exception>
|
2021-01-11 23:13:22 +00:00
|
|
|
|
|
|
|
namespace llarp::vpn
|
|
|
|
{
|
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
|
2021-02-02 14:35:40 +00:00
|
|
|
plat = std::make_shared<vpn::Win32Platform>();
|
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
|