Based on Nekogram. Key additions: - Rebrand to FoxiGram (app name, APK name, applicationId com.foxigram.app) - Embedded Xray (VLESS+Reality) proxy client via JNI libxray.so - Bundled hidden one-tap proxies (LTE + WiFi), read-only in UI - Auto-restore proxy on restart, rebind to active network (LTE/WiFi) - Server credentials externalized to git-ignored XrayServers.java (+ template) - libxray Go source included; compiled .so, keystore, google-services.json ignored
50 lines
1.2 KiB
C++
50 lines
1.2 KiB
C++
//
|
|
// libtgvoip is free and unencumbered public domain software.
|
|
// For more information, see http://unlicense.org or the UNLICENSE file
|
|
// you should have received with this source code distribution.
|
|
//
|
|
#ifndef TGVOIP_MOCK_REFLECTOR
|
|
#define TGVOIP_MOCK_REFLECTOR
|
|
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <array>
|
|
#include <stdint.h>
|
|
#include <pthread.h>
|
|
|
|
#include <sys/socket.h>
|
|
#include <errno.h>
|
|
#include <assert.h>
|
|
#include <netdb.h>
|
|
#include <net/if.h>
|
|
#include <sys/ioctl.h>
|
|
#include <unistd.h>
|
|
#include <netinet/tcp.h>
|
|
|
|
namespace tgvoip{
|
|
namespace test{
|
|
class MockReflector{
|
|
public:
|
|
MockReflector(std::string bindAddress, uint16_t bindPort);
|
|
~MockReflector();
|
|
void Start();
|
|
void Stop();
|
|
void SetDropAllPackets(bool drop);
|
|
static std::array<std::array<uint8_t, 16>, 2> GeneratePeerTags();
|
|
|
|
private:
|
|
void RunThread();
|
|
struct ClientPair{
|
|
sockaddr_in addr0={0};
|
|
sockaddr_in addr1={0};
|
|
};
|
|
std::unordered_map<uint64_t, ClientPair> clients; // clients are identified by the first half of their peer_tag
|
|
int sfd;
|
|
pthread_t thread;
|
|
bool running=false;
|
|
bool dropAllPackets=false;
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif //TGVOIP_MOCK_REFLECTOR
|