feat: comment cleanup

This commit is contained in:
samosvalishe committed 2026-08-16 23:13:01 +03:00
1 parent 6b14a95434
commit 648c55415b
112 files changed
+655 -2161

No files matched your search

+3 -15
View File
@@ -1,7 +1,4 @@
// Package bondclient реализует клиентскую сторону bonded VLESS lane:
// одно принятое TCP-соединение, распределённое (round-robin) по всем активным
// smux-сессиям в tcpfwd.SessionPool. Wire-формат фреймов - internal/wire/bondframe;
// пакет соединяет copy-loop локального TCP ↔ lanes.
// Package bondclient реализует клиентскую сторону агрегации нескольких smux-потоков в одно TCP-соединение.
package bondclient
import (
@@ -24,7 +21,6 @@ import (
"github.com/xtaci/smux"
)
// Deps - зависимости хост-процесса для bond-клиента.
type Deps struct {
Log logx.Logger
}
@@ -36,12 +32,10 @@ func (d *Deps) log() logx.Logger {
return d.Log
}
// Handler связывает Deps и предоставляет Handle под сигнатуру tcpfwd.BondHandler.
type Handler struct {
Deps Deps
}
// lane - один smux-поток внутри bonded TCP-соединения.
type lane struct {
ps *tcpfwd.PooledSession
stream *smux.Stream
@@ -49,17 +43,13 @@ type lane struct {
dead atomic.Bool
}
// Handle распределяет локальное TCP-соединение по всем активным сессиям-кандидатам.
// Сигнатура соответствует tcpfwd.BondHandler.
// Handle распределяет трафик принятого TCP-соединения по доступным smux-сессиям.
func (h *Handler) Handle(ctx context.Context, tcpConn net.Conn, connID uint64, candidates []*tcpfwd.PooledSession) {
defer func() { _ = tcpConn.Close() }()
ctx, cancel := context.WithCancel(ctx)
defer cancel()
// Фаза 1: открыть потоки на доступных сессиях. Фаза 2: отправить Hello с
// реальным числом lane - bondserver.waitForInitialLanes не будет ждать
// lane, которые не были открыты.
type pending struct {
ps *tcpfwd.PooledSession
stream *smux.Stream
@@ -208,9 +198,7 @@ func (h *Handler) copyTCPToBond(ctx context.Context, connID uint64, tcpConn net.
}
}
// writeBondFrameToNextLane пишет в следующий живой lane в порядке round-robin.
// В отличие от bondserver.writeToNextLane (который ждёт новые lane), набор
// lane клиента фиксирован на время жизни Handle - нечего ждать, fail fast.
// writeBondFrameToNextLane пишет фрейм в следующий активный lane в порядке round-robin.
func writeBondFrameToNextLane(ctx context.Context, lanes []*lane, typ byte, seq uint64, data []byte, laneIdx *uint64) (*lane, error) {
for range lanes {
idx := *laneIdx % uint64(len(lanes))