Support configurable TLS probes in the API and dashboard

This commit is contained in:
ayurishchev committed 2026-11-20 21:15:22 +03:00
1 parent 0bde5627f0
commit c7fdd2c430
38 files changed
+495 -203

No files matched your search

+37 -7
View File
@@ -15,6 +15,7 @@
</main>
</div>
</div>
<script src="/static/settings-inbound.js" defer></script>
</body>
</html>
{{end}}
@@ -106,12 +107,10 @@
<div class="panel">
<div class="panel-body">
<p class="muted" style="margin-bottom:16px">Типы проверок, которые прогоняет <code>prober</code> на каждой
настроенной площадке для каждого проверяемого адреса — глобальный набор, общий для всех площадок. Отдельно от
списка площадок (<a href="/sites">/sites</a>), который решает, <em>сколько</em> площадок опрашивать, а не
<em>что</em> именно они проверяют. Пустой список портов и выключенный ICMP — штатный способ временно свести
inbound-проверки к нулю, не трогая список площадок.</p>
<form hx-put="/settings/inbound-checks" hx-target="#settings-form-wrap" hx-swap="innerHTML">
<h2 class="section-title" style="margin-top:0">Входящие проверки</h2>
<p class="muted" style="margin-bottom:16px">Эти настройки применяются ко всем <a href="/sites">площадкам</a> пробера.</p>
{{template "banner_inner" .InboundError}}
<form data-inbound-checks hx-put="/settings/inbound-checks" hx-target="#settings-form-wrap" hx-swap="innerHTML">
<div class="field-row">
<div class="field">
<label for="inbound_ports">TCP-порты (через запятую)</label>
@@ -120,8 +119,24 @@ inbound-проверки к нулю, не трогая список площа
<div class="field">
<label for="inbound_icmp"><input type="checkbox" id="inbound_icmp" name="icmp" {{if .Inbound.ICMP}}checked{{end}}> ICMP</label>
</div>
<button type="submit" class="btn btn-primary">Сохранить</button>
</div>
{{$tlsMode := .Inbound.TLSMode}}
<div class="field">
<label for="inbound_tls_mode">TLS-рукопожатие</label>
<select id="inbound_tls_mode" name="tls_mode">
<option value="auto" {{if eq $tlsMode "auto"}}selected{{end}}>Автоматически при наличии TCP-порта 443</option>
<option value="custom" {{if eq $tlsMode "custom"}}selected{{end}}>Указать порт и версию</option>
<option value="disabled" {{if eq $tlsMode "disabled"}}selected{{end}}>Отключить TLS</option>
</select>
</div>
<fieldset data-tls-fields {{if ne $tlsMode "custom"}}hidden disabled{{end}} style="border:0;padding:0">
<div data-tls-rows>
{{range .Inbound.TLSChecks}}{{template "inbound_tls_row" .}}{{end}}
</div>
<button type="button" class="btn" data-tls-add>Добавить TLS-проверку</button>
<template data-tls-row-template>{{template "inbound_tls_row"}}</template>
</fieldset>
<button type="submit" class="btn btn-primary">Сохранить</button>
</form>
</div>
</div>
@@ -145,3 +160,18 @@ inbound-проверки к нулю, не трогая список площа
</div>
</div>
{{end}}
{{define "inbound_tls_row"}}
<div class="field-row" data-tls-row>
<label class="field">Порт TLS
<input type="number" name="tls_port" min="1" max="65535" step="1" required {{with .}}value="{{.Port}}"{{end}}>
</label>
<label class="field">Версия TLS
<select name="tls_version">
<option value="1.2" {{with .}}{{if eq .Version "1.2"}}selected{{end}}{{end}}>TLS 1.2</option>
<option value="1.3" {{with .}}{{if eq .Version "1.3"}}selected{{end}}{{end}}>TLS 1.3</option>
</select>
</label>
<button type="button" class="btn" data-tls-remove>Удалить</button>
</div>
{{end}}