feat: add optional sequential port allocation with atomic reservations

Adapt the port allocation option from #583 by xigua761 without its commercial licensing changes. Serialize forward, chain, peer runtime, cleanup and import reservations across SQLite/PostgreSQL instances.

Co-authored-by: xigua761 <xigua1166@outlook.com>
This commit is contained in:
sagit
2026-11-15 12:00:48 +08:00
parent 8339f52280
commit 48955fe57d
14 changed files with 773 additions and 201 deletions
@@ -7,6 +7,9 @@ import (
)
func (r *Repository) QueueTunnelRuntimeCleanupTx(tx *gorm.DB, items []model.TunnelRuntimeCleanup) error {
if err := lockPortAllocationTx(tx); err != nil {
return err
}
for _, item := range items {
var node model.Node
if err := tx.Select("id", "is_remote").Where("id = ?", item.NodeID).First(&node).Error; err != nil {