mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-10-31 09:20:21 +00:00
a2326efa37
This reverts commit2996a7f29c
, reversing changes made to10df3bd4b3
.
36 lines
900 B
C++
36 lines
900 B
C++
#include <exit/context.hpp>
|
|
|
|
#include <router/router.hpp>
|
|
#include <exit/context.hpp>
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
struct ExitTest : public ::testing::Test
|
|
{
|
|
ExitTest() : r(nullptr, nullptr, nullptr), context(&r)
|
|
{
|
|
}
|
|
|
|
llarp::Router r;
|
|
llarp::exit::Context context;
|
|
};
|
|
|
|
TEST_F(ExitTest, AddMultipleIP)
|
|
{
|
|
llarp::PubKey pk;
|
|
pk.Randomize();
|
|
llarp::PathID_t firstPath, secondPath;
|
|
firstPath.Randomize();
|
|
secondPath.Randomize();
|
|
llarp::exit::Context::Config_t conf;
|
|
conf.emplace("exit", "true");
|
|
conf.emplace("type", "null");
|
|
conf.emplace("ifaddr", "10.0.0.1/24");
|
|
|
|
ASSERT_TRUE(context.AddExitEndpoint("test-exit", conf));
|
|
ASSERT_TRUE(context.ObtainNewExit(pk, firstPath, true));
|
|
ASSERT_TRUE(context.ObtainNewExit(pk, secondPath, true));
|
|
ASSERT_TRUE(context.FindEndpointForPath(firstPath)->LocalIP()
|
|
== context.FindEndpointForPath(secondPath)->LocalIP());
|
|
}
|