diff --git a/example.cfg b/example.cfg index cd1a8ee..b818e89 100644 --- a/example.cfg +++ b/example.cfg @@ -123,7 +123,7 @@ protocols: udp_timeout: 20; # Time after which the "connection" is forgotten regex_patterns: [ "hello" ]; }, # Forward Teamspeak3 (Voice only) - { name: "regex"; host: "localhost"; is_udp: true; port: "9987"; regex_patterns: [ "TS3INIT1" ]; }, + { name: "teamspeak"; host: "localhost"; is_udp: true; port: "9987"; }, # Forward IETF QUIC-50 ("Q050" -> "\x51\x30\x35\x30") # Remember that the regex needs to be adjusted for every supported QUIC version. { name: "regex"; host: "localhost"; is_udp: true; port: "4433"; regex_patterns: [ "\x51\x30\x35\x30" ]; }, diff --git a/probe.c b/probe.c index 4f704a0..fdf9424 100644 --- a/probe.c +++ b/probe.c @@ -40,6 +40,7 @@ static int is_tls_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_ static int is_adb_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_item*); static int is_socks5_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_item*); static int is_syslog_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_item*); +static int is_teamspeak_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_item*); static int is_true(const char *p, ssize_t len, struct sslhcfg_protocols_item* proto) { return 1; } /* Table of protocols that have a built-in probe @@ -55,6 +56,7 @@ static struct protocol_probe_desc builtins[] = { { "adb", is_adb_protocol }, { "socks5", is_socks5_protocol }, { "syslog", is_syslog_protocol }, + { "teamspeak", is_teamspeak_protocol }, { "anyprot", is_true } }; @@ -353,6 +355,14 @@ static int is_syslog_protocol(const char *p, ssize_t len, struct sslhcfg_protoco return 0; } +static int is_teamspeak_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_item* proto) +{ + if (len < 8) + return PROBE_NEXT; + + return !strncmp(p, "TS3INIT1", len); +} + static int regex_probe(const char *p, ssize_t len, struct sslhcfg_protocols_item* proto) { #ifdef ENABLE_REGEX