hamncheese/modules/n2nvpn/n2nvpn.h
2023-08-26 19:51:18 -05:00

53 lines
1.2 KiB
C++

#ifndef GODOT_N2NVPN_H
#define GODOT_N2NVPN_H
#include <thread>
#include "core/object/ref_counted.h"
#include "core/variant/variant.h"
extern "C" {
#include "n2n.h"
}
class N2NVPN : public RefCounted {
GDCLASS(N2NVPN, RefCounted);
private:
bool _keep_running;
n2n_edge *_eee;
n2n_edge_conf_t _conf;
String _network_password;
String _user_name;
std::thread *_edge_thread;
String _mac_address;
String _ip_address;
void _edge_thread_function();
protected:
static void _bind_methods();
public:
N2NVPN();
String get_ip();
String get_mac();
Array get_peers();
void reset_configuration();
void set_addresses(String ip, String mac);
void set_binding(String ip, int16_t port);
void set_compression(bool enabled);
void set_management(String password, int16_t port);
void set_network(String user_name, String network_name, String network_password);
void set_registration(int16_t interval, int16_t ttl);
void set_routing(bool enabled);
void set_supernode(String address, int port);
int start_network();
int stop_network();
};
#endif // GODOT_N2NVPN_H