summaryrefslogtreecommitdiffstats
path: root/tests/pytests/rehandshake/tcproxy.c
blob: 87a6b4c16f05bb7818d674ded4ba115330f8a8f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h>
#include "tcp-proxy.h"

int main()
{
	struct proxy_ctx *proxy = proxy_allocate();
	if (!proxy) {
		fprintf(stderr, "can't allocate proxy structure\n");
		return 1;
	}
	int res = proxy_init(proxy, "127.0.0.1", 54000, "127.0.0.1", 53001);
	if (res) {
		fprintf(stderr, "can't initialize proxy by given addresses\n");
		return res;
	}
	res = proxy_start_listen(proxy);
	if (res) {
		fprintf(stderr, "error starting listen, error code: %i\n", res);
		return res;
	}
	res = proxy_run(proxy);
	proxy_free(proxy);
	return res;
}