diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 00:55:53 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 00:55:53 +0000 |
commit | 3d0386f27ca66379acf50199e1d1298386eeeeb8 (patch) | |
tree | f87bd4a126b3a843858eb447e8fd5893c3ee3882 /tests/pytests/rehandshake/tlsproxy.c | |
parent | Initial commit. (diff) | |
download | knot-resolver-3d0386f27ca66379acf50199e1d1298386eeeeb8.tar.xz knot-resolver-3d0386f27ca66379acf50199e1d1298386eeeeb8.zip |
Adding upstream version 3.2.1.upstream/3.2.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/pytests/rehandshake/tlsproxy.c')
-rw-r--r-- | tests/pytests/rehandshake/tlsproxy.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/pytests/rehandshake/tlsproxy.c b/tests/pytests/rehandshake/tlsproxy.c new file mode 100644 index 0000000..0c074f1 --- /dev/null +++ b/tests/pytests/rehandshake/tlsproxy.c @@ -0,0 +1,31 @@ +#include <stdio.h> +#include "tls-proxy.h" +#include <gnutls/gnutls.h> + +int main() +{ + struct tls_proxy_ctx *proxy = tls_proxy_allocate(); + if (!proxy) { + fprintf(stderr, "can't allocate tls_proxy structure\n"); + return 1; + } + int res = tls_proxy_init(proxy, + "127.0.0.1", 53921, /* Address to listen */ + "127.0.0.1", 53910, /* Upstream address */ + "../certs/tt.cert.pem", + "../certs/tt.key.pem"); + if (res) { + fprintf(stderr, "can't initialize tls_proxy structure\n"); + return res; + } + res = tls_proxy_start_listen(proxy); + if (res) { + fprintf(stderr, "error starting listen, error code: %i\n", res); + return res; + } + fprintf(stdout, "started...\n"); + res = tls_proxy_run(proxy); + tls_proxy_free(proxy); + return res; +} + |