mirror of
https://github.com/tsl0922/ttyd.git
synced 2026-01-08 11:54:22 +01:00
server: add option to toggle IPv6 support
This commit is contained in:
@@ -47,6 +47,7 @@ static const struct option options[] = {
|
||||
{"signal-list", no_argument, NULL, 1},
|
||||
{"reconnect", required_argument, NULL, 'r'},
|
||||
{"index", required_argument, NULL, 'I'},
|
||||
{"ipv6", no_argument, NULL, '6'},
|
||||
{"ssl", no_argument, NULL, 'S'},
|
||||
{"ssl-cert", required_argument, NULL, 'C'},
|
||||
{"ssl-key", required_argument, NULL, 'K'},
|
||||
@@ -61,7 +62,7 @@ static const struct option options[] = {
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{NULL, 0, 0, 0}
|
||||
};
|
||||
static const char *opt_string = "p:i:c:u:g:s:r:I:aSC:K:A:Rt:T:Om:oBd:vh";
|
||||
static const char *opt_string = "p:i:c:u:g:s:r:I:6aSC:K:A:Rt:T:Om:oBd:vh";
|
||||
|
||||
void print_help() {
|
||||
fprintf(stderr, "ttyd is a tool for sharing terminal over the web\n\n"
|
||||
@@ -85,6 +86,7 @@ void print_help() {
|
||||
" -o, --once Accept only one client and exit on disconnection\n"
|
||||
" -B, --browser Open terminal with the default system browser\n"
|
||||
" -I, --index Custom index.html path\n"
|
||||
" -6, --ipv6 Enable IPv6 support\n"
|
||||
" -S, --ssl Enable SSL\n"
|
||||
" -C, --ssl-cert SSL certificate file path\n"
|
||||
" -K, --ssl-key SSL key file path\n"
|
||||
@@ -236,7 +238,7 @@ main(int argc, char **argv) {
|
||||
info.gid = -1;
|
||||
info.uid = -1;
|
||||
info.max_http_header_pool = 16;
|
||||
info.options = LWS_SERVER_OPTION_VALIDATE_UTF8;
|
||||
info.options = LWS_SERVER_OPTION_VALIDATE_UTF8 | LWS_SERVER_OPTION_DISABLE_IPV6;
|
||||
info.extensions = extensions;
|
||||
|
||||
int debug_level = LLL_ERR | LLL_WARN | LLL_NOTICE;
|
||||
@@ -337,6 +339,9 @@ main(int argc, char **argv) {
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case '6':
|
||||
info.options &= ~(LWS_SERVER_OPTION_DISABLE_IPV6);
|
||||
break;
|
||||
case 'S':
|
||||
ssl = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user