49 lines
No EOL
998 B
C++
49 lines
No EOL
998 B
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_compression(bool enabled);
|
|
void set_network(String user_name, String network_name, String network_password);
|
|
void set_supernode(String address, int port);
|
|
int start_network();
|
|
int stop_network();
|
|
};
|
|
|
|
|
|
#endif // GODOT_N2NVPN_H
|