TLS transport: OpenSSL-based encrypted TCP #13

Merged
TapTap merged 8 commits from tls-transport into main 2026-07-18 17:54:26 +02:00
2 changed files with 10 additions and 5 deletions
Showing only changes of commit 20ede4391c - Show all commits
+9 -4
View File
@@ -161,7 +161,13 @@ int main(int argc, char *argv[]) {
} else if (strcmp(argv[i], "--ca") == 0 && i + 1 < argc) { } else if (strcmp(argv[i], "--ca") == 0 && i + 1 < argc) {
tls_ca = argv[++i]; tls_ca = argv[++i];
} else if (strcmp(argv[i], "-p") == 0 && i + 1 < argc) { } else if (strcmp(argv[i], "-p") == 0 && i + 1 < argc) {
port = atoi(argv[++i]); char *end;
long p = strtol(argv[++i], &end, 10);
if (*end || p <= 0 || p > 65535) {
fprintf(stderr, "Error: invalid port '%s' (must be 1-65535)\n", argv[i]);
return 1;
}
port = (int)p;
} else if (argv[i][0] == '-') { } else if (argv[i][0] == '-') {
fprintf(stderr, "Unknown option: %s\n", argv[i]); fprintf(stderr, "Unknown option: %s\n", argv[i]);
print_server_usage(); print_server_usage();
@@ -169,9 +175,8 @@ int main(int argc, char *argv[]) {
} }
} }
if (port < 1 || port > 65535) { if (tls_ca && !use_tls) {
fprintf(stderr, "Error: port must be between 1 and 65535\n"); log_message(LOG_LEVEL_WARNING, "--ca has no effect without --tls");
return 1;
} }
signal(SIGINT, cleanup); signal(SIGINT, cleanup);
+1 -1
View File
@@ -10,7 +10,7 @@
static __thread int io_read_fd = -1; static __thread int io_read_fd = -1;
static __thread int io_write_fd = -1; static __thread int io_write_fd = -1;
static __thread SSL *io_ssl = NULL; static SSL *io_ssl = NULL;
static unsigned long long io_bwlimit = 0; static unsigned long long io_bwlimit = 0;
static long long bw_tokens = 0; static long long bw_tokens = 0;