test: покрыть NopAuthenticator, GenerateSelfSignedCert, HandshakeSem

Минимальное покрытие для заготовки auth и хелперов dtlsdial:
- NopAuthenticator.Authenticate возвращает (Anonymous, nil)
- GenerateSelfSignedCert выдаёт рабочий сертификат с приватным ключом
- HandshakeSem блокирует захват при заполнении и уважает отмену ctx

Также документирует на Authenticator, что интерфейс stream-ориентирован; auth
UDP-режима получит отдельный token-based интерфейс.
This commit is contained in:
samosvalishe committed 2026-05-21 02:02:23 +03:00
1 parent c4b6774241
commit 3b73d720f1
4 files changed
+73

No files matched your search

+5
View File
@@ -20,6 +20,11 @@ const Anonymous TenantID = ""
// A nil error with [Anonymous] means the connection is accepted in
// non-multi-tenant mode. Any non-nil error must be treated as a rejection
// and the caller must close conn.
//
// This interface is stream-oriented: it consumes a net.Conn and is intended
// for bondserver/tcpfwdserver wiring. UDP-mode auth (when needed) will get
// a separate interface taking a token []byte read out-of-band from the
// handshake, since udpserver has no per-tenant stream abstraction.
type Authenticator interface {
Authenticate(ctx context.Context, conn net.Conn) (TenantID, error)
}