Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

what wrong with this ? it wont connect to gt #5

Open
sdssaeq opened this issue Sep 17, 2022 · 5 comments
Open

what wrong with this ? it wont connect to gt #5

sdssaeq opened this issue Sep 17, 2022 · 5 comments

Comments

@sdssaeq
Copy link

sdssaeq commented Sep 17, 2022

the socks5 i had is be able to connect growtopia1.com and growtopia2.com
i`ve added the protocol u said
enet_host_set_using_new_packet(host, 1);
and not works, still get packet type 2
here code

@sdssaeq
Copy link
Author

sdssaeq commented Sep 17, 2022

#include <stdio.h>
#include <enet/enet.h>
int main() {
	if (enet_initialize() != 0) {
		fprintf(stderr, "Can't initialize ENet\n");
		return EXIT_FAILURE;
	}
	ENetHost* host = enet_host_create(NULL, 1, 1, 0, 0);
	if (!host) {
		fprintf(stderr, "Can't create host\n");
		return EXIT_FAILURE;
	}
	const char* proxy_host_ip = "mysocks5";
	ENetSocks5Config config;
	config.address.port = 9187;

	if (enet_address_set_host_ip(&config.address, proxy_host_ip)) {
		fprintf(stderr, "Can't bind address to %s\n", proxy_host_ip);
		return EXIT_FAILURE;
	}
	strcpy(config.username, "myuser");
	strcpy(config.password, "mypw");
	if (enet_host_use_socks5(host, &config)) {
		fprintf(stderr, "Can't bind host to socks5\n");
		return EXIT_FAILURE;
	}

	ENetAddress address;
	enet_address_set_host(&address, "213.179.209.168");
	address.port = 17198;

	const char* target_ip = "213.179.209.168"; // for example we want to connect to 69.420.69.420
	if (enet_address_set_host_ip(&address, target_ip) != 0) {
		fprintf(stderr, "Can't set address host ip to %s\n", target_ip);
		return EXIT_FAILURE;
	}

	printf("Client ready\n");
	host->checksum = enet_crc32;
	//host->enableLogging = 1;
	enet_host_compress_with_range_coder(host);
	enet_host_set_using_new_packet(host, 1);

	ENetPeer* Kon = enet_host_connect(host, &address, 1, 0);
	if (Kon == NULL)
	{
		printf("No available peers for initiating an ENet connection.\n");
		exit(EXIT_FAILURE);
	}
	enet_host_flush(host);


	ENetEvent event;
	while (1) {
		while (enet_host_service(host, &event, 10) > 0) {
			printf("Received event: %d\n", event.type);
			switch (event.type)
			{
			case ENET_EVENT_TYPE_NONE:
				printf("No event???\n");
				break;
			case ENET_EVENT_TYPE_CONNECT:
				printf("Connecting??\n");
				break;
			case ENET_EVENT_TYPE_DISCONNECT:
				printf("Dc??\n");
				break;
			case ENET_EVENT_TYPE_RECEIVE:
				printf("Signal??\n");
				enet_packet_destroy(event.packet);
				break;
			default:
				printf("??\n");
				break;
			}
		}
	}
}

@sdssaeq
Copy link
Author

sdssaeq commented Sep 17, 2022

image

@sdssaeq
Copy link
Author

sdssaeq commented Sep 17, 2022

if i delete the comment these, its connected to the server
image

        const char* proxy_host_ip = "mysocks5";
	ENetSocks5Config config;
	config.address.port = 9187;

	if (enet_address_set_host_ip(&config.address, proxy_host_ip)) {
		fprintf(stderr, "Can't bind address to %s\n", proxy_host_ip);
		return EXIT_FAILURE;
	}
	strcpy(config.username, "myuser");
	strcpy(config.password, "mypw");
	if (enet_host_use_socks5(host, &config)) {
		fprintf(stderr, "Can't bind host to socks5\n");
		return EXIT_FAILURE;}

@zKevz
Copy link
Owner

zKevz commented Sep 24, 2022

That seems correct, but i don't know why yours are not working, maybe gt shadowbans your proxy? Mines are working fine

@koftrciali
Copy link

the peer go CONNECTING state then disconnect
can help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants