This commit is contained in:
2025-11-13 15:12:00 +01:00
parent 5c8409b312
commit c85f622a60
7 changed files with 19 additions and 15 deletions

View File

@@ -28,7 +28,7 @@ namespace ColumnLynx::Net::TCP {
std::array<uint8_t, 32>* aesKey,
uint64_t* sessionIDRef,
bool* insecureMode,
VirtualInterface* tun = nullptr)
std::shared_ptr<VirtualInterface> tun = nullptr)
:
mResolver(ioContext),
mSocket(ioContext),
@@ -74,6 +74,6 @@ namespace ColumnLynx::Net::TCP {
int mMissedHeartbeats = 0;
bool mIsHostDomain;
Protocol::TunConfig mTunConfig;
VirtualInterface* mTun = nullptr;
std::shared_ptr<VirtualInterface> mTun = nullptr;
};
}

View File

@@ -19,7 +19,7 @@ namespace ColumnLynx::Net::UDP {
const std::string& port,
std::array<uint8_t, 32>* aesKeyRef,
uint64_t* sessionIDRef,
VirtualInterface* tunRef = nullptr)
std::shared_ptr<VirtualInterface> tunRef = nullptr)
: mSocket(ioContext), mResolver(ioContext), mHost(host), mPort(port), mAesKeyRef(aesKeyRef), mSessionIDRef(sessionIDRef), mTunRef(tunRef) { mStartReceive(); }
void start();
@@ -37,7 +37,7 @@ namespace ColumnLynx::Net::UDP {
std::string mPort;
std::array<uint8_t, 32>* mAesKeyRef;
uint64_t* mSessionIDRef;
VirtualInterface* mTunRef;
std::shared_ptr<VirtualInterface> mTunRef = nullptr;
std::array<uint8_t, 2048> mRecvBuffer; // Adjust size as needed
};
}

View File

@@ -13,7 +13,7 @@
namespace ColumnLynx::Net::UDP {
class UDPServer {
public:
UDPServer(asio::io_context& ioContext, uint16_t port, bool* hostRunning, bool ipv4Only = false, VirtualInterface* tun = nullptr)
UDPServer(asio::io_context& ioContext, uint16_t port, bool* hostRunning, bool ipv4Only = false, std::shared_ptr<VirtualInterface> tun = nullptr)
: mSocket(ioContext), mHostRunning(hostRunning), mTun(tun)
{
asio::error_code ec;
@@ -53,6 +53,6 @@ namespace ColumnLynx::Net::UDP {
asio::ip::udp::endpoint mRemoteEndpoint;
std::array<uint8_t, 2048> mRecvBuffer; // Adjust size as needed
bool* mHostRunning;
VirtualInterface* mTun;
std::shared_ptr<VirtualInterface> mTun;
};
}