This PR adds the backend validation logic for processing the user-provided input values for the STUN server (server + port). These values will later come from the UI.
Notes
I added comments in the janus.jcfg file to shed some more light on how the config parameters work.
Based on these rules, I implemented the request validators.
I created a unified, public parse_h264_stun_address validation, to enforce that they are either both present or both absent.
The _SERVER_PATTERN is intentionally broad, I’m not sure it would be worth to have a stricter validation here. (At least I couldn’t find any reasonably simple way, without either making the regex more complex, or pulling in an external library.) For our purposes, it’s probably enough to provide a sanity check, rather than a bullet-proof validation.
The IP address validation can be done conveniently via the ipaddress native Python package.
Related https://github.com/tiny-pilot/tinypilot/issues/1460.
This PR adds the backend validation logic for processing the user-provided input values for the STUN server (server + port). These values will later come from the UI.
Notes
janus.jcfg
file to shed some more light on how the config parameters work.parse_h264_stun_address
validation, to enforce that they are either both present or both absent._SERVER_PATTERN
is intentionally broad, I’m not sure it would be worth to have a stricter validation here. (At least I couldn’t find any reasonably simple way, without either making the regex more complex, or pulling in an external library.) For our purposes, it’s probably enough to provide a sanity check, rather than a bullet-proof validation.ipaddress
native Python package.