feat: add support alpn in bind option

This commit is contained in:
Adrien Waksberg 2022-01-11 12:28:35 +01:00
parent 40f7e11be9
commit 7e4781cb4b
4 changed files with 4 additions and 1 deletions

View file

@ -7,6 +7,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
### Added
- add support alpn in bind option
- add error files
- use multiple ssl certificates on one frontend

View file

@ -44,6 +44,7 @@
bind:
ip: '*'
port: 5000
alpn: h2,http/1.1
acl:
- url_static path_beg -i /static /images /javascript /stylesheets
- url_static path_end -i .jpg .gif .png .css .js

View file

@ -11,6 +11,7 @@ def test_config_file(host):
assert path.user == 'root'
assert path.group == 'root'
assert path.mode == 0o640
assert path.contains('bind \\*:5000 alpn h2,http/1.1')
assert path.contains('server host1 127.0.0.1:443 ssl verify none check maxconn 1000 inter 15s')
assert path.contains('resolvers dns')

View file

@ -78,7 +78,7 @@ userlist {{ userlist }}
frontend {{ frontend }}
{% for key, value in config.items() %}
{% if key == "bind" %}
bind {{ value["ip"] }}:{{ value["port"] }}{% if value["ssl"] is defined %} ssl{% if value["ssl"]["ciphers"] is defined %} ciphers {{ value["ssl"]["ciphers"]|join(':') }}{% endif %}{% if value["ssl"]["crt"]%} crt {% if value["ssl"]["crt"] is string %}{{ value["ssl"]["crt"] }}{% else %}{{ value["ssl"]["crt"]|join(' crt ') }}{% endif %}{% endif %}
bind {{ value["ip"] }}:{{ value["port"] }}{% if value["alpn"] is defined %} alpn {{ value["alpn"] }}{% endif %}{% if value["ssl"] is defined %} ssl{% if value["ssl"]["ciphers"] is defined %} ciphers {{ value["ssl"]["ciphers"]|join(':') }}{% endif %}{% if value["ssl"]["crt"]%} crt {% if value["ssl"]["crt"] is string %}{{ value["ssl"]["crt"] }}{% else %}{{ value["ssl"]["crt"]|join(' crt ') }}{% endif %}{% endif %}
{% endif %}
{% elif value is iterable and value is not string %}