Compare commits

..

376 Commits

Author SHA1 Message Date
sagit 4966a8aad1 fix(backend): sync user tunnel status and relax forward speedId permission check (#288)
## Summary

- Return actual `user_tunnel.status` in admin permission list instead of
hardcoded enabled state (1)
- Allow non-admin users to update forwards when keeping the same
`speedId` selection
- Add contract tests for user tunnel status mapping and forward
permission edge case

## Test Plan

- [x] Contract tests pass: `cd go-backend && go test
./tests/contract/...`
- [x] User tunnel permission list returns correct status values
(enabled/disabled)
- [x] Non-admin users can update forward details when keeping existing
speedId
2026-03-08 00:57:57 +08:00
sagitchu 3e11549370 fix(backend): sync user tunnel status and relax forward speedId permission check
- Return actual user_tunnel.status in admin permission list instead of hardcoded 1
- Allow non-admin users to update forwards when keeping the same speedId selection
- Add contract tests for user tunnel status mapping and forward permission edge case

Entire-Checkpoint: deb90fb942ee
2026-03-08 00:56:13 +08:00
sagit addf83a249 fix(ui): improve date input parsing and add missing back navigation (#284)
## Summary
- Improve DatePicker text parsing to accept more input formats
(including `YYYYMMDD`) without requiring explicit separators
- Add missing H5 back-navigation for panel-sharing by using simple
layout route
- Add a back button on config page with history fallback (`navigate(-1)`
then `/profile`)

## Why
These are usability/accessibility improvements that are generic and not
project-brand specific:
- Mobile keyboards may not easily input `-` in date fields
- Certain pages in H5 lacked a consistent return path
- Config page had no explicit in-page back action

## Scope
- `vite-frontend/src/shadcn-bridge/heroui/date-picker.tsx`
- `vite-frontend/src/App.tsx`
- `vite-frontend/src/pages/config.tsx`

## Notes
No branding/identity/ownership/visual-theme customizations included in
this PR.
2026-03-07 18:07:07 +08:00
sagitchu c3e35fd416 fix(ui): tighten date parsing and back navigation
Entire-Checkpoint: fea62b38d8c7
2026-03-07 18:02:00 +08:00
sagit 775dfe19f1 Merge branch 'main' into fix/upstream-friendly-ui-3pack 2026-03-07 17:36:29 +08:00
sagit db3b2f651b fix: improve bind-conflict detection and forward cleanup reliability (#287)
## Summary
- Normalize whitespace in bind-conflict error messages to handle
collapsed variants (e.g., "address alreadyin use")
- Update forward cleanup to delete all service name variants (_tcp,
_udp, base) instead of stopping after first success
- Add comprehensive test coverage for edge cases with missing-space
error variants

## Test plan
- ✅ Unit tests: `cd go-backend && go test ./internal/http/handler/...`
- ✅ Contract tests: `cd go-backend && go test ./tests/contract/... -run
'TestForwardUpdateRecoversFromAddressInUseContract|TestTunnelUpdateRecoversFromAddressInUseContract'`
2026-03-07 17:21:00 +08:00
sagitchu 669323f926 fix: improve bind-conflict detection and forward cleanup reliability
- Normalize whitespace in error messages to handle collapsed variants (e.g., 'address alreadyin use')
- Delete all forward service name variants (_tcp, _udp, base) during cleanup instead of stopping after first success
- Add comprehensive test coverage for edge cases
2026-03-07 17:19:28 +08:00
𝓐𝓵𝓽𝓲𝓸𝓷 7202b69e4e Merge branch 'main' into fix/upstream-friendly-ui-3pack 2026-03-07 17:00:31 +08:00
sagit 31977a62e6 fix: add retry mechanism for tunnel service bind conflicts (#286)
## Summary
- Add retry logic for tunnel service creation/update when encountering
"address already in use" bind errors
- Automatically cleanup stale service and retry once before failing
- Add comprehensive unit and contract tests for bind conflict scenarios

## Changes
- `mutations.go`: Add `retryTunnelServiceAddWithCleanup` helper and
`addTunnelServiceOnNode` wrapper
- `control_plane_test.go`: Unit tests for retry behavior on address
conflicts
- `dual_stack_test.go`: Test fallback to node listen address
- `forward_contract_test.go`: Contract test for forward update with bind
retry
- `limiter_sync_failure_contract_test.go`: Contract test for tunnel
update with bind retry
- `plans/016-tunnel-runtime-bind-conflict-retry.md`: Implementation plan
document

## Test Plan
- Unit tests verify retry logic executes correctly
- Contract tests validate end-to-end behavior with mock nodes
- All tests pass with race detector enabled
2026-03-07 16:23:13 +08:00
sagitchu 87479c2ac1 fix: add retry mechanism for tunnel service bind conflicts
When tunnel services encounter 'address already in use' errors during
creation/update, automatically cleanup and retry once instead of failing
immediately. This handles race conditions during rapid tunnel reconfiguration.

Entire-Checkpoint: 39e6fb9de836
2026-03-07 16:21:44 +08:00
Su-cyber-art ffda0fb71a fix(ui): improve date input parsing and add missing back navigation 2026-03-07 14:19:23 +08:00
sagit 9c0e7341c3 feat: add helpful hints for form fields in tunnel and node management (#279)
Entire-Checkpoint: 20cc01a9700d
2026-03-06 08:21:19 +00:00
sagit 1db5452be9 fix: add forward port occupancy validation and runtime residual cleanup (#278)
* fix: tolerate service not found during forward deletion

- Refactor deleteForwardServicesOnNode to handle not-found errors gracefully
- Extract deleteForwardServiceCandidates helper for reuse
- Add tests for not-found tolerance scenarios
- Ensures compatibility with legacy node versions

Entire-Checkpoint: a3bacf836c57

* fix: add forward port occupancy validation and runtime residual cleanup

- Add forward port occupancy validation on create/update paths
- Extend self-occupy recovery to clean residual candidate service names
- Add regression tests for address-in-use recovery with legacy runtime residue

Fixes port conflict issues when upgrading from 2.1.6 to later versions

Entire-Checkpoint: fb0a2aee4cb5
2026-03-06 10:57:07 +08:00
sagit c10f894afd fix: tolerate service not found during forward deletion (#277)
- Refactor deleteForwardServicesOnNode to handle not-found errors gracefully
- Extract deleteForwardServiceCandidates helper for reuse
- Add tests for not-found tolerance scenarios
- Ensures compatibility with legacy node versions

Entire-Checkpoint: a3bacf836c57
2026-03-06 09:03:28 +08:00
sagit 7fb75baa73 feat: allow user custom inport with range validation (#274)
## Summary
- Allow users to specify custom inlet ports within a defined range
- Add port range validation for tunnel configurations
- Implement UI controls for custom port selection
- Add contract tests for custom port functionality
2026-03-05 17:04:58 +08:00
sagitchu 15e6cd69eb feat: allow user custom inport with range validation
Entire-Checkpoint: fcd76aac10e9
2026-03-05 17:03:19 +08:00
sagit f6eb88d75e refactor: 统一术语,将'转发'改为'规则' (#273)
- 更新所有页面中的'转发'术语为'规则'
- 统一UI文案,提升用户体验一致性
- 关联 #269 #271

Entire-Checkpoint: 5646e42aa33b
2026-03-05 15:07:42 +08:00
sagit f45b580984 fix: prevent effect execution when forwards list is empty (#272)
## Summary
- 添加空列表检查,防止在forwards为空时执行effect
- 避免不必要的groupOrder状态更新和持久化操作
2026-03-05 14:09:19 +08:00
sagitchu 4f50c47550 fix: prevent effect execution when forwards list is empty
Entire-Checkpoint: 69eeade13bf9
2026-03-05 14:07:25 +08:00
sagit 2e1d75dc36 fix: add self-healing for forward service name migration (#270)
## Summary
- Fix `service not found` errors when upgrading from older versions
where service names migrated from placeholder IDs (`forward_user_0`) to
real `user_tunnel_id`
- Add fallback cleanup+rebuild logic on `UpdateService` when service not
found during upgrade transition
- Add self-healing retry on `Pause/Resume` operations when all service
variants are missing
- Refactor `controlForwardServicesOnNode` to support unit testing
- Add tests for the new helper functions

## Test plan
- [x] Unit tests pass: `cd go-backend && go test
./internal/http/handler/...`

## Upgrade path
1. Deploy this backend patch first (no need to wait for all agents)
2. Gradually upgrade agents in batches (10-20%)
3. Run "forward batch redeploy" after each batch to unify service naming
4. Monitor logs for `service .* not found` errors
2026-03-05 12:42:04 +08:00
sagitchu f496f58a4d fix: add self-healing for forward service name migration
When upgrading from older versions, service names changed from
placeholder IDs (forward_user_0) to real user_tunnel IDs, causing
service not found errors during control operations.

- Add fallback cleanup+rebuild logic on UpdateService when service
  not found during the upgrade transition period.
- Add self-healing retry on Pause/Resume when all variants are missing.
- Refactor controlForwardServicesOnNode to support unit testing.
- Add tests for shouldSelfHealForwardServiceControl and
  controlForwardServiceCommand helper functions.

Entire-Checkpoint: a7f0c3175d06
2026-03-05 12:40:20 +08:00
sagit 32474bec20 fix: resolve user tunnel early to use real ID in service name (#265)
## Summary
- Fix service name generation to use the actual user_tunnel ID instead
of 0
- Move user tunnel resolution before building service base name
- Add `buildForwardServiceBaseWithResolvedUserTunnel` helper function

## Details
Previously, the service base name was built with `userTunnelID=0` before
the actual user tunnel was resolved. This caused the runtime service
name to not carry the real user_tunnel ID.

The fix resolves the user tunnel early and passes the resolved ID to the
service name builder, ensuring proper service identification.
2026-03-04 19:35:47 +08:00
sagitchu 581cda7edc fix: resolve user tunnel early to use real ID in service name
- Move user tunnel resolution before building service base name
- Add buildForwardServiceBaseWithResolvedUserTunnel helper
- Ensure service names carry the actual user_tunnel ID instead of 0

Entire-Checkpoint: 9559e6447fda
2026-03-04 19:34:16 +08:00
sagit 96aebb8d61 fix: handle drag-and-drop order correctly in compact mode (#264) 2026-03-04 16:49:03 +08:00
sagit 735fd40786 fix: correct SortableContext nesting for table drag-and-drop (#263)
## Summary
- Fixed incorrect nesting of SortableContext component in forward table
- Moved SortableContext wrapper to properly wrap the entire Table
component instead of wrapping individual rows
- This ensures drag-and-drop functionality works correctly with the
table structure
2026-03-04 16:01:38 +08:00
sagitchu a3b0bf4898 fix: correct SortableContext nesting for table drag-and-drop
Entire-Checkpoint: 356ceb26d6bc
2026-03-04 16:00:07 +08:00
sagit 9703e4a081 feat: restrict user permissions and multi-node IP constraints (#262)
* feat: restrict user permissions and multi-node IP constraints

- Non-admin users cannot set speedId or inPort on forward create/update
- Multi-entrance tunnels disable custom listen IP for forwards
- Multi-exit tunnels disable custom connect IP
- Multi-node hop chains disable custom connect IP per hop
- Remove tunnel-first-IP fallback in forward ingress resolution
- Add contract tests for non-admin permission restrictions

Entire-Checkpoint: 133693290660

* fix: allow non-admin users to submit null speedId and zero inPort

- Backend: Check speedId is not nil before rejecting non-admin requests
- Backend: Only reject inPort if value > 0 for non-admin users
- Frontend: Only include speedId and inPort in payload for admin users
- Tests: Add contract tests for null speedId and zero inPort cases

* refactor: simplify forward mutation payload construction
2026-03-04 15:05:05 +08:00
sagit a43653f252 fix: permission checks for speedId and inPort + multi-node IP constraints (#261)
* feat: restrict user permissions and multi-node IP constraints

- Non-admin users cannot set speedId or inPort on forward create/update
- Multi-entrance tunnels disable custom listen IP for forwards
- Multi-exit tunnels disable custom connect IP
- Multi-node hop chains disable custom connect IP per hop
- Remove tunnel-first-IP fallback in forward ingress resolution
- Add contract tests for non-admin permission restrictions

Entire-Checkpoint: 133693290660

* fix: allow non-admin users to submit null speedId and zero inPort

- Backend: Check speedId is not nil before rejecting non-admin requests
- Backend: Only reject inPort if value > 0 for non-admin users
- Frontend: Only include speedId and inPort in payload for admin users
- Tests: Add contract tests for null speedId and zero inPort cases
2026-03-04 14:50:36 +08:00
sagit 348900de01 feat: restrict user permissions and multi-node IP constraints (#260)
- Non-admin users cannot set speedId or inPort on forward create/update
- Multi-entrance tunnels disable custom listen IP for forwards
- Multi-exit tunnels disable custom connect IP
- Multi-node hop chains disable custom connect IP per hop
- Remove tunnel-first-IP fallback in forward ingress resolution
- Add contract tests for non-admin permission restrictions

Entire-Checkpoint: 133693290660
2026-03-04 14:04:22 +08:00
sagit b93c259fac fix: preserve speed_limit and auto_clear when saving forwards and user tunnels (#259)
## Summary
- Add `speed_limit` and `auto_clear` fields to forward update mutation
to prevent data loss on save
- Update user tunnel save mutation to preserve these fields when editing
tunnels
- Add contract test to verify forward save preserves `speed_limit`
- Add plan documents (006, 007, 008) tracking the fix

## Changes
- `go-backend/internal/http/handler/mutations.go`: Add missing fields to
forward and user tunnel update logic
- `go-backend/tests/contract/forward_contract_test.go`: Add test case
for speed_limit preservation
- `vite-frontend/src/pages/forward.tsx`: Pass speed_limit and auto_clear
on save
- `vite-frontend/src/pages/user.tsx`: Pass speed_limit and auto_clear on
user tunnel save
2026-03-03 22:11:05 +08:00
sagitchu 2e3d5c9249 fix: preserve speed_limit and auto_clear when saving forwards and user tunnels
- Add speed_limit and auto_clear fields to forward update mutation
- Update user tunnel save to preserve these fields
- Add contract test for forward save preserving speed_limit
- Add plan documents for the fixes
2026-03-03 22:10:33 +08:00
sagit c8c1841058 feat: forward enhancements and auto-fallback for invalid bind IP (#258)
## Summary

This PR introduces comprehensive enhancements to the forward service
management system, including:

- **Auto-fallback for invalid bind IP**: When a forward service is
updated with a bind IP that doesn't exist on the host network
interfaces, the system automatically falls back to the default bind
address (listening on all interfaces) instead of failing. Users receive
warning toasts when fallback occurs.

- **Bind IP preservation**: Forward services now preserve their explicit
bind IP when editing without explicit inIp changes.

- **Port rebind handling**: Fixed forward service rebind when the port
is self-occupied by updating instead of adding.

- **NY format import support**: Added support for importing forwards in
NY format with node-based tunnel matching and auto port assignment.

- **Custom IP selection**: Enabled custom IP selection for nodes,
tunnels, and forwards with proper UI controls.

- **Compact mode**: Added global compact mode for forward list with
alpha8 layout and tunnel-group collapse/ordering.

## Changes

### Backend
- Added `syncForwardServicesWithWarnings` to collect fallback warnings
- Implemented `fallbackForwardPortToDefaultBind` for graceful
degradation
- Added `UpdateForwardPortBindIP` repository method to persist fallback
- Enhanced error detection for 'cannot assign requested address' errors
- Fixed bind IP preservation during forward edits
- Fixed port rebind on self-occupied addresses

### Frontend
- Added warning toast display when bind IP fallback occurs
- Implemented IP selection dropdowns for tunnels and forwards
- Added compact mode toggle in settings
- Enhanced forward list with tunnel-group collapse and drag sorting

### Tests
- Added comprehensive unit tests for error detection functions
- Added migration tests for legacy columns

## Commits Since Last Merge
- feat: auto-fallback to default bind IP when invalid bind address
detected
- fix: handle forward service rebind on self-occupied port
- fix: preserve bind IP when editing forward without explicit inIp
change
- feat: add ny import compatibility with auto port assignment
- refactor: simplify forward import tunnel selection
- feat: add ny format support for forward import with node-based tunnel
matching
- feat: custom IP selection and connectIp diagnosis fixes
- feat: add comprehensive migration test for legacy columns
- feat: add custom IP selection for nodes, tunnels, and forwards
- feat(forward): support tunnel-group collapse and ordering in full mode
- feat(forward): add global compact mode with alpha8 list layout
2026-03-03 21:34:49 +08:00
sagitchu 1c596fae4b feat: auto-fallback to default bind IP when invalid bind address detected
When a forward service is updated with a bind IP that doesn't exist on the
host network interfaces, the system now automatically falls back to the
default bind address (listening on all interfaces) instead of failing.

- Added syncForwardServicesWithWarnings to collect fallback warnings
- Implemented fallbackForwardPortToDefaultBind for graceful degradation
- Added UpdateForwardPortBindIP repository method to persist fallback
- Enhanced error detection for 'cannot assign requested address' errors
- Frontend displays warning toasts when fallback occurs
- Added comprehensive unit tests for new error detection functions
2026-03-03 21:34:12 +08:00
sagit 2ff52e3275 feat: 2.1.7-beta4 release - forward service stability and UI enhancements (#257)
## Summary

This PR consolidates multiple features and fixes for the 2.1.7-beta4
release:

**Forward Service Stability:**
- Handle forward service rebind on self-occupied port conflicts
- Preserve bind IP when editing forward without explicit inIp change

**Import Enhancements:**
- Add ny format support for forward import with node-based tunnel
matching
- Add ny import compatibility with auto port assignment

**Custom IP Selection:**
- Add custom IP selection for nodes, tunnels, and forwards
- Use configured connectIp for tunnel chain diagnosis

**UI Improvements:**
- Add tunnel group collapse and drag sorting in full mode
- Add global compact mode with alpha8 list layout
- Expose forward compact mode switch in settings

**Infrastructure:**
- Add comprehensive migration test for legacy columns

## Commits

- 7efb49b fix: handle forward service rebind on self-occupied port
- 1450b25 fix: preserve bind IP when editing forward without explicit
inIp change
- 7c54192 feat: add ny import compatibility with auto port assignment
- 7ba6877 refactor: simplify forward import tunnel selection
- ef613c1 feat: add ny format support for forward import with node-based
tunnel matching
- 1c10347 fix: use configured connectIp for tunnel chain diagnosis
- e383359 fix: apply custom IP binding to forward and tunnel chain
services
- 9cf9f4f feat: add comprehensive migration test for legacy columns
- b819341 feat: add custom IP selection for nodes, tunnels, and forwards
- 634c6cd feat(forward): add tunnel group collapse and drag sorting in
full mode
- 98a9e5c fix(config): expose forward compact mode switch in settings
- 77e4387 feat(forward): add global compact mode with alpha8 list layout
2026-03-03 20:54:26 +08:00
sagitchu 7efb49bdab fix: handle forward service rebind on self-occupied port
When UpdateService encounters bind address conflicts (port already in use),
the handler now automatically deletes existing forward services and retries
the AddService operation. This resolves issues where a forward's own stale
listener prevents the update.

- Add isBindAddressInUseError() to detect port bind conflicts
- Add rebindForwardServiceOnSelfOccupiedPort() for automatic cleanup and retry
- Add HasOtherForwardOnNodePort() repository method to verify port ownership
- Add unit tests for bind conflict detection
2026-03-03 20:53:55 +08:00
sagit a00b20abf3 feat: forward management enhancements and bind IP preservation (#256)
## Summary
- Fix bind IP preservation when editing forwards without explicit inIp
changes
- Add ny format import support with node-based tunnel matching and auto
port assignment
- Add custom IP selection for nodes, tunnels, and forwards
- Add tunnel group collapse and drag sorting in full mode
- Add global compact mode with alpha8 list layout
- Various bug fixes and improvements

## Test plan
- [x] Unit tests for forward port replacement with preserved InIP
- [x] Manual testing of forward edit flow
- [x] Verified bind IP is preserved when editing forwards without
touching the inIp field
2026-03-03 20:23:29 +08:00
sagitchu 1450b25475 fix: preserve bind IP when editing forward without explicit inIp change
- Add replaceForwardPortsPreservingInIP to maintain existing InIP values
- Track inIpTouched state in frontend to distinguish user changes
- Only send inIp in update request when user explicitly changed it
- Add unit tests for forward port replacement with preserved InIP
2026-03-03 20:22:58 +08:00
sagit b815be54b8 feat: ny import compatibility and forward enhancements (#252)
## Summary
- **ny import compatibility**: 支持可选的 `listen_port` 字段自动分配端口
- **alias field mapping**: 支持字段别名映射 (dest/dst/target, listenPort/port,
name/forward_name)
- **help text update**: 更新帮助文本说明自动端口分配功能
- **parser tests**: 添加解析器测试覆盖别名字段和缺失端口处理
- **tunnel selection refactor**: 简化转发导入隧道选择逻辑
- **custom IP selection**: 为节点、隧道和转发添加自定义IP选择
- **compact mode**: 添加全局紧凑模式和隧道组折叠排序

## Changes
- `vite-frontend/src/pages/forward/import-format.ts`:
ny格式解析器增强,支持字段别名和可选端口
- `vite-frontend/src/pages/forward/import-format.test.ts`: 添加解析器测试
- `vite-frontend/src/pages/forward.tsx`: 更新UI帮助文本
2026-03-03 16:55:31 +08:00
sagitchu 75edeb9afa Merge remote-tracking branch 'origin/main' into opencode/mighty-nebula
# Conflicts:
#	vite-frontend/src/pages/forward.tsx
#	vite-frontend/src/pages/forward/import-format.test.ts
#	vite-frontend/src/pages/forward/import-format.ts
2026-03-03 16:55:14 +08:00
sagitchu 7c54192055 feat: add ny import compatibility with auto port assignment
- Support optional listen_port field for automatic port assignment
- Add alias field mapping (dest/dst/target, listenPort/port, name/forward_name)
- Update help text to document auto port assignment
- Add parser tests for alias fields and missing port handling

Entire-Checkpoint: efae74a1f03c
2026-03-03 16:54:05 +08:00
sagitchu 7ba68778c1 refactor: simplify forward import tunnel selection
- Remove separate entry node selection for ny format
- Unify tunnel selection for both flvx and ny formats
- Remove unused tunnel select modal component
- Simplify import button validation logic
2026-03-03 16:17:36 +08:00
sagit 7b736b2e60 feat: add ny format support for forward import with node-based tunnel matching (#250) 2026-03-03 15:39:07 +08:00
sagitchu ef613c1518 feat: add ny format support for forward import with node-based tunnel matching 2026-03-03 15:38:03 +08:00
sagit b62df6ffa3 feat: custom IP selection and connectIp diagnosis fixes (#248)
## Summary
- Add custom IP selection dropdown for nodes, tunnels, and forwards
(supports IPv4/IPv6 dual-stack)
- Fix connectIp not being used in tunnel chain diagnosis (resolves #211)
- Reconstruct tunnel state with connectIp field preserved
- Fix forward service config when bindIP already contains port
- Add comprehensive migration tests for legacy columns
- Support tunnel-group collapse and ordering in forward full mode
- Add global compact mode for forward list display

## Changes
### Backend
- `control_plane.go`: Pass connectIp through resolveChainProbeTarget in
diagnosis
- `mutations.go`: Include connectIp in tunnel state reconstruction
- `model.go`: Add migration for connect_ip columns
- `repository.go`: Support connect_ip in CRUD operations

### Frontend
- `node.tsx`, `tunnel.tsx`, `forward.tsx`: IP selection dropdowns
- `settings.tsx`: Forward compact mode switch
- `config.tsx`: Expose compact mode setting

### Tests
- Contract tests for connectIp diagnosis scenarios
- Migration tests for legacy column handling
- Unit tests for bindIP with port

## Test Plan
- [x] Contract tests pass (`go test ./tests/contract/...`)
- [x] Unit tests pass (`go test ./...`)
- [x] Manual testing: tunnel diagnosis uses configured connectIp
- [x] Manual testing: IP selection dropdowns work correctly
2026-03-03 14:19:35 +08:00
sagitchu be9d8773ce merge: resolve conflicts with main branch 2026-03-03 14:19:18 +08:00
sagitchu 1c10347357 fix: use configured connectIp for tunnel chain diagnosis
- Pass connectIp through resolveChainProbeTarget in diagnosis stream start items
- Pass connectIp in appendChainHopDiagnosis for full chain probes
- Reconstruct tunnel state with connectIp field preserved
- Fix forward service config when bindIP already contains port
- Add contract tests for connectIp diagnosis scenarios
- Add unit test for bindIP with port in buildForwardServiceConfigs
- Update AGENTS.md with plan document rules

Entire-Checkpoint: 35a2e61c2431
2026-03-03 14:17:36 +08:00
sagit 5bd21e2ac1 feat: custom IP selection and forward list enhancements (#247)
* feat: add comprehensive migration test for legacy columns

- Add ExtraIPs, TCPListenAddr, UDPListenAddr to Node migration
- Add ip_preference to Tunnel migration
- Add test for very legacy database migration (1.x schema)
- Include issue #211 tracking document

Entire-Checkpoint: 0d086883c34a

* fix: apply custom IP binding to forward and tunnel chain services

Entire-Checkpoint: ceff329d4cf4
2026-03-03 10:59:00 +08:00
sagitchu e38335973d fix: apply custom IP binding to forward and tunnel chain services
Entire-Checkpoint: ceff329d4cf4
2026-03-03 10:58:15 +08:00
sagit 95929bf82e feat: add comprehensive migration test for legacy columns (#245)
- Add ExtraIPs, TCPListenAddr, UDPListenAddr to Node migration
- Add ip_preference to Tunnel migration
- Add test for very legacy database migration (1.x schema)
- Include issue #211 tracking document

Entire-Checkpoint: 0d086883c34a
2026-03-03 10:28:10 +08:00
sagitchu 9cf9f4f1f7 feat: add comprehensive migration test for legacy columns
- Add ExtraIPs, TCPListenAddr, UDPListenAddr to Node migration
- Add ip_preference to Tunnel migration
- Add test for very legacy database migration (1.x schema)
- Include issue #211 tracking document

Entire-Checkpoint: 0d086883c34a
2026-03-03 10:27:29 +08:00
sagit ae8dbdd77f feat: add custom IP selection for nodes, tunnels, and forwards (#244)
## Summary

- Add `extra_ips` field to nodes for multi-IP servers (comma-separated)
- Add `connect_ip` field to `chain_tunnel` for specifying which IP to
connect to on multi-IP nodes
- Add `in_ip` field to `forward_port` for specifying which IP to listen
on
- Frontend: add UI controls for extra IPs on node form
- Frontend: add connect IP input for tunnel chain nodes (both relay hops
and exit nodes)
- Frontend: add listen IP input for forward creation/editing
- Backend: resolve forward ingress with custom listen IP priority
(per-port IP > tunnel IP > node IP)

This enables fine-grained control over IP selection on multi-homed
servers.
2026-03-03 09:47:17 +08:00
sagitchu 05bd6a686d feat: add IP selection dropdown for tunnels and forwards
Entire-Checkpoint: fde43d8c94e5
2026-03-03 09:16:05 +08:00
sagitchu b8193417f5 feat: add custom IP selection for nodes, tunnels, and forwards
- Add extra_ips field to nodes for multi-IP servers
- Add connect_ip field to chain_tunnel for specifying connection address
- Add in_ip field to forward_port for specifying listen address
- Frontend: add UI controls for extra IPs on node form
- Frontend: add connect IP input for tunnel chain nodes
- Frontend: add listen IP input for forward form
- Backend: resolve forward ingress with custom listen IP priority

Entire-Checkpoint: 557563462c16
2026-03-03 08:24:15 +08:00
sagit 15e4508be4 feat(forward): support tunnel-group collapse and ordering in full mode (#243)
## Summary
- add collapsible tunnel groups in the forward page when compact mode is
disabled
- add drag-and-drop ordering for tunnel groups within each user section
in full mode
- persist group order/collapse by current login user (admins: local +
global config, normal users: local only)

## Testing
- npm run build (vite-frontend)
2026-03-02 22:25:31 +08:00
sagitchu 634c6cd620 feat(forward): add tunnel group collapse and drag sorting in full mode 2026-03-02 22:24:39 +08:00
sagit 4eaecb289b fix(config): expose forward compact mode switch in settings (#241)
## Summary
- Add `forward_compact_mode` to the `/config` settings item list so the
compact-mode switch is visible in the main settings page.
- Include `forward_compact_mode` in initial config cache keys to keep
switch state consistent on load.

## Verification
- `npm run build` (vite-frontend)
2026-03-02 21:37:10 +08:00
sagitchu 98a9e5c666 fix(config): expose forward compact mode switch in settings 2026-03-02 21:36:33 +08:00
sagit d244920dd4 feat(forward): add global compact mode with alpha8 list layout (#240)
## Summary
- Add a global forward compact mode toggle in settings, persisted via
`config` key `forward_compact_mode`.
- Make forward page read and react to this global setting in real time
through a browser event.
- In compact mode, render forward list using the 2.1.6-alpha8 style
(single grouped table / global direct card grid) while keeping non-list
interactions unchanged.

## Verification
- Installed frontend dependencies with `npm install`.
- Built frontend successfully with `npm run build`.
2026-03-02 21:11:39 +08:00
sagitchu 77e4387b35 feat(forward): add global compact mode with alpha8 list layout 2026-03-02 21:10:56 +08:00
sagit 7a40ddb1ef fix(diagnosis): tighten timeout handling and clarify timeout messaging (#233)
## Summary
- shorten per-item diagnosis command timeout from 2 minutes to 30
seconds while keeping overall request timeout at 2 minutes
- centralize timeout messages in backend constants and apply consistent
timeout fallback handling in diagnosis result assembly
- update frontend forward/tunnel diagnosis timeout copy to clearly
explain single-item and overall timeout limits

## Notes
- includes workspace tool config files under `.claude/` and `.entire/`
as part of this commit
2026-03-01 18:39:19 +08:00
sagitchu d33814e18c fix(diagnosis): tighten timeout handling and clarify timeout messaging 2026-03-01 18:37:53 +08:00
sagit cf51b305b0 fix(diagnosis): prevent progress stream blocking and refine tunnel type chips (#230)
* fix(diagnosis): avoid result channel deadlock in progress stream

Close the diagnosis result channel asynchronously after workers complete so progress can stream without blocking, and improve tunnel card type chip contrast for clearer protocol distinction.

* feat(diagnosis): stream pending items and render in-progress states

Pre-populate diagnosis stream with pending targets so tunnel and forward dialogs can show per-item diagnosing status immediately. Update result typing and UI states to distinguish in-progress, success, and failure rows/cards consistently.
2026-03-01 14:49:38 +08:00
sagit 9ffeb83753 fix(forward): align table columns and fix card layout (#228) 2026-03-01 11:14:12 +08:00
sagit 2f40cf29d4 feat(frontend): group forwards by user with admin priority sorting (#227)
## Summary
- Add user grouping for forwards in both grouped table and card views
- Sort user groups with admin's own group first, then alphabetically by
name
- Restrict drag-and-drop reordering to same user group only to prevent
cross-user data mixing
- Remove redundant user column from grouped table view (user shown in
group header)
- Add user group headers with forward count badges and "管理员本人" chip for
admin's own group
2026-02-28 20:11:18 +08:00
sagitchu a92eb168aa feat(diagnosis): add streaming progress support and tunnel-grouped forward list
- Add SSE streaming endpoints for tunnel/forward diagnosis with real-time progress
- Increase diagnosis timeout to 2 minutes with context propagation
- Group forwards by tunnel within user groups in UI
- Add nginx SSE proxy configuration for streaming endpoints
2026-02-28 20:09:25 +08:00
sagitchu de21a55f37 fix(diagnosis): parallelize runtime checks and raise API timeouts 2026-02-28 18:46:36 +08:00
sagitchu b01dbdb6e5 feat(frontend): group forwards by user with admin priority sorting
- Add ForwardUserGroup interface and helper utilities
- Group forwards by user in both grouped table and card views
- Sort user groups with admin's own group first, then alphabetically
- Restrict drag-and-drop to same user group only
- Remove redundant user column from grouped table view
- Add user group headers with forward count badges
2026-02-28 17:20:10 +08:00
sagit a645cc699b docs: add AI Skill and PostgreSQL nav items (#226) 2026-02-28 06:27:36 +00:00
sagit 528f912aac docs: add AI Skill integration guide (#225)
## Summary
- Add AI Skill documentation for LLM integration with FLVX panel
- Include complete API reference documentation for the skill
- Add publish workflow for skill distribution

## Changes
- New `doc/ai-skill.md` guide
- New `skills/flvx-api/` directory with API references
- New `.github/workflows/publish-skill.yml` workflow
- Update `doc/index.md` navigation
2026-02-28 14:13:34 +08:00
sagit 8bf30a157f Merge branch 'main' into opencode/proud-rocket 2026-02-28 14:12:35 +08:00
sagitchu 58abba7fc0 docs: add AI Skill integration guide 2026-02-28 14:07:54 +08:00
sagit d8cd4b404c refactor(tests): consolidate contract test helpers and add Playwright e2e tests (#224)
## Summary
- Add Playwright e2e test suite for frontend and API
- Consolidate contract test helpers, removing redundant internal test
file
- Simplify test setup across multiple contract test files
2026-02-28 12:15:51 +08:00
sagitchu 9e979aa82a refactor(tests): consolidate contract test helpers 2026-02-28 12:13:28 +08:00
sagit 5caaaf6092 test: add Playwright e2e test suite (#223)
## Summary
- Add comprehensive Playwright e2e test suite for frontend and API
testing
- Include test fixtures, page objects, and API client utilities
- Add tests for auth flow, dashboard, user UI, and API endpoints
2026-02-28 10:35:55 +08:00
sagitchu f23d1c2afd test: add Playwright e2e test suite for frontend and API 2026-02-28 10:33:32 +08:00
sagit 5e00cbf131 feat: speed limit UX improvements and brand customization (#222)
## Summary
- 简化限速选择器 UX,移除冗余的"不限速"选项项
- 默认转发限速规则为不限速
- 移除限速规则与隧道的绑定关系并添加迁移清理
- 改进 favicon 加载逻辑,添加 fallback 到 config API
- 添加品牌资源上传功能(PNG 转换)并改进配置验证
- 改进验证码验证和转发服务同步
- 添加自定义 favicon 和角落 logo 及实时预览
- 统一限速规则选择器的 placeholder 显示
2026-02-27 19:55:30 +08:00
sagitchu 975948dcf6 fix(frontend): simplify speed limit selector UX 2026-02-27 19:53:19 +08:00
sagitchu a9eac6d01f fix(frontend): default forward speed rule to no limit
Make forward create/edit treat empty speed-limit selection as no limit so the dropdown no longer shows the generic placeholder, and remove announcement console logging to keep frontend lint clean.
2026-02-27 19:37:59 +08:00
sagitchu 6e8406f439 feat: remove speed limit tunnel binding and add migration cleanup
- Remove tunnel binding UI from speed limit page (no more Select component)
- Remove /api/v1/speed-limit/tunnels route alias
- Simplify CreateSpeedLimit/UpdateSpeedLimit to not accept tunnel parameters
- Add schema migration v4 to clear historical tunnel_id/tunnel_name bindings
- Update contract tests to verify tunnel binding is ignored
- Add limiter sync failure tests for forward-level rate limiting
2026-02-27 19:30:02 +08:00
sagit db3577afa9 feat(frontend): improve favicon loading with fallback to config API (#221)
## Summary
- Add synchronous config API call in index.html when localStorage cache
is empty
- Prevents favicon flash on login page during first load
- Enhance getCachedConfigs() to fetch public configs as fallback
- Preserve existing siteConfig values when config keys are missing
2026-02-27 18:25:16 +08:00
sagitchu 7285717e34 feat(frontend): improve favicon loading with fallback to config API
- Add synchronous config API call in index.html when localStorage cache is empty
- Prevents favicon flash on login page during first load
- Enhance getCachedConfigs() to fetch public configs as fallback
- Preserve existing siteConfig values when config keys are missing
2026-02-27 18:23:18 +08:00
sagit de6911f219 feat: add brand asset upload with PNG conversion and improve config validation (#220)
## Summary
- Add file upload support for logo and favicon with automatic PNG
conversion (96x96 for logo, 64x64 for favicon)
- Add backend validation for brand asset data URLs (app_logo,
app_favicon)
- Change vite_config.value column type from varchar(200) to text for
PostgreSQL compatibility
- Add schema migration v3 for vite_config.value column type conversion
- Update frontend to use file picker instead of manual URL input
- Add early favicon application in index.html to prevent flash

## Changes
- Backend: Validate brand asset data URLs, support larger config values
- Frontend: File upload with PNG conversion, improved caching
- Migration: PostgreSQL vite_config.value column type migration

## Testing
- Backend contract tests added for migration v3
2026-02-27 15:56:14 +08:00
sagitchu e5ce0501a2 feat: add brand asset upload with PNG conversion and improve config validation
- Add file upload support for logo and favicon with automatic PNG conversion
- Add backend validation for brand asset data URLs (app_logo, app_favicon)
- Change vite_config.value column type from varchar(200) to text for PostgreSQL
- Add schema migration v3 for vite_config.value column type conversion
- Update frontend to use file picker instead of manual URL input
- Add early favicon application in index.html to prevent flash
2026-02-27 15:54:04 +08:00
sagit 25a87e25c5 fix(backend): improve captcha validation and forward service sync (#219)
## Summary
- Add cloudflare site/secret key validation for captcha enabled check to
prevent incomplete captcha config
- Fix forward create to use UpdateService with tolerateExists for
idempotent service sync
- Introduce isAlreadyExistsMessage helper that correctly excludes
"address already in use" errors from being tolerated
- Add contract tests for forward toggle (pause/resume), address-in-use
rollback, and captcha compatibility

## Test Plan
- Contract tests added: `TestForwardCreateThenPauseResumeContract`,
`TestForwardCreateRollbackWhenServiceDispatchReturnsAddressInUseContract`,
`TestIsAlreadyExistsMessage`
- Captcha login flow tests updated for cloudflare key validation
2026-02-27 14:52:14 +08:00
sagitchu a628f31859 fix(backend): improve captcha validation and forward service sync
- Add cloudflare site/secret key validation for captcha enabled check
- Fix forward create to use UpdateService with tolerateExists for idempotent sync
- Introduce isAlreadyExistsMessage helper excluding address-in-use errors
- Add contract tests for forward toggle, address-in-use rollback, captcha compatibility
2026-02-27 14:49:59 +08:00
sagitchu aae138a8cf fix(forward): remove placeholder from speed limit select, default to no limit 2026-02-27 14:49:59 +08:00
sagit d2645589da feat(frontend): add customizable favicon and corner logo with live preview (#218)
* feat(frontend): add customizable favicon and corner logo with live preview

- Add app_logo and app_favicon config fields in config page
- Implement BrandLogo component with URL fallback to SVG logo
- Integrate BrandLogo into all layouts (admin, h5, h5-simple) and navbar
- Add real-time preview for favicon and logo in config page with error state
- Support both relative paths and full image URLs for branding assets
- Sync branding changes (app_name/app_logo/app_favicon) to site config on save

* fix(frontend): preserve tunnel node selection order

* fix(select): use useMemo for option label map to improve performance
2026-02-27 11:50:03 +08:00
sagit 6684a3426b fix(frontend): use placeholder for IP preference select (#217)
## Summary
- Replace empty key SelectItem with proper placeholder for IP preference
dropdown
- Improves UX consistency with other select components
2026-02-27 08:39:26 +08:00
sagitchu 7a8595ec87 fix(frontend): use placeholder for IP preference select instead of empty key item 2026-02-27 08:33:10 +08:00
sagitchu 06f76d918f fix(frontend): unify speed rule placeholders in selects 2026-02-27 08:33:10 +08:00
sagit feb357ff17 fix: tunnel chain order and speed limit UI improvements (#216)
* fix(backend): use correct chain order index for tunnel nodes

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

* fix(frontend): filter '不限速' from speed limit dropdowns and preserve node order

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

---------

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-26 21:30:25 +08:00
sagit 34581e0d18 feat: decouple speed limits from tunnels and add forward-level rate limiting (#214)
## Summary

This PR refactors the speed limiting functionality to decouple it from
tunnel-specific binding and adds support for forward-level rate
limiting.

### Key Changes

**Backend (Go)**:
- `SpeedLimit.TunnelID` and `SpeedLimit.TunnelName` are now nullable,
allowing speed limits to be created without binding to a specific tunnel
- `Forward` model now has `SpeedID sql.NullInt64` field for
forward-level rate limiting
- `ForwardRecord` updated to include `SpeedID` for control plane use
- Repository methods updated to handle optional tunnel binding in CRUD
operations
- Control plane now prioritizes `Forward.SpeedID` over
`UserTunnel.SpeedID`

**Frontend (React/TypeScript)**:
- Updated `limit.tsx` to support creating speed limits without tunnel
binding
- Tunnel selection is now optional in the speed limit form
- Updated TypeScript types for optional `tunnelId` and new `speedId`
fields

### Behavior

**Speed Limit Application Priority**:
1. `Forward.SpeedID` - Forward-level rate limiting (highest priority)
2. `UserTunnel.SpeedID` - User tunnel permission-level rate limiting
(fallback)

### Migration Notes

Database schema changes will be handled automatically by GORM
AutoMigrate:
- `speed_limit.tunnel_id` and `speed_limit.tunnel_name` become nullable
- `forward.speed_id` column added (nullable)

### Docker Images

Built and pushed:
- `ghcr.io/sagit-chu/vite-frontend:beta`
- `ghcr.io/sagit-chu/vite-frontend:latest`
- `ghcr.io/sagit-chu/flux-panel-backend:beta`
- `ghcr.io/sagit-chu/flux-panel-backend:latest`

closes #201 #155
2026-02-26 20:20:11 +08:00
sagitchu 61c5b5e759 feat: add speed limit contract tests and refine limit/user UI 2026-02-26 20:18:29 +08:00
sagitchu c8eb780c67 feat: decouple speed limits from tunnels and add forward-level rate limiting
- Make SpeedLimit.TunnelID and TunnelName nullable (optional binding)
- Add SpeedID field to Forward model for forward-level rate limiting
- Update ForwardRecord to include SpeedID for control plane
- Update repository methods to handle optional tunnel binding
- Update handlers to accept optional tunnelId in create/update
- Modify control plane to prioritize Forward.SpeedID over UserTunnel speed limit
- Update frontend limit.tsx to support creating speed limits without tunnel binding
- Update TypeScript types for optional tunnelId and new speedId fields

This allows speed limits to be created as reusable rules that can be applied
to either tunnels (via UserTunnel.SpeedID) or individual forwards (via Forward.SpeedID).
2026-02-26 13:08:35 +08:00
sagit 4bdfa50b0c docs: update AGENTS.md files with current project state (#213)
- Update root AGENTS.md to commit 21008cc / tag 2.1.5-rc15
- Add CI workflows info (ci-build.yml, docker-build.yml, deploy-docs.yml)
- Add Repository Layer and Contract Tests to WHERE TO LOOK
- Add websocket_reporter to CODE MAP
- Add Go version conventions (1.24/1.23/1.22)
- Add PostgreSQL migration support note
- Update go-backend AGENTS.md with PostgreSQL support and contract tests
- Update go-gost AGENTS.md with CI build conventions
- Update vite-frontend AGENTS.md with component counts
- Update go-gost/x AGENTS.md with file counts and registry reference
- Update handler AGENTS.md with LOC estimates
2026-02-26 09:52:11 +08:00
sagit 21008ccb43 fix: resolve federation forward card showing zero flow (#212)
## Summary

Fixed federation port-forward tunnels not displaying traffic on forward
cards.

**Root Cause:**
- Frontend's mergeFederationShareFlow only parsed shareId from tunnel
name (Share-{id}-Port-{port} format)
- Federation tunnels with custom names couldn't be resolved, causing
traffic display to show 0

**Fix:**
- Added fallback to resolve shareId via remote-usage bindings[].tunnelId
- Multiple resolution candidates are merged with max(currentFlow)
selection
- Maintains directFlow precedence over federation share flow

**Tests:**
- Added contract test for custom tunnel name with binding-based
resolution
- All existing tests pass
- Frontend builds successfully

Fixes: federation port-forward showing total flow 0
2026-02-25 21:24:50 +08:00
sagitchu 362d327bf9 fix: resolve federation forward card showing zero flow
- Fixed mergeFederationShareFlow to resolve shareId via tunnel binding
  when tunnel name is not in Share-{id}-Port-{port} format
- Added fallback to parse shareId from remote-usage bindings[].tunnelId
- Added contract test for custom tunnel name with binding-based resolution
- All tests pass, frontend builds successfully

Fixes federation port-forward tunnels with custom names not displaying
traffic on forward cards.
2026-02-25 21:21:46 +08:00
sagit 9a650fcc8f release: 2.1.5-rc14 - Federation forward flow linkage enhancement (#210)
## Summary
- Enhanced federation forward flow stats with local peer share support
- Merged local and remote flow usage tracking
- Added contract test for federation forward card flow linkage

## Changes
- `vite-frontend/src/pages/forward.tsx`: Integrated `getPeerShareList`
API
- `go-backend/tests/contract/`: Added federation forward flow linkage
contract test

## Testing
- Contract test added and verified
2026-02-25 20:36:54 +08:00
sagitchu 804a5a29ea feat: enhance federation forward flow linkage with peer share support
- Add getPeerShareList API integration in forward.tsx
- Merge local peer share flow with remote usage stats
- Add contract test for federation forward card flow linkage
- Ensure max current flow is tracked across both local and remote sources
2026-02-25 20:35:33 +08:00
sagit 6189fe23f1 feat: include forward ports in federation remote usage and display share flow (#209)
* feat(backend): include forward ports in federation remote usage list

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

* feat(frontend): display federation share flow in forward list

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

---------

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-25 16:59:39 +08:00
sagit 7ba90e8696 fix(backend): resolve federation forward traffic stats and listener disappearance (#208)
* fix(backend): add repository methods for federation forward runtime management

- GetActiveForwardPeerShareRuntimeByServiceName: lookup runtime by share_id and service_name
- MarkForwardPeerShareRuntimeReleasedByServiceName: release runtime by service_name
- ListActiveForwardPeerShareRuntimesByNodeAndServiceName: node-scoped query for flow processing

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

* fix(backend): bind and release federation forward runtimes on service commands

- bindPeerShareForwardRuntimeServices: create runtime if missing, update ServiceName/Port/Applied/Status
- releasePeerShareForwardRuntimeServices: handle deleteservice command to mark runtime released
- parseFederationForwardServiceNamesForRelease: extract service names from delete payload
- Tests: bind creates runtime when missing, release marks runtime as released

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

* fix(backend): scope federation flow lookup by node to avoid cross-share collisions

- flowUpload: use GetNodeBySecret to extract nodeID for flow processing
- processFlowItem: accept nodeID parameter and pass to flow handlers
- processPeerShareFlowByServiceName: try node-scoped query first, fallback to global
- Add warning log when multiple runtimes match (ambiguous)
- Tests: update all processFlowItem calls with nodeID parameter

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

* test(contract): adjust federation dual panel contract expectations

Update assertion for entry share runtime binding behavior after fix

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

---------

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-25 14:10:24 +08:00
sagit 0eed74fe10 fix: stabilize federation forward runtime cleanup and frontend version UX (#207)
## Summary
- fix federation forward runtime cleanup so valid forward listeners are
not treated as orphan during unbound binding windows
- add backend regression coverage for federation forward/runtime cleanup
and expiry handling paths
- wire frontend version update footer/flows and related UI updates
across admin pages

## Verification
- go test ./...
- make build
2026-02-25 11:22:12 +08:00
sagitchu 466cc65069 fix: stabilize federation forward runtime cleanup and wire frontend version update UX 2026-02-25 11:20:51 +08:00
sagit 9c41410f17 fix(backend): handle federation service arrays in runtime command (#206)
## Summary
- accept both top-level service arrays and wrapped `services` payloads
in federation runtime command parsing
- fix forward runtime service binding and port-range validation for
remote shared-node AddService/UpdateService calls
- add regression tests for top-level array payload handling to prevent
listener cleanup/flow mapping regressions

## Verification
- go test ./internal/http/handler -run
"TestBindPeerShareForwardRuntimeServicesAcceptsTopLevelServiceArray|TestValidateFederationCommandPortsAcceptsTopLevelServiceArray|TestBindPeerShareForwardRuntimeServicesOnlyBindsForwardRole|TestCleanOrphanedServicesSkipsActiveSharedForwardRuntimeServices|TestProcessFlowItemTracksPeerShareFlowByForwardServiceName"
- go test ./...
- make build
2026-02-25 00:08:32 +08:00
sagitchu bc71c524e0 fix(backend): accept top-level federation service payloads 2026-02-25 00:06:31 +08:00
sagit f46b2b4d86 fix(backend): keep shared federation port-forward listeners alive (#205)
## Summary
- prevent shared federation forward services from being misclassified as
orphaned during node config cleanup
- harden peer-share runtime mapping for service-name based flow
accounting and node/port conflict checks
- add regression tests for listener persistence, cleanup guards, runtime
binding, and federation port-forward lifecycle

## Verification
- go test ./internal/http/handler -run
\"TestCleanOrphanedServicesSkipsActiveSharedForwardRuntimeServices|TestCleanOrphanedServicesSkipsFederationServicePrefix|TestProcessFlowItemTracksPeerShareFlowByForwardServiceName|TestProcessFlowItemSkipsPeerShareFlowWhenServiceNameIsAmbiguous|TestFederationTunnelCreateRejectsOccupiedPort\"
- go test ./...
- make build
2026-02-24 23:08:02 +08:00
sagitchu 9f17d63cdc fix(backend): keep shared federation port-forward services stable 2026-02-24 23:06:09 +08:00
sagit 92f8ec47db fix(backend): track traffic stats for federation port-forward tunnels (#204)
## Summary

- Fixed traffic statistics not being tracked for federation port-forward
tunnels (tunnelType=1) in Panel Peering mode
- Added `parsePeerShareIDFromFederationTunnelName()` to extract shareID
from tunnel names matching `Share-{shareId}-Port-{port}` pattern
- Added `processPeerShareFlowFromForward()` to update
`peer_share.current_flow` when forward traffic belongs to a federation
port-forward tunnel
- Added regression test
`TestProcessFlowItemTracksPeerShareFlowForFederationPortForward`

## Root Cause

Federation + tunnel type=2 (隧道转发) traffic uses service names
`fed_svc_{runtimeID}` → correctly routed to `processPeerShareFlow()` →
`peer_share.current_flow` updated.

Federation + tunnel type=1 (端口转发) traffic uses regular forward service
names `{forwardId}_{userId}_{userTunnelId}` → only `AddFlow()` called →
`peer_share.current_flow` NOT updated → shared flow stats remain 0.

## Test Plan

- [x] `go test ./internal/http/handler -run
'TestProcessFlowItemTracksPeerShareFlow'` passes
- [x] `go test ./internal/http/handler` passes
- [x] `go test ./...` passes
- [x] `make build` succeeds
2026-02-24 20:41:18 +08:00
sagitchu a97484cd9b fix(backend): track traffic stats for federation port-forward tunnels
Federation mode panel peering with port-forward tunnel type (tunnelType=1)
was not updating peer_share.current_flow because regular forward traffic
uses different service name pattern than federation tunnel traffic.

Added parsePeerShareIDFromFederationTunnelName() to extract shareID from
tunnel names matching 'Share-{shareId}-Port-{port}' pattern, and
processPeerShareFlowFromForward() to update peer_share flow stats when
the forward belongs to a federation port-forward tunnel.
2026-02-24 20:25:04 +08:00
sagit ee6bc8c50e fix(frontend): keep mobile batch toolbar right-aligned (#203)
## Summary
- keep mobile batch action bars visually right-aligned while preserving
Android horizontal swipe behavior
- move overflow handling to an outer scroller and keep action layout in
an inner `min-w-full` flex row
- apply the same structure across forward, node, and tunnel pages for
consistent behavior

## Verification
- `npm run build` *(fails due to pre-existing issue: `src/main.tsx`
cannot find module `virtual:pwa-register`)*
- `npm run lint -- src/pages/forward.tsx src/pages/node.tsx
src/pages/tunnel.tsx` *(fails due to pre-existing a11y labels in
`forward.tsx` lines 3202/3223)*
2026-02-23 22:55:49 +08:00
sagitchu c94ab84ab9 fix(frontend): keep mobile batch toolbar right-aligned
Use an overflow wrapper with an inner min-w-full flex row so controls stay visually right-aligned when space is sufficient, while Android can still horizontally swipe when the toolbar overflows.
2026-02-23 22:53:48 +08:00
sagit 84a03215f4 fix(frontend): restore Android swipe for mobile batch toolbar (#202)
## Summary
- fix mobile batch action toolbar in forward/node/tunnel pages to keep
horizontal overflow reachable on Android
- switch toolbar alignment to start on mobile and keep right alignment
on `sm+` to avoid `justify-end` overflow reachability issues
- add `touch-pan-x` to improve horizontal swipe handling on mobile
browsers while preserving existing desktop layout

## Verification
- `npm run build` *(fails due to pre-existing issue: `src/main.tsx`
cannot find module `virtual:pwa-register`)*
- `npm run lint` *(fails due to pre-existing a11y errors in unrelated
files and in existing forward labels)*
2026-02-23 22:26:11 +08:00
sagitchu def93749eb fix(frontend): restore Android swipe for mobile batch toolbar
Switch mobile batch toolbar alignment to start and enable horizontal pan gestures so overflow actions remain reachable on Android while desktop right alignment stays unchanged.
2026-02-23 22:24:28 +08:00
sagit 945a1c0dfc fix(frontend): remove border from batch toggle button (#199) 2026-02-23 22:03:29 +08:00
sagit d752e096a3 fix(frontend): move batch operations into top toolbar (#198)
## Summary
- switch batch mode interactions to the top-right action bar on forward,
tunnel, and node pages
- remove bottom floating batch toolbars and restore normal action
toolbar when exiting batch mode
- stabilize toolbar layout and improve batch button visibility to avoid
visual jitter on toggle
2026-02-23 21:30:57 +08:00
sagitchu 880a3b81b0 fix(frontend): move batch actions into top toolbar
Switching batch controls to the top-right action bar with stable single-row layout improves clarity and prevents visual jumps while entering batch mode.
2026-02-23 21:28:50 +08:00
sagit 191aface2e fix(frontend): extend h5 tabbar safe-area coverage (#197)
Ensure the PWA bottom tab bar and tab hit areas fully cover the safe-area inset while keeping related frontend formatting updates consistent.
2026-02-23 07:45:14 +00:00
sagit e121dadb90 fix(backend): allow WHMCS API login when captcha is enabled (#196)
## Summary
- bypass captcha verification for machine API clients tagged as WHMCS
while keeping captcha enforcement for normal login flows
- add a backend contract test that verifies WHMCS-tagged login succeeds
when captcha is enabled
- keep WHMCS module repository changes out of this PR so only backend
behavior is merged to main
2026-02-23 14:42:24 +08:00
sagitchu bafcfbde3a fix(backend): allow WHMCS API login when captcha is enabled 2026-02-23 14:40:29 +08:00
sagit 98c463c62b feat(frontend): add installable PWA support and refresh app icons (#195) 2026-02-23 06:26:29 +00:00
sagit daf34d0f6c fix(backend): prevent login block when captcha enabled without cloudflare key (#194)
When captcha_enabled=true but cloudflare_secret_key is not configured,
the login flow would block users with "未配置Cloudflare Site Key" error.
Now captcha is treated as disabled if the secret key is missing, allowing
users to log in normally on fresh PostgreSQL installations.

Fixes login issue on new panel setups with PostgreSQL.
2026-02-22 22:54:51 +08:00
sagit bb505d461d fix(frontend): enable modal scroll on panel sharing page (#193)
Add scrollBehavior="inside" to Create Share and Edit Share modals
to allow content scrolling on mobile devices when form fields
exceed viewport height.
2026-02-22 21:53:29 +08:00
sagit 00be0ac31e fix(frontend): enable content scroll on mobile (#192)
Main content area had overflow-hidden on mobile which prevented
scrolling when content exceeded viewport height. Changed to
overflow-y-auto for consistent scroll behavior across all devices.
2026-02-22 21:12:45 +08:00
sagit fc5624a190 fix(frontend): modal footer buttons visible on mobile (#190)
ModalFooter used flex-col-reverse which caused buttons to display in
reverse order on mobile and potentially pushed cancel button out of
view. Changed to flex-wrap justify-end for consistent cross-platform
button display.
2026-02-22 20:05:02 +08:00
sagit 42ae3457b5 feat(frontend): persist filter state across page reloads (#189)
* feat(frontend): persist filter state across page reloads

Add useLocalStorageState hook to persist filter/search state in
forward, node, tunnel, user, and limit pages. Reset filter clears
the persisted value from localStorage.

* feat(ui): add collapsible sidebar and smooth animations
2026-02-22 19:01:03 +08:00
sagit 088027da7b fix(frontend): resolve remaining font blur in node and forward cards (#188)
## Summary
- apply the same anti-blur drag transform strategy used in tunnel cards
to node cards
- update forward card and table-row sortable transforms to round x/y
pixels and reduce subpixel text blur
- limit `willChange` usage to active dragging so text does not remain on
a promoted layer while idle

## Verification
- npm run build (vite-frontend)
2026-02-22 16:55:08 +08:00
sagitchu d37adee5df fix(frontend): resolve remaining font blur in node and forward cards 2026-02-22 16:53:35 +08:00
sagit c147e52d72 fix(frontend): ship pending card-view animation and interaction refinements (#186)
## Summary
- include the full pending frontend refinements across card views,
search/filter interactions, and bridge components
- keep sortable/card animation behavior aligned with the latest
anti-blur adjustments in tunnel card rendering
- bundle related UI consistency updates across tunnel, forward, node,
user, and dashboard pages

## Verification
- npm run build (vite-frontend)
2026-02-22 15:54:30 +08:00
sagitchu d483258eef fix(frontend): ship pending card-view animation and interaction refinements 2026-02-22 15:52:48 +08:00
sagit 79c28103d5 fix(frontend): prevent font blur in sortable card components (#185)
Add backface-visibility: hidden and font-smoothing properties to SortableItem components in tunnel, forward, and node pages to prevent GPU subpixel rendering blur during drag operations.

- tunnel.tsx: SortableItem wrapper anti-blur fix
- forward.tsx: SortableCard wrapper anti-blur fix
- node.tsx: SortableItem component anti-blur fix

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-22 15:11:47 +08:00
sagit f36bf1437c fix(frontend): prevent font blurriness caused by scale animations (#183)
Remove scale transforms from Framer Motion animations that cause subpixel rendering issues on text elements. Replace with opacity + translateY for smooth animations without blur.

- Remove scale from FadeIn component (animated-page.tsx)
- Remove scale from login page entrance animation (index.tsx)
- Remove scale from search bar button animation (search-bar.tsx)
- Remove whileTap scale from sidebar menu buttons (admin.tsx)
- Remove scale from captcha modal animation (globals.css)
- Add .gpu-accelerated utility class for future use

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-22 13:28:47 +08:00
sagit 4ad3aa2c06 feat: redesign forward card view completely syncing filters and sorti… (#179)
…ng logic
2026-02-21 21:19:53 +08:00
sagitchu 357a4b165e Merge remote-tracking branch 'origin/main' into card-view 2026-02-21 21:18:20 +08:00
sagitchu a15be253f5 feat: add framer-motion animations (page transitions, modals, dropdowns, buttons, search bar) 2026-02-21 21:16:42 +08:00
sagitchu 572d1c16a6 feat: Implement toggleable search input and data filtering across tunnel, user, and forward pages. 2026-02-21 20:43:32 +08:00
sagit 39e22c07de feat(backend): auto redeploy tunnel and forward config after node upgrade (#180) 2026-02-21 12:29:34 +00:00
sagitchu ca24573803 feat: redesign forward card view completely syncing filters and sorting logic 2026-02-21 20:08:29 +08:00
sagit 0cb3263a2e feat(frontend): support markdown in dashboard announcements (#176)
## Summary
- render dashboard announcements with Markdown using `react-markdown` +
`remark-gfm` while sanitizing output with `rehype-sanitize`
- add styled Markdown element mappings in the announcement banner for
links, lists, code blocks, and blockquotes
- update announcement management hint text to communicate Markdown
support in the config page

## Verification
- npm run build (vite-frontend)
2026-02-21 16:50:19 +08:00
sagit fb2189c924 Merge branch 'main' into feat/announcement-markdown-support 2026-02-21 16:36:51 +08:00
sagitchu 1383174b31 refactor: Standardize empty state UI for tunnel and user pages, update announcement banner styling, and add new entries to .gitignore. 2026-02-21 16:36:36 +08:00
sagitchu c95bde7055 style: space out provider and consumer share panel title cards from tabs 2026-02-21 16:36:05 +08:00
Sagit 57f5e3a1a3 feat(frontend): support markdown in dashboard announcements 2026-02-21 05:48:24 +00:00
sagit 66ad52c199 feat(node): add stable/test release channels for install and upgrade (#175)
## Summary
- classify release tags by channel: pure numeric tags are treated as
stable, while tags containing alpha/beta/rc (or other non-numeric
formats) are treated as test releases
- add channel-aware backend APIs for install/upgrade/release listing and
pin install commands to the selected tag via `VERSION=<tag>`
- update node page UI and API clients to let users pick stable vs test
channel for install and upgrade workflows

## Verification
- `go test ./internal/http/handler/...`
- `npm run build`
2026-02-21 13:23:20 +08:00
Sagit 2081dc9658 feat(node): support stable and test release channels 2026-02-21 04:17:20 +00:00
sagit b93255df3d feat: improve forward page grouped view (#165)
Added drag-and-drop sorting and filtering to grouped view.
2026-02-20 19:52:26 +08:00
sagitchu e1aef8700e style: make filter button icon-only 2026-02-20 19:49:57 +08:00
sagitchu d5b3a39774 feat: replace inline filters with modal dialog 2026-02-20 19:45:48 +08:00
sagitchu 022e9e3807 style: tightly pack user and tunnel filters 2026-02-20 19:39:12 +08:00
sagitchu d333d463f6 style: fix dropdown filter spacing 2026-02-20 19:33:56 +08:00
sagitchu abc9f21ab9 feat: improve forward page grouped view 2026-02-20 19:27:40 +08:00
sagit d216567c02 fix(frontend): switch grouped forward view to full list (#161)
* fix(frontend): left-align announcement logo in homepage banner

* fix(frontend): keep multiselect panels floating and preserve summaries

* fix(frontend): rebalance config card header spacing

* fix(frontend): normalize formatting and fix multiselect modal behavior

* fix(frontend): polish batch actions and sharing page guidance

* fix(frontend): switch grouped forward view to full list

* fix(backend): switch diagnosis internet target to bing

* style(frontend): beautify forward group view list display

* style: remove 'x' suffix from traffic ratio input and center config alert

* fix(ui): expand exit node select upwards in modal

* style: fix vertical alignment of logo and title in announcement banner
2026-02-20 10:31:39 +00:00
sagit 45bfd35a20 fix(backend): respect tunnel IP preference in forward diagnosis (#160)
Forward diagnosis chain-hop probes now inherit the tunnel ipPreference so v6-priority tunnels test IPv6 targets instead of defaulting to IPv4. Add a contract test to lock IPv6 target selection for entry->chain and chain->exit diagnostics.
2026-02-20 05:56:12 +00:00
sagit 5a1b72387d fix(frontend): polish batch actions and sharing page guidance (#157)
* fix(frontend): polish batch actions and sharing page guidance

* fix(frontend): add top spacing above sharing section banners

* fix(frontend): allow manual and calendar expiry date input

* fix(frontend): switch batch action buttons to warning tone

* fix(frontend): switch batch action buttons to default tone
2026-02-20 12:50:17 +08:00
sagit 66de566a00 fix(frontend): stabilize multiselect behavior and UI spacing (#154)
* fix(frontend): left-align announcement logo in homepage banner

* fix(frontend): keep multiselect panels floating and preserve summaries

* fix(frontend): rebalance config card header spacing

* fix(frontend): normalize formatting and fix multiselect modal behavior

* fix(frontend): restore config divider spacing on desktop
2026-02-19 20:50:12 +08:00
sagit 18c2da7c7e fix(frontend): prevent multiselect overflow and normalize card spacing (#152)
## Summary
- fix multi-select trigger overflow in shared select bridge by making
trigger/value flex children shrink correctly
- harden grouped assignment summaries against long selected-value text
wrapping overflow
- normalize card header/body spacing and node card IP row height so card
layouts stay visually consistent across modules

## Verification
- ran `npm run build` in `vite-frontend` successfully
- checked diagnostics on changed frontend files (no diagnostics)
2026-02-19 18:23:28 +08:00
Sagit c4d807f1c4 fix(frontend): align card body spacing with node cards 2026-02-19 10:16:59 +00:00
Sagit d1460ab9c7 fix(frontend): tighten remaining card header spacing 2026-02-19 09:52:14 +00:00
Sagit 9189c68800 fix(frontend): normalize card spacing and multiselect overflow 2026-02-19 09:17:04 +00:00
sagit efbdabceca fix(frontend): align diagnosis status and permission layout (#148)
* fix(frontend): align diagnosis status and permission layout

* fix(frontend): polish batch toolbar controls on cards

* fix(user): stabilize tunnel permission checkbox interactions
2026-02-19 16:46:37 +08:00
sagit 6e5a71f489 fix(frontend): resolve scroll, diagnosis layout, and multi-select regressions (#147)
* fix(frontend): restore modal scroll and bridged multi-select UI

* fix(frontend): collapse multi-select panel and clean diagnosis labels
2026-02-19 16:10:02 +08:00
sagit e5c57f81ad docs(readme): refresh Modifications section for rewrite scope (#146)
## Summary
- Clarify that FLVX is a deeply reworked fork rather than a light patch.
- Update the Modifications section to reflect backend rewrite and
frontend rework scope.
- Align infrastructure notes with current deployment and installer
workflow wording.
2026-02-19 15:17:32 +08:00
Sagit 0b1609c6cb docs(repo): refresh README Modifications for rewrite scope 2026-02-19 07:15:43 +00:00
sagit a10c68ef20 docs(repo): refresh AGENTS knowledge for 2.1.4-rc2 (#145)
## Summary
- update root `AGENTS.md` metadata and notes to reflect `main@137c34e`
and tag `2.1.4-rc2`
- refresh `vite-frontend/AGENTS.md` to document the shadcn bridge
architecture and Tailwind v4 semantic token wiring
- add current frontend conventions/anti-patterns to prevent regressions
(raw JWT header and token import requirements)
2026-02-19 15:08:37 +08:00
Sagit 9aedeab406 docs(repo): refresh AGENTS docs for 2.1.4-rc2 2026-02-19 07:06:41 +00:00
sagit 137c34e3f5 feat(user): support user-group assignment in user management (#142)
## Summary
- add backend support to bind users to one or more user groups on
create/update
- add a new `/user/groups` API endpoint and repository methods for
user-group mapping queries/mutations
- update user modal UI to fetch/select user groups and submit `groupIds`
with user create/edit requests

## Notes
- includes minor frontend formatting changes in existing pages
(`config.tsx`, `dashboard.tsx`, `tunnel.tsx`) that were part of the
working tree
2026-02-19 14:51:44 +08:00
sagit 25d29c305f feat(frontend): complete shadcn/ui migration with compatibility bridge (#144)
## Summary
- extract reusable frontend domain modules (hooks, api typing/error
helpers, and page helper submodules for dashboard/forward/node/tunnel)
to reduce page-level coupling
- add a local shadcn/ui foundation plus HeroUI-compatible bridge layer
and migrate app imports to the bridge, enabling full UI stack
replacement without rewriting business logic
- replace HeroUI theme/plugin dependencies with local Tailwind token
configuration, remove HeroUI packages from dependencies, and document
the end-to-end migration/refactor execution plan

## Verification
- npm run build
- npm ls @heroui/button @heroui/system @nextui-org/system --depth=0
2026-02-19 14:50:29 +08:00
Sagit 9dcf9a1a43 fix(frontend): restore button border and color semantics 2026-02-19 06:36:41 +00:00
Sagit 2308b25bcf fix(frontend): forward refs through shadcn bridge buttons 2026-02-19 05:55:54 +00:00
Sagit b6c2159614 docs(frontend): document refactor batches and shadcn migration execution 2026-02-19 05:15:58 +00:00
Sagit 30c96a280d feat(frontend): wire pages to shadcn bridge and modular helpers 2026-02-19 05:15:26 +00:00
Sagit 12c50df6a7 feat(frontend): add shadcn ui primitives and compatibility bridge 2026-02-19 05:14:42 +00:00
Sagit c5124a01e6 refactor(frontend): extract reusable hooks and page helper modules 2026-02-19 05:14:11 +00:00
Sagit 6d57b49595 style(user): simplify search input wrapper classes 2026-02-18 18:55:50 +00:00
Sagit d12c5bf2e1 feat(user): support user-group assignment in user management 2026-02-18 14:47:12 +00:00
sagit 42701e6c01 chore(repo): remove analysis submodule reference (#141) 2026-02-18 21:24:17 +08:00
sagit d6c17aee79 feat(config): use tunnel-style selectors for backup import/export (#140)
* feat(config): use tunnel-style backup selectors with select-all

* feat(config): move backup selectors into modals

* chore(repo): ignore .opencode and add analysis reference
2026-02-18 21:14:05 +08:00
sagit 17f8a06704 fix(tunnel): sync forwards to agents after tunnel update (#139)
Co-authored-by: Antigravity <antigravity@google.com>
2026-02-18 19:48:09 +08:00
sagit e7b777890e fix(backend): rename legacy postgres unique constraints before AutoMigrate (#138)
Old schema.sql created tables with inline UNIQUE column constraints,
which PostgreSQL auto-names as <table>_<column>_key. GORM expects
uni_<table>_<column> (its NamingStrategy convention). On upgrade,
AutoMigrate issued DROP CONSTRAINT uni_... against a name that did not
exist, crashing startup with SQLSTATE 42704.

Add preparePostgresLegacySchema() that runs before autoMigrateAll and
renames all five mismatched constraints:
- vite_config_name_key -> uni_vite_config_name
- peer_share_token_key -> uni_peer_share_token
- peer_share_runtime_reservation_id_key -> uni_peer_share_runtime_reservation_id
- peer_share_runtime_resource_key_key -> uni_peer_share_runtime_resource_key
- federation_tunnel_binding_resource_key_key -> uni_federation_tunnel_binding_resource_key

The function is idempotent: it checks information_schema before each
rename so re-runs on already-migrated databases are no-ops.

Co-authored-by: Antigravity <antigravity@google.com>
2026-02-18 18:44:37 +08:00
Misaka Master 5b03ce87ff feat(tunnel): 支持 0~1 浮点倍率输入 (#137)
Co-authored-by: ZJU-Inno-WMX <wumingxuan@zju.edu.cn>
2026-02-18 18:01:18 +08:00
sagit 2aebb9ed5e Merge pull request #134 from Sagit-chu/fix-tunnel-ipv6-preference
fix(tunnel): respect IPv6 preference in tunnel creation and diagnostics
2026-02-18 10:04:50 +08:00
Antigravity e209fc689a fix(tunnel): respect IPv6 preference in tunnel creation and diagnostics 2026-02-18 02:03:19 +00:00
sagit f7bcb13f75 Merge pull request #132 from Sagit-chu/opencode/silent-wizard
refactor(backend): migrate to modular repository pattern
2026-02-17 16:48:34 +08:00
Antigravity 3d1a8c8963 refactor(tests): centralize DB query assertions with helpers
Reduce repetitive raw SQL in test bodies by routing scalar and multi-column checks through shared helpers, keeping test intent clearer without changing behavior.
2026-02-17 06:02:46 +00:00
sagit d82c099c7f Merge branch 'main' into opencode/silent-wizard 2026-02-17 13:18:31 +08:00
sagit 2dfcad6154 Merge pull request #133 from Sagit-chu/docs/document-existing-specs
docs: Document existing functionality with OpenSpec
2026-02-17 13:13:40 +08:00
Antigravity ba7e3c9893 docs: Add project specs and existing feature documentation 2026-02-17 05:12:21 +00:00
Antigravity d4622903b2 Merge remote-tracking branch 'origin/main' into opencode/silent-wizard
# Conflicts:
#	go-backend/internal/store/sqlite/repository.go
2026-02-17 04:54:11 +00:00
Antigravity 66be07750f refactor(backend): migrate to modular repository pattern with separated concerns
- Extract database layer into model and repo packages
- Split repository into focused modules (control, federation, flow, groups, mutations)
- Remove monolithic db.go and sqlite/repository.go
- Update handlers to use new repository structure
- Migrate contract tests to new patterns
- Add migration plan documentation
2026-02-17 04:47:11 +00:00
sagit a982c663d2 fix(backend): force column checks in migration even if schema version is current (#131)
fix(backend): force column checks in migration
2026-02-15 16:52:04 +00:00
sagit 98b4d78b4d fix: add missing ip_preference column to PostgreSQL tunnel table (#130) 2026-02-15 16:30:30 +00:00
sagit 45d7970177 feat: 添加公告系统(支持SQLite和PostgreSQL) (#129)
* feat(announcement): add database schema for SQLite and PostgreSQL

Add announcement table with id, title, content, enabled, created_at, updated_at columns to both SQLite and PostgreSQL schemas to support announcement system.

* feat(announcement): implement SQLite repository for announcement management

Add announcement CRUD operations in SQLite repository including create, read, update, delete, and list methods with proper error handling.

* feat(announcement): add HTTP handlers and auth middleware for announcement API

Implement admin-only update endpoint and public read endpoint for announcements. Add auth middleware to enforce admin-only access for update operations.

* feat(announcement): add frontend API client for announcement endpoints

Implement API client methods for fetching announcements and updating announcement settings with proper error handling.

* feat(announcement): add announcement display component to dashboard

Implement announcement display section in dashboard with real-time updates and proper styling using HeroUI components.

* feat(announcement): add announcement management UI to config page

Implement announcement settings panel with enable/disable toggle and content editor for admin users to manage announcements.
2026-02-15 15:43:41 +00:00
sagit 1b4500202a feat: update agents.md and add a feat (#128)
* docs(agents): update knowledge base with encryption, API envelope, and build conventions

Add comprehensive documentation of project conventions including:
- Encryption patterns (AES with node secret PSK)
- API envelope structure (code, msg, data, ts)
- Build peculiarities (minify: false, rolldown-vite, UPX compression)
- Unique styles (flat monorepo, asymmetric Go layout, hybrid frontend mode)
- Module boundaries and anti-patterns
- Large file hotspots and code map references

Updated 7 AGENTS.md files across root and submodules.

* test(backend): add comprehensive dual-stack IP preference test suite

Added 43 tests covering:
- Core IP selection logic (selectTunnelDialHost)
- Node capability detection (nodeSupportsV4/V6)
- Address picker functions
- API contract tests for create/update/list
- Database compatibility (SQLite + PostgreSQL)

Fixed pre-existing broken test in federation_runtime_test.go
2026-02-15 15:17:15 +00:00
sagit 9a9e83dda0 docs(agents): update knowledge base with encryption, API envelope, and build conventions (#127)
Add comprehensive documentation of project conventions including:
- Encryption patterns (AES with node secret PSK)
- API envelope structure (code, msg, data, ts)
- Build peculiarities (minify: false, rolldown-vite, UPX compression)
- Unique styles (flat monorepo, asymmetric Go layout, hybrid frontend mode)
- Module boundaries and anti-patterns
- Large file hotspots and code map references

Updated 7 AGENTS.md files across root and submodules.
2026-02-15 14:33:00 +00:00
sagit e5e22baf43 fix(federation): cleanup tunnels when unsharing federation node (#126)
When unsharing a federation node, tunnels created via federationTunnelCreate
were not cleaned up, allowing clients to continue using them. Added
cleanupFederationTunnels() to delete these tunnels and reload the node agent.
2026-02-15 11:04:53 +00:00
sagit 961c06655a fix(backend): enforce port range restrictions in federation mode (#125)
Added dual-layer port range enforcement for federation sharing:

Server-side (Provider):
- federationRuntimeApplyRole: validate runtime.Port against share range
- validateFederationCommandPorts: hardened against malformed JSON bypass
- New helpers: validateRemoteNodePort, remoteNodePortRange

Client-side (Consumer):
- prepareTunnelCreateState: pre-check ports for remote nodes
- tunnelCreate type=1: validate targetPort for remote entry
- forwardCreate/Update/BatchChangeTunnel: port range validation

Prevents consumers from using arbitrary ports outside provider's allowed range.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-15 10:42:39 +00:00
sagit 8dc31383e0 fix(backend): correct federation port forwarding tunnel type handling (#123)
- Fix Type 1 (port forwarding) tunnels to call applyFederationRuntime
  Previously only Type 2 tunnels applied federation runtime, causing
  port forwarding tunnels to not be properly configured in federation mode

- Remove incorrect UDP tunnel type override in federationTunnelCreate
  UDP tunnels were being incorrectly set to Type 2, which conflicted with
  the federation runtime logic that expects Type 1 for port forwarding

These fixes ensure all tunnel types are properly handled in federation mode
with correct runtime configuration applied.
2026-02-15 12:12:54 +08:00
sagit 184ac3c3e5 Merge pull request #122 from Sagit-chu/claude/stupefied-jemison
fix(backend): enforce port range in federation runtime commands
2026-02-15 11:26:44 +08:00
sagitchu 77dbd719ed fix(backend): enforce port range in federation runtime commands
The federationRuntimeCommand handler forwarded AddService/UpdateService
commands from consumers to provider nodes without validating that the
port in the service payload falls within the share's allowed port range.
This allowed consumers to use any port on shared nodes, bypassing the
provider's port_range_start/port_range_end restrictions.

Add port extraction and validation in federationRuntimeCommand for
service commands, rejecting requests with ports outside the allowed
range with a 403 error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 11:22:50 +08:00
sagit 04ce125416 Merge pull request #121 from Sagit-chu/fix/backup-forward-ports
fix(backend): include forward_port in backup export/import
2026-02-15 10:02:18 +08:00
sagit fd5cfc2a40 fix(backend): include forward_port in backup export/import 2026-02-15 01:44:57 +00:00
sagit 4e4193e0b0 Merge pull request #120 from Sagit-chu/opencode/pg-id-repair-ci-2-1-3-rc2
fix(backend): harden postgres id default repair and CI coverage
2026-02-14 19:04:30 +08:00
sagit 3f80278dd4 fix(backend): harden postgres id default repair and CI coverage
Run Postgres id-sequence repair on every startup migration and add contract coverage plus a GitHub Actions Postgres job to catch schema-drift regressions before release.
2026-02-14 11:02:46 +00:00
sagit 6abe3e7713 Merge pull request #117 from Sagit-chu/opencode/happy-island
fix(backend): restore user tunnel visibility on PostgreSQL
2026-02-14 12:33:59 +08:00
sagit 47c05c3d02 Merge remote-tracking branch 'origin/main' into opencode/happy-island 2026-02-14 04:32:50 +00:00
sagit d05c8a2ea4 fix(backend): restore user tunnel visibility on PostgreSQL 2026-02-14 04:31:52 +00:00
sagit e00e41bb64 fix(frontend): remove focus styles from Select trigger and Textarea (#116) 2026-02-14 03:40:14 +00:00
sagit 5271efec1e fix(frontend): aggressive removal of input focus styles (#115) 2026-02-14 03:22:15 +00:00
sagit 2d39cb3005 fix(frontend): force remove input focus border and ring (#114)
* fix(frontend): remove blue outline on input focus

* fix(frontend): force remove input focus border and ring

* fix: resolve conflict markers in globals.css
2026-02-14 03:15:34 +00:00
sagit 3e52c8eace fix(frontend): remove blue outline on input focus (#113) 2026-02-14 02:37:59 +00:00
sagit 7808d57a79 Merge pull request #112 from Sagit-chu/opencode/proud-planet
fix(frontend): remove deep blue focus border
2026-02-14 10:16:33 +08:00
sagit 46bc4ca6e4 fix(frontend): remove deep blue focus border 2026-02-14 02:14:50 +00:00
sagit 28e66ab172 Merge pull request #111 from Sagit-chu/opencode/proud-planet
fix: apply remote entry runtime updates and input focus styling
2026-02-14 09:26:40 +08:00
sagit f19bccec4c Merge remote-tracking branch 'origin/main' into opencode/proud-planet 2026-02-14 01:25:21 +00:00
sagit e37d6cf666 fix(frontend): remove input inner shadow and improve focus visibility 2026-02-14 01:16:08 +00:00
sagit 177c2bc35f Merge pull request #110 from Sagit-chu/opencode/proud-planet
fix(backend): stabilize tls forwarding and udp ttl defaults
2026-02-13 22:42:27 +08:00
sagit 76c0978763 Merge branch 'main' into opencode/proud-planet 2026-02-13 22:40:19 +08:00
sagit fd1168d855 fix(backend): set udp ttl default for tls tunnel protocol 2026-02-13 14:22:13 +00:00
sagit 92c9590c1a fix(backend): apply entry chains for remote federation nodes
Ensure remote entry nodes receive AddChains during tunnel runtime apply while tolerating offline/timeout cases. Add focused contract coverage for online and offline remote entry behavior.
2026-02-13 13:59:17 +00:00
sagit 2afb1d275a Merge pull request #109 from Sagit-chu/opencode/playful-circuit
fix(backup): handle nullable tunnel export fields safely
2026-02-13 18:38:02 +08:00
sagit 880cd4cac5 fix(backup): handle nullable tunnel export fields safely 2026-02-13 10:34:58 +00:00
sagit a69a0f040b Merge branch 'main' into opencode/kind-planet 2026-02-13 17:48:27 +08:00
sagit cf6294a77d fix(backend): normalize strategy data and proxy ip parsing 2026-02-13 09:42:38 +00:00
sagit 524ee4cd95 Merge pull request #107 from Sagit-chu/opencode/curious-harbor
fix(backup): restore backup export/import APIs and route compatibility
2026-02-13 16:36:34 +08:00
sagit c049ceaacf fix(backend): resolve backup handler build conflict after main merge 2026-02-13 08:32:00 +00:00
sagit 3424221176 Merge branch 'main' into opencode/curious-harbor 2026-02-13 16:21:56 +08:00
sagit 5a9715eb26 fix(backup): restore backup export/import APIs and route compatibility 2026-02-13 08:17:34 +00:00
sagit 1b79213aed Merge pull request #106 from Sagit-chu/opencode/init-deep-agents
docs: update AGENTS.md hierarchy with new subdirectory docs
2026-02-13 16:11:51 +08:00
sagit c0d71125f4 Merge branch 'main' into opencode/init-deep-agents 2026-02-13 15:53:38 +08:00
sagit f01c0481cd docs: update AGENTS.md hierarchy with new subdirectory docs
- Update root AGENTS.md with expanded anti-patterns and notes
- Add handler/AGENTS.md for high-complexity backend handlers
- Add connector/AGENTS.md for GOST connector protocols
- Add socket/AGENTS.md for GOST socket utilities
2026-02-13 07:52:17 +00:00
sagit f227ffddc3 Merge pull request #105 from Sagit-chu/opencode/neon-rocket
fix: 修复备份
2026-02-13 15:33:25 +08:00
sagit c4f14f985e Merge remote-tracking branch 'origin/main' into opencode/neon-rocket 2026-02-13 07:30:53 +00:00
sagit 3b294c6b9e chore(frontend): fix HeroUI deps and apply lint cleanup 2026-02-13 07:25:27 +00:00
sagit 641aa66afc feat(backup): restore backup export/import flow 2026-02-13 07:25:13 +00:00
sagit fea1bf52f3 Merge pull request #102 from Sagit-chu/opencode/quick-comet
feat: 导入导出备份
2026-02-13 14:39:25 +08:00
sagit a72d84fa76 Merge branch 'main' into opencode/quick-comet 2026-02-13 14:21:00 +08:00
sagit 146821ebba Merge pull request #104 from Sagit-chu/opencode/tidy-cactus
fix: 修复共享节点作为入口的问题和调整docker 网络
2026-02-13 14:16:56 +08:00
sagit 0191f29cf1 chore(docker): update network subnet in compose files
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-13 06:02:09 +00:00
sagit 149a841a49 test(federation): add tests for remote node command and offline status
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-13 06:02:01 +00:00
sagit 229ae9e454 feat(backend): route node commands to remote panels
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-13 06:01:52 +00:00
sagit ae8a3db3df feat(federation): add remote node command support
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-13 06:01:42 +00:00
sagit 51660c413e Merge branch 'main' into opencode/quick-comet 2026-02-13 13:46:31 +08:00
sagit 2d2ca389e3 fix(backup): add transaction support and auto-backup before import
- Add transaction support for import operations with rollback on failure
- Add auto-backup before import to allow recovery on failure
- Convert user import to use INSERT ON CONFLICT pattern
- Add Execer interface to support both DB and Tx in import functions
2026-02-13 05:44:50 +00:00
sagit 3799729706 Merge pull request #103 from Sagit-chu/opencode/tidy-panda
fix: tls udp 转发
2026-02-13 13:15:06 +08:00
sagit 8628c35802 Merge branch 'main' into opencode/tidy-panda 2026-02-13 13:13:33 +08:00
sagit acea5ea76c fix(gost): filter expected net.ErrClosed noise in service handler
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-13 05:09:54 +00:00
sagit 8652380da1 feat(backend): TLS tunnel relay nodelay injection
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-13 05:09:46 +00:00
sagit dd206ced14 fix(permission): revoke inherited tunnel access after group unbind/removal 2026-02-13 03:28:21 +00:00
sagit f720b92f53 Merge branch 'main' into opencode/quick-comet 2026-02-13 11:10:09 +08:00
sagit f879a58bb4 feat(frontend): add backup export and import UI
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-13 03:06:32 +00:00
sagit b11283d488 feat(backend): add backup and restore functionality
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-13 03:06:23 +00:00
sagit 70f8dfeac1 Merge pull request #101 from Sagit-chu/opencode/eager-garden
fix(backend): implement keyword search in user list
2026-02-13 10:49:57 +08:00
sagit 37005a1954 Merge branch 'main' into opencode/eager-garden 2026-02-13 10:45:37 +08:00
sagit b55e056316 fix(backend): implement keyword search in user list
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-13 02:41:38 +00:00
sagit b3b7f5e56d Merge pull request #100 from Sagit-chu/opencode/gentle-comet
fix(tunnel): auto-update entry node IP on every tunnel update
2026-02-13 10:19:32 +08:00
sagit d6ff6ea500 Merge branch 'origin/main' into opencode/gentle-comet 2026-02-13 02:03:24 +00:00
sagit 9ed875b7ef fix(tunnel): auto-update entry node IP on every tunnel update 2026-02-13 01:24:48 +00:00
sagit 6387ce1816 Merge pull request #98 from Sagit-chu/opencode/glowing-orchid
fix(db): align sqlite/postgres SQL behavior and harden rewriter
2026-02-12 18:00:42 +08:00
sagit 219067a27c Merge branch 'main' into opencode/glowing-orchid 2026-02-12 17:55:41 +08:00
sagit 33678477aa fix(db): align sqlite/postgres SQL behavior and harden rewriter 2026-02-12 09:47:44 +00:00
sagit e33fbda8f4 Merge pull request #97 from Sagit-chu/opencode/glowing-orchid
fix: backend postgresql
2026-02-12 16:47:04 +08:00
sagit 62cb75f669 Merge branch 'main' into opencode/glowing-orchid 2026-02-12 16:45:46 +08:00
sagit f3260637db fix(install): prioritize explicit sqlite selection over stale DATABASE_URL
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-12 08:44:11 +00:00
sagit e43c6bf840 fix(postgres): avoid 42P18 during id default repair 2026-02-12 08:39:10 +00:00
sagit 025d0a3322 Merge pull request #96 from Sagit-chu/opencode/glowing-orchid
feat(postgres): add migration workflow and id self-heal
2026-02-12 16:06:06 +08:00
sagit 2dcfe15f00 Merge branch 'main' into opencode/glowing-orchid 2026-02-12 16:04:49 +08:00
sagit ecaae178b6 feat(postgres): add migration workflow and id self-heal 2026-02-12 08:02:34 +00:00
sagit 46a8ceff6a Merge pull request #95 from Sagit-chu/opencode/glowing-orchid
fix(docker): bump Go builder image to 1.24 to match go.mod requirement
2026-02-12 15:13:17 +08:00
sagit 7bfa1251c4 Merge branch 'main' into opencode/glowing-orchid 2026-02-12 15:12:12 +08:00
sagit cd09305a85 fix(docker): bump Go builder image to 1.24 to match go.mod requirement 2026-02-12 07:11:45 +00:00
sagit b5f8a491b3 Merge pull request #94 from Sagit-chu/opencode/glowing-orchid
docs: add PostgreSQL database guide and update FAQ with PG entries
2026-02-12 15:06:11 +08:00
sagit e4acd855e0 Merge branch 'main' into opencode/glowing-orchid 2026-02-12 15:05:01 +08:00
sagit 275cfdc65a docs: add PostgreSQL database guide and update FAQ with PG entries 2026-02-12 07:04:06 +00:00
sagit 9d323ce930 Merge pull request #93 from Sagit-chu/opencode/glowing-orchid
feat(postgres): add postgres backend support and migration docs
2026-02-12 14:53:54 +08:00
sagit 1733948a1b Merge branch 'main' into opencode/glowing-orchid
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-12 06:52:06 +00:00
sagit cedcaebd1f feat(postgres): add postgres backend support and migration docs 2026-02-12 06:38:25 +00:00
sagit b32133f81a Merge pull request #92 from Sagit-chu/opencode/lucky-otter
fix(upgrade): stabilize batch node upgrades
2026-02-12 13:37:43 +08:00
sagit ff57bca505 Merge branch 'main' into opencode/lucky-otter 2026-02-12 13:11:45 +08:00
sagit cdb2914dbf fix(upgrade): stabilize batch node upgrades under long-running operations 2026-02-12 04:57:58 +00:00
sagit b56d0a28e7 Merge pull request #91 from Sagit-chu/opencode/lucky-otter
fix(ws): prevent monitor websocket reconnect loop
2026-02-12 12:28:53 +08:00
sagit bdfc704f95 Merge branch 'main' into opencode/lucky-otter 2026-02-12 12:27:23 +08:00
sagit 9223892ca5 fix(ws): prevent monitor websocket reconnect loop 2026-02-12 04:25:47 +00:00
sagit 6f205df37c Merge pull request #90 from Sagit-chu/opencode/lucky-otter
fix(ws): stabilize node connectivity with ping/pong keepalive
2026-02-12 10:29:14 +08:00
sagit 04266165df Merge branch 'main' into opencode/lucky-otter 2026-02-12 10:28:04 +08:00
sagit dbd5773717 fix(ws): stabilize node connectivity with ping/pong keepalive 2026-02-12 02:27:10 +00:00
sagit 6c4d44e7a7 Merge pull request #89 from Sagit-chu/opencode/lucky-otter
fix(store): enable WAL mode and busy timeout to prevent SQLITE_BUSY
2026-02-12 09:09:42 +08:00
sagit 07b8d73956 Merge branch 'main' into opencode/lucky-otter 2026-02-12 09:08:36 +08:00
sagit 71a6a60077 fix(store): enable WAL mode and busy timeout to prevent SQLITE_BUSY errors
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-12 01:07:41 +00:00
sagit fe33028934 Merge pull request #87 from Sagit-chu/opencode/lucky-otter
fix: 节点管理按钮改为两行 grid 布局,防止卡片滑动溢出
2026-02-11 16:54:58 +08:00
sagit 01da4bd283 Merge branch 'main' into opencode/lucky-otter 2026-02-11 16:53:15 +08:00
sagit a0b975b62a chore: add go-gost/gost binary to .gitignore 2026-02-11 08:53:03 +00:00
sagit f4e56d091e fix: 节点管理按钮改为两行 grid 布局,防止卡片滑动溢出
- 操作按钮从单行 flex 改为两行 grid (3+2),避免窄屏挤压
- SortableItem 和 Card 添加 overflow-hidden,阻止内容溢出导致页面横滑
2026-02-11 08:45:58 +00:00
sagit 0a5335c1ca Merge pull request #86 from Sagit-chu/opencode/lucky-otter
fix: use systemd-run for agent upgrade/rollback restart
2026-02-11 16:15:55 +08:00
sagit d40e97d73b Merge branch 'main' into opencode/lucky-otter 2026-02-11 16:14:42 +08:00
sagit 73bf672e62 fix: use systemd-run for agent upgrade/rollback restart to avoid cgroup kill 2026-02-11 08:07:04 +00:00
sagit 297f526a92 Merge pull request #85 from Sagit-chu/opencode/lucky-otter
fix: use direct GitHub API for release queries instead of proxy
2026-02-11 15:46:21 +08:00
sagit 2b854d3172 Merge branch 'main' into opencode/lucky-otter 2026-02-11 15:43:18 +08:00
sagit c184a75f22 fix: use direct GitHub API for release queries instead of proxy
The gcode.hostcentral.cc proxy only supports github.com file downloads,
not api.github.com requests. API calls through the proxy returned 404
HTML pages, causing JSON decode error: invalid character '<'.

Also updates repo name from flux-panel to flvx across upgrade and
install URLs.
2026-02-11 07:37:30 +00:00
sagit 8a5bfa5aa8 Merge pull request #84 from Sagit-chu/opencode/lucky-otter
feat: complete agent upgrade system with batch upgrade
2026-02-11 15:09:34 +08:00
sagit 421f18d4da Merge branch 'main' into opencode/lucky-otter 2026-02-11 15:07:07 +08:00
sagit 5133e6f039 fix: remove unused handleUpgradeNode function 2026-02-11 07:04:50 +00:00
sagit 311840b29b feat: complete agent upgrade system with batch upgrade, version selection, progress reporting, and rollback 2026-02-11 07:01:00 +00:00
sagit 767f36668c Merge pull request #83 from Sagit-chu/opencode/shiny-squid
feat(node-install): add gcode.hostcentral.cc proxy to install script …
2026-02-11 14:01:06 +08:00
sagit 980509734d Merge branch 'main' into opencode/shiny-squid 2026-02-11 14:00:04 +08:00
sagit 65a6105469 feat(node-install): add gcode.hostcentral.cc proxy to install script download URL 2026-02-11 05:59:11 +00:00
sagit 0039b39609 Merge pull request #81 from Sagit-chu/opencode/shiny-squid
feat(panel-sharing): add edit support for peer shares
2026-02-11 11:16:25 +08:00
sagit 92ff7f568b Merge branch 'main' into opencode/shiny-squid 2026-02-11 11:12:03 +08:00
sagit 896f2bc5f8 fix(panel-sharing): display provider share deletion warnings for remote nodes
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-11 03:08:59 +00:00
sagit 87605ce8f8 fix(federation): sync remote node status on list and detect deleted provider shares
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-11 03:08:59 +00:00
sagit a5b191328d Merge pull request #82 from Sagit-chu/Sagit-chu-patch-1
Update README with project modifications and disclaimers
2026-02-11 11:00:41 +08:00
sagit 14063e66c3 Update README with project modifications and disclaimers
Removed outdated project details and added modifications section.
2026-02-11 10:59:02 +08:00
sagit 161be2c167 Merge branch 'main' into opencode/shiny-squid 2026-02-11 10:52:41 +08:00
sagit d6b83a0c1b feat(panel-sharing): add edit support for peer shares
Allow editing port range, traffic limit, allowed domains, allowed API
IPs and expiry time on existing shares via a new update endpoint and
edit modal in the frontend.
2026-02-11 02:48:57 +00:00
sagit 7aa5ca3e96 Merge pull request #80 from Sagit-chu/opencode/lucky-comet
docs: add caddy reverse proxy guide
2026-02-11 10:28:11 +08:00
sagit 7f69a130d0 Merge branch 'main' into opencode/lucky-comet 2026-02-11 10:26:30 +08:00
sagit 5ddb46c3c2 docs: add caddy reverse proxy guide 2026-02-11 02:25:16 +00:00
sagit 69f62188cf fix(panel-sharing): use adaptive units in formatFlowGB
fix(panel-sharing): use adaptive units in formatFlowGB to display sma…
2026-02-11 10:20:47 +08:00
sagit f786d60219 Merge branch 'main' into opencode/shiny-squid 2026-02-11 10:18:16 +08:00
sagit bdc3513a68 fix(panel-sharing): use adaptive units in formatFlowGB to display small traffic values 2026-02-11 02:17:38 +00:00
sagit acb20a13b7 Merge pull request #78 from Sagit-chu/fix/mirror-proxy-all-downloads
fix: route all downloads through mirror proxy for IPv6 support
2026-02-11 09:50:23 +08:00
sagit c890ec783d fix: route all downloads through mirror proxy for IPv6 support 2026-02-11 01:47:52 +00:00
sagit 8ccc5e054a Merge pull request #77 from Sagit-chu/opencode/shiny-squid
fix: Panel Peering
2026-02-10 20:13:22 +08:00
sagit aef329149d Merge branch 'main' into opencode/shiny-squid 2026-02-10 20:08:08 +08:00
sagit 8473b9040f fix(panel-sharing): disable cursor animation to fix scroll offset issue
Co-authored-by: Sisyphus <sisyphus@opencode.ai>
2026-02-10 12:04:51 +00:00
sagit 89ab12dcdf fix(federation): clean up runtimes on share delete and sync live traffic from provider
Co-authored-by: Sisyphus <sisyphus@opencode.ai>
2026-02-10 11:58:00 +00:00
sagit 919339cdb1 fix(federation): cascade delete peer_share_runtime rows on share deletion
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-10 11:58:00 +00:00
sagit 6a8996b17a Merge pull request #76 from Sagit-chu/opencode/cosmic-falcon
feat(install): support version-pinned install from release assets
2026-02-10 18:56:24 +08:00
sagit 7557e02e54 feat(install): support version-pinned install from release assets
Add PINNED_VERSION mechanism so scripts downloaded from a specific
release (e.g. 2.1.0) install that exact version instead of latest.
CI injects the version via sed during release build. Users can still
override with VERSION= env var. Update release notes and README to
show both pinned and latest install options.
2026-02-10 10:54:17 +00:00
sagit 90debf144b Merge pull request #75 from Sagit-chu/opencode/shiny-squid
feat(federation): add share flow reset and remote usage visibility
2026-02-10 18:30:01 +08:00
sagit cec5fe9adb Merge branch 'main' into opencode/shiny-squid 2026-02-10 18:25:53 +08:00
sagit 6790336885 style(node): move drag handle to left of status chips 2026-02-10 10:23:53 +00:00
sagit 5aea281e16 fix(node): hide local-only metrics and actions for remote nodes 2026-02-10 10:13:36 +00:00
sagit 3b697f4d13 feat(federation): add share flow reset and remote usage visibility 2026-02-10 10:04:31 +00:00
sagit b4a8b582fa Merge pull request #70 from Sagit-chu/opencode/shiny-squid
feat(backend): support federation-based remote node diagnosis
2026-02-10 15:10:23 +08:00
sagit 34becb6604 Merge branch 'main' into opencode/shiny-squid 2026-02-10 15:08:39 +08:00
sagit a6e8722e27 Merge pull request #73 from Sagit-chu/opencode/witty-circuit
some changes
2026-02-10 15:06:40 +08:00
sagit 83256a5e26 Merge branch 'main' into opencode/witty-circuit 2026-02-10 15:05:01 +08:00
sagit 27e7e065ef docs: add Original Project section to README.md 2026-02-10 07:03:04 +00:00
sagit fdfb6512bb docs: move modification details to top and remove explicit fork mention 2026-02-10 07:00:53 +00:00
sagit cb76b2161e docs: update copyright year to 2026 2026-02-10 06:58:13 +00:00
sagit 9b19e45711 docs: restructure license and notice files for GPLv3 compliance 2026-02-10 06:55:28 +00:00
sagit 0cf81a783c Merge branch 'main' into opencode/shiny-squid 2026-02-10 14:48:37 +08:00
sagit f0893afe42 Merge pull request #72 from Sagit-chu/opencode/witty-circuit
docs: add NOTICE.md detailing project modifications
2026-02-10 14:45:44 +08:00
sagit ae2da67efd Merge branch 'main' into opencode/witty-circuit 2026-02-10 14:44:24 +08:00
sagit 63e9d80023 docs: add NOTICE.md detailing project modifications 2026-02-10 06:43:37 +00:00
sagit b205b47414 feat(federation): add import API IP whitelist controls 2026-02-10 06:40:46 +00:00
sagit d517695544 Merge pull request #71 from Sagit-chu/Sagit-chu-patch-1
Revise README with project attribution and features
2026-02-10 14:27:03 +08:00
sagit 29e58ec66a Update README.md 2026-02-10 14:25:57 +08:00
sagit de9146334e Revise README with project attribution and features
Update project description and attribution in README.
2026-02-10 14:25:13 +08:00
sagit 00079ac7af fix(federation): enforce local-only provider share nodes 2026-02-10 06:21:02 +00:00
sagit 2affb31b3e feat(backend): support federation-based remote node diagnosis
Route diagnosis for shared remote nodes through federation runtime APIs so tunnel and forward diagnostics work across panels, and add contract coverage for single-panel and dual-panel scenarios.
2026-02-10 06:00:35 +00:00
sagit 49884d54ac Merge pull request #68 from Sagit-chu/fix-backend
fix(backend): backfill legacy node dual-stack columns in sqlite migra…
2026-02-10 12:22:54 +08:00
sagit dae6286e58 fix(backend): backfill legacy node dual-stack columns in sqlite migration 2026-02-10 04:18:21 +00:00
sagit da52b66cd2 Merge pull request #65 from Sagit-chu/opencode/shiny-squid
fix(backend): backfill legacy inx columns during sqlite migration
2026-02-10 11:40:57 +08:00
sagit a8da752f5c Merge branch 'main' into opencode/shiny-squid 2026-02-10 11:23:42 +08:00
sagit 32763358ea fix(backend): backfill legacy inx columns during sqlite migration 2026-02-10 03:08:52 +00:00
sagit 3d9432e3bc Merge pull request #64 from Sagit-chu/opencode/shiny-squid
feat(backend): orchestrate federation runtime for shared middle and exit nodes
2026-02-10 10:52:47 +08:00
sagit d515d610b9 chore: remove tracked paneld binary and ignore local artifact 2026-02-10 02:43:08 +00:00
sagit 08f5b3aa33 chore: sync AGENTS docs and include backend binary artifact 2026-02-10 02:36:29 +00:00
sagit 67f935c46f test(backend): add federation runtime unit and dual-panel contract coverage 2026-02-10 02:34:41 +00:00
sagit 79f8aab600 feat(backend): orchestrate federation runtime for shared middle and exit nodes 2026-02-10 02:34:20 +00:00
sagit 5f42c50689 Merge pull request #63 from Sagit-chu/fix/backend-schema-migration
fix(backend): ensure all tables exist on startup via schema.sql
2026-02-09 20:43:21 +08:00
sagit 2b2f914bec feat(frontend): add panel sharing entry to mobile profile page
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-09 12:41:58 +00:00
sagit c18703eba2 fix(backend): ensure all tables exist on startup via schema.sql
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-09 12:30:40 +00:00
sagit 3f2150828d Merge pull request #49 from Sagit-chu/opencode/silent-wizard
feat: 共享面板
2026-02-09 19:46:11 +08:00
sagit c76bb77b93 Merge branch 'main' into opencode/silent-wizard 2026-02-09 19:42:48 +08:00
sagit 01d5c25df1 feat(frontend): add grouping management to mobile profile menu 2026-02-09 11:24:03 +00:00
sagit a19e8d2bcb feat: implement panel domain verification for federation sharing 2026-02-09 10:53:58 +00:00
sagit bf88b0dd7e Merge branch 'main' into opencode/silent-wizard 2026-02-09 14:35:25 +08:00
sagit 169df953d8 fix: resolve compilation error in repository.go 2026-02-09 03:02:11 +00:00
sagit 7bc33f63ba feat: complete federation sharing backend implementation 2026-02-09 03:00:18 +00:00
sagit 5925a84a6d Merge branch 'main' into opencode/silent-wizard 2026-02-09 10:59:10 +08:00
sagit 52885d1821 chore: update project state 2026-02-08 12:28:46 +00:00
sagit 124cf1ced2 Merge branch 'main' into opencode/silent-wizard 2026-02-08 20:27:25 +08:00
sagit fef4c28777 fix: frontend build errors and dependency issues 2026-02-08 10:45:18 +00:00
sagit 9ab5140258 chore: cleanup temporary files 2026-02-08 09:08:32 +00:00
sagit 11dc21e46f feat: implement consumer side panel peering logic 2026-02-08 09:03:56 +00:00
364 changed files with 182817 additions and 7619 deletions
+84
View File
@@ -0,0 +1,84 @@
{
"hooks": {
"PostToolUse": [
{
"matcher": "Task",
"hooks": [
{
"type": "command",
"command": "entire hooks claude-code post-task"
}
]
},
{
"matcher": "TodoWrite",
"hooks": [
{
"type": "command",
"command": "entire hooks claude-code post-todo"
}
]
}
],
"PreToolUse": [
{
"matcher": "Task",
"hooks": [
{
"type": "command",
"command": "entire hooks claude-code pre-task"
}
]
}
],
"SessionEnd": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "entire hooks claude-code session-end"
}
]
}
],
"SessionStart": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "entire hooks claude-code session-start"
}
]
}
],
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "entire hooks claude-code stop"
}
]
}
],
"UserPromptSubmit": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "entire hooks claude-code user-prompt-submit"
}
]
}
]
},
"permissions": {
"deny": [
"Read(./.entire/metadata/**)"
]
}
}
@@ -0,0 +1,32 @@
# Session Context
Session ID: ses_349a99cf4ffeQMqVmv7PqyI3y6
Commit Message: 普通用户添加转发的时候应该不能有权限设置限速和设置自定义端口,请检查并规划设计
## Prompts
### Prompt 1
普通用户添加转发的时候应该不能有权限设置限速和设置自定义端口,请检查并规划设计
## Summary
## 分析结果
### 当前状态
- **角色系统**: `roleID == 0` 为管理员,`roleID != 0` 为普通用户
- **问题**: 普通用户在创建/编辑转发时可设置 `speedId`(限速) 和 `inPort`(自定义端口)
### 实施方案
**后端修改** (`go-backend/internal/http/handler/mutations.go`):
- `forwardCreate`: 检查 `roleID != 0` 时拒绝 `speedId` 和 `inPort`
- `forwardUpdate`: 检查 `actorRole != 0` 时拒绝 `speedId` 和 `inPort`
**前端修改** (`vite-frontend/src/pages/forward.tsx`):
- 限速规则选择器和入口端口输入框使用 `{isAdmin && (...)}` 条件渲染
**测试**:
- 添加契约测试验证权限限制
计划文档: `plans/009-restrict-user-forward-permissions.md`
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
普通用户添加转发的时候应该不能有权限设置限速和设置自定义端口,请检查并规划设计
@@ -0,0 +1,19 @@
## 分析结果
### 当前状态
- **角色系统**: `roleID == 0` 为管理员,`roleID != 0` 为普通用户
- **问题**: 普通用户在创建/编辑转发时可设置 `speedId`(限速) 和 `inPort`(自定义端口)
### 实施方案
**后端修改** (`go-backend/internal/http/handler/mutations.go`):
- `forwardCreate`: 检查 `roleID != 0` 时拒绝 `speedId` 和 `inPort`
- `forwardUpdate`: 检查 `actorRole != 0` 时拒绝 `speedId` 和 `inPort`
**前端修改** (`vite-frontend/src/pages/forward.tsx`):
- 限速规则选择器和入口端口输入框使用 `{isAdmin && (...)}` 条件渲染
**测试**:
- 添加契约测试验证权限限制
计划文档: `plans/009-restrict-user-forward-permissions.md`
File diff suppressed because it is too large Load Diff
@@ -0,0 +1 @@
提交全部变更并且push,创建pr合并,发布新tag,2.1.7-beta6
@@ -0,0 +1,5 @@
完成:
- 已提交并推送变更
- PR #259 已合并到 main
- 已创建并推送 tag `2.1.7-beta6`
- 已删除远程分支
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
转发选择限速后保存,然后把限速删除,再次编辑转发报错会报错限速不存在,请保存的时候限速不存在直接删除限速,不阻断提示限速不存在
@@ -0,0 +1,20 @@
我已经定位到问题点了,确实在后端 `forward/update` 的限速校验会把“已被删除的限速ID”当成硬错误返回,导致你说的二次编辑报 `限速规则不存在`。
**定位结果**
- 触发点在 `go-backend/internal/http/handler/mutations.go:1259` 附近(`forwardUpdate`)和 `go-backend/internal/http/handler/mutations.go:1147` 附近(`forwardCreate`)。
- 当前逻辑是:只要请求里带了 `speedId`,且 `SpeedLimitExists=false`,就直接 `ErrDefault("限速规则不存在")` 返回。
- 前端编辑提交在 `vite-frontend/src/pages/forward.tsx:1403` 会一直带 `speedId`(包括编辑场景),所以很容易复现你说的问题。
**实施计划(不改动其他业务)**
- 新建计划文档:`plans/006-forward-save-missing-speed-limit-auto-clear.md`(按现有 001~005 递增)。
- 后端仅改转发保存逻辑,不改用户隧道限速逻辑:
- `forwardCreate`:若 `speedId` 不存在,自动当成 `nil`(即“不限速”)继续保存,不返回“限速不存在”错误。
- `forwardUpdate`:按“最终要写入的 speed_id”做一次兜底校验;若不存在则自动清空为 `NULL` 再继续保存,确保编辑不阻断。
- 不新增“限速不存在”阻断提示(符合你要求)。
- 增加/更新合约测试:`go-backend/tests/contract/forward_contract_test.go`
- 覆盖场景:转发绑定限速后,删除该限速,再编辑转发保存,应返回成功且 `forward.speed_id` 被清空。
- 验证命令(实施后执行):
- `cd go-backend && go test ./tests/contract/... -run Forward`
- 如有必要再跑 `cd go-backend && go test ./...`
如果你确认,我下一步就按这个方案进入实现。
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
提交全部变更并且push,创建pr合并,发布新tag,2.1.7-beta5
@@ -0,0 +1,7 @@
✅ 已完成:
- 提交变更:feat: auto-fallback to default bind IP when invalid bind address detected
- 推送分支:opencode/mighty-nebula → origin
- 创建PR:#258(已自动合并)
- 发布tag:2.1.7-beta5
PR: https://github.com/Sagit-chu/flvx/pull/258
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
提交全部变更并且push,创建pr合并,发布新tag,2.1.7-beta4
@@ -0,0 +1,6 @@
Tag `2.1.7-beta4` 已在 GitHub 远程创建成功。
**完成摘要:**
- 提交: `7efb49b` - fix: handle forward service rebind on self-occupied port
- PR: https://github.com/Sagit-chu/flvx/pull/257 (已合并)
- Tag: `2.1.7-beta4` 已推送到远程
File diff suppressed because one or more lines are too long
@@ -0,0 +1,17 @@
转发编辑保存报错create service 3_1_0_tcp failed: listen tcp4 13.228.170.187:16765: bind: cannot assign requested address
引发条件:当编辑选择入口IP原来是默认地址,选择成和默认地址一样的地址的时候报错
---
保持“只要用户选了IP就一定显式绑定”,如果选择的IP后发现端口占用,检测是否是当前转发占用的,如果是那就释放掉,避免原来是默认监听::所有地址后永远无法切换
---
按计划实现
---
节点 test-sg 下发失败: create service 3_1_0_tcp failed: listen tcp4 13.228.170.187:56025: bind: cannot assign requested address
还是不行啊,由默认入口IP创建的转发,然后编辑选择了唯一的一个IP后报错了
@@ -0,0 +1,23 @@
你这个新报错我确认了:这次**不是端口占用问题**,是 **IP 本机不可绑定** 问题。
- 报错是 `bind: cannot assign requested address`,含义是节点机器网卡上没有 `13.228.170.187` 这个本地地址;释放旧服务也不会解决。
- 你说“唯一一个IP可选”,很可能来自前端当前候选逻辑把 `serverIp/serverIpV4/serverIpV6` 当成监听候选(`vite-frontend/src/pages/forward.tsx:612` 一带),但这些字段在 NAT/云环境下常是“对外地址”,不一定是本机可 bind 地址。
- 我之前加的自占用释放逻辑会在冲突时尝试删旧服务再加新服务,但对 `cannot assign requested address` 这种错误会一直失败(因为 IP 本身不可绑定)。
我建议下一步这样改(这次是关键):
- 后端只把 `address already in use` 走“自占用释放重绑”流程;`cannot assign requested address` 不走该流程。
位置:`go-backend/internal/http/handler/control_plane.go`
- 前端监听 IP 下拉改为“可绑定地址优先”:优先 `extraIPs` + 明确配置的监听地址,**不再默认把 `serverIp*` 作为可绑定监听IP**。
位置:`vite-frontend/src/pages/forward.tsx`
- 后端增加快速校验并返回更明确提示:
`监听IP不是节点本机地址,请在节点 extraIPs 配置可绑定IP后再选择`。
位置:`go-backend/internal/http/handler/control_plane.go` + repo 查询辅助。
- 你的临时可用绕过:到节点配置里把真实网卡 IP 填到 `extraIPs`,然后在编辑转发时选该 IP。
一个需要你拍板的点(推荐第1个):
1. **推荐**:前端不再展示 `serverIp/serverIpV4/serverIpV6` 为监听IP候选,只展示 `extraIPs`(和明确监听地址)。
2. 继续展示 `serverIp*`,但加“可能不可绑定”标签和失败提示。
你回我 `1` 或 `2`,我就按这个继续落地。
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
提交全部变更并且push,创建pr合并,发布新tag,2.1.7-beta3
@@ -0,0 +1,8 @@
完成!已成功:
1. **提交变更**: 5个文件(修复绑定IP保留问题 + 新增单元测试)
2. **推送分支**: opencode/mighty-nebula → origin
3. **创建PR**: #256 (已合并)
4. **发布tag**: 2.1.7-beta3
PR #256: https://github.com/Sagit-chu/flvx/pull/256
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
编辑转发后保存报错 下发失败: create service 3_1_0_tcp failed: listen tcp4 13.228.170.187:16765: bind: cannot assign requested address,这个bug是因为增加了自定义IP功能后导致的,监听IP 不选择就会报错,应该根据原来的监听状态保存
@@ -0,0 +1,23 @@
你这个判断是对的,我已经把链路看清了,确实是“新增自定义监听 IP 后,编辑保存把原监听状态覆盖掉”导致的。
- 前端编辑表单会把 `forward.inIp` 直接回填到 `form.inIp`(`vite-frontend/src/pages/forward.tsx:1302`)。
- 保存时会把 `form.inIp` 带到更新请求(`vite-frontend/src/pages/forward.tsx:1391`)。
- 后端更新时无论是否真的改了监听 IP,都会用请求里的 `inIp` 全量重建 `forward_port`(`go-backend/internal/http/handler/mutations.go:1288`、`go-backend/internal/http/handler/mutations.go:1305`、`go-backend/internal/http/handler/mutations.go:3019`)。
- 而列表里的 `forward.inIp` 可能是“展示回退值”(隧道 IP/节点 IP),不一定是原始 `forward_port.in_ip`(`go-backend/internal/store/repo/repository.go:731`、`go-backend/internal/store/repo/repository.go:2778`、`go-backend/internal/store/repo/repository.go:2780`)。
- 这样就会在“没手动选监听 IP”时,把服务改成绑定不可用地址,触发 `bind: cannot assign requested address`。
我建议的修复方案(实现时会做成双保险):
- 前端:编辑模式下仅当用户“主动改过监听 IP”时才提交 `inIp` 字段;未触碰则不传,保持原状态。
- 后端:`forward/update` 中如果请求没带 `inIp`,就保留原 `forward_port.in_ip`(不清空、不覆盖);若带了 `inIp`(包括空串),按用户意图更新。
- 回归测试:
- 后端新增用例:未传 `inIp` 时更新不改变监听绑定。
- 后端新增用例:显式传空串时清空监听绑定。
- (可选)前端补充一个轻量逻辑测试/至少手工验证路径。
另外按仓库规则,这次会新增计划文档为:`plans/003-forward-edit-bind-ip-preserve.md`(当前是只读 Plan Mode,我还没动文件)。
一个需要你拍板的小点(我给默认建议):
- **推荐默认**:编辑时如果改了隧道但没有手动选“监听IP”,按“默认监听(空)”处理,不继承旧隧道的监听 IP。
这样能避免把旧隧道的 IP 误带到新隧道。
你是否同意按这个规则?
File diff suppressed because one or more lines are too long
@@ -0,0 +1,13 @@
提交全部变更并且push,创建pr合并,发布新tag,beta版本
---
不对,tag是2.1.7-beta2
---
2.1.8-beta1 标签没有被删除成功
---
2.1.8-alpha1 标签没有被删除成功
@@ -0,0 +1 @@
已删除 `2.1.8-alpha1` 标签。当前最新版本为 `2.1.7-beta2`。
@@ -0,0 +1,41 @@
# Session Context
Session ID: ses_34d1fa4b1ffeH4sVbjXkh5P6IY
Commit Message: 实施
## Prompts
### Prompt 1
转发导入,ny兼容格式,不要选择入口,改成选择隧道,修改兼容一下
### Prompt 2
自动分配端口(推荐)
### Prompt 3
实施
## Summary
已实施完成,这次改动把 `ny` 导入完全对齐到“选隧道”流程,并按你指定支持“端口缺失自动分配”。
- `ny` 解析兼容增强:支持字段别名、可选端口
- 修改 `vite-frontend/src/pages/forward/import-format.ts`
- `listen_port` 现在允许为 `null`(缺失即自动分配)
- 兼容字段:`dest/dst/target/targets`、`listen_port/listenPort/port/in_port/inPort`、`name/forward_name/forwardName`
- `dest` 支持数组或逗号分隔字符串,统一归一化
- 导入 UI 文案已同步更新(强调按所选隧道导入 + 端口可省略)
- 修改 `vite-frontend/src/pages/forward.tsx:4623`、`vite-frontend/src/pages/forward.tsx:4699`
- 测试已补齐并通过
- 修改 `vite-frontend/src/pages/forward/import-format.test.ts`
- 新增用例:缺失端口自动分配、别名字段兼容、`inPort: null` 映射
- 计划文档已新增并完成勾选
- `plans/002-ny-import-tunnel-selection-compat.md`
验证结果:
- `npm run build`(`vite-frontend`)通过
- `node --test src/pages/forward/import-format.test.ts` 7/7 通过
如果你要,我下一步可以直接帮你提交一个规范 commit。
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
转发导入,ny兼容格式,不要选择入口,改成选择隧道,修改兼容一下
---
自动分配端口(推荐)
---
实施
@@ -0,0 +1,20 @@
已实施完成,这次改动把 `ny` 导入完全对齐到“选隧道”流程,并按你指定支持“端口缺失自动分配”。
- `ny` 解析兼容增强:支持字段别名、可选端口
- 修改 `vite-frontend/src/pages/forward/import-format.ts`
- `listen_port` 现在允许为 `null`(缺失即自动分配)
- 兼容字段:`dest/dst/target/targets`、`listen_port/listenPort/port/in_port/inPort`、`name/forward_name/forwardName`
- `dest` 支持数组或逗号分隔字符串,统一归一化
- 导入 UI 文案已同步更新(强调按所选隧道导入 + 端口可省略)
- 修改 `vite-frontend/src/pages/forward.tsx:4623`、`vite-frontend/src/pages/forward.tsx:4699`
- 测试已补齐并通过
- 修改 `vite-frontend/src/pages/forward/import-format.test.ts`
- 新增用例:缺失端口自动分配、别名字段兼容、`inPort: null` 映射
- 计划文档已新增并完成勾选
- `plans/002-ny-import-tunnel-selection-compat.md`
验证结果:
- `npm run build`(`vite-frontend`)通过
- `node --test src/pages/forward/import-format.test.ts` 7/7 通过
如果你要,我下一步可以直接帮你提交一个规范 commit。
File diff suppressed because one or more lines are too long
@@ -0,0 +1,5 @@
提交全部变更并且push,创建pr合并,发布新tag,alpha版本
---
不对,撤销tag,发布2.1.7-beta1
@@ -0,0 +1,3 @@
已完成:
- 删除标签 `2.1.8-alpha1`(本地+远程)
- 创建并推送标签 `2.1.7-beta1` 到 `origin/main`
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
提交全部变更并且push,创建pr合并,发布新tag,alpha版本
@@ -0,0 +1,13 @@
完成!
**总结:**
- ✅ 提交变更:`feat: add ny format support for forward import with node-based tunnel matching`
- ✅ 推送到远程分支 `opencode/mighty-nebula`
- ✅ 创建 PR #250 并自动合并到 main
- ✅ 发布新 tag `2.1.7-alpha9`
**新版本特性:**
- 新增 ny 格式转发数据导入支持(JSON格式,多目标地址负载均衡)
- 入口节点选择功能,自动匹配端口转发类型隧道
- 多隧道匹配时提供选择界面
- 新增 import-format.ts 解析模块及测试文件
@@ -0,0 +1,49 @@
# Session Context
Session ID: ses_34d7fcdb8ffekb7lvyJwVvoS8T
Commit Message: 增加功能:转发规则批量导入格式,兼容ny的导入格式
ny格式如下:
{"dest":["151.241.129.52:23609"],"list
## Prompts
### Prompt 1
增加功能:转发规则批量导入格式,兼容ny的导入格式
ny格式如下:
{"dest":["151.241.129.52:23609"],"listen_port":20224,"name":"灵玥-JP-Lpt【三网通用】"}{"dest":["64.81.33.2:24577"],"listen_port":41034,"name":"Yolo-US-Lpt【三网通用】"}
ny导入的时候是选择入口的,flvx转发导入是选择隧道的,需要兼容一下,请设计计划
## Summary
计划文档已设计完成。以下是计划摘要:
## 计划摘要
### 格式对比
| 特性 | flvx格式 | ny格式 |
|------|----------|--------|
| 格式 | 管道分隔文本 | 紧凑JSON对象 |
| 示例 | `ip:port\|name\|port` | `{"dest":["ip:port"],"listen_port":port,"name":"name"}` |
| 多目标 | 逗号分隔 | dest数组 |
| 选择器 | 选择隧道 | 选择入口节点→匹配隧道 |
### 核心设计
1. **格式选择器**:手动选择"flvx格式"或"ny格式"
2. **ny格式流程**:选择入口节点 → 匹配端口转发隧道 → 匹配0个报错、1个直接用、多个弹窗选
3. **不自动创建隧道**:无匹配时提示用户先创建
### 任务清单
1. 新增`importFormat`、`selectedEntryNode`、`matchedTunnels`等状态
2. 重构导入模态框UI,添加格式选择器
3. 实现ny格式紧凑JSON解析函数
4. 实现入口节点选择与隧道匹配逻辑
5. 多隧道匹配时的选择器弹窗
6. 整合ny格式到`executeImport`函数
7. 更新提示文案
### 改动范围
- `vite-frontend/src/pages/forward.tsx` - 主要改动文件
是否需要我调整计划内容?
File diff suppressed because one or more lines are too long
@@ -0,0 +1,5 @@
增加功能:转发规则批量导入格式,兼容ny的导入格式
ny格式如下:
{"dest":["151.241.129.52:23609"],"listen_port":20224,"name":"灵玥-JP-Lpt【三网通用】"}{"dest":["64.81.33.2:24577"],"listen_port":41034,"name":"Yolo-US-Lpt【三网通用】"}
ny导入的时候是选择入口的,flvx转发导入是选择隧道的,需要兼容一下,请设计计划
@@ -0,0 +1,30 @@
计划文档已设计完成。以下是计划摘要:
## 计划摘要
### 格式对比
| 特性 | flvx格式 | ny格式 |
|------|----------|--------|
| 格式 | 管道分隔文本 | 紧凑JSON对象 |
| 示例 | `ip:port\|name\|port` | `{"dest":["ip:port"],"listen_port":port,"name":"name"}` |
| 多目标 | 逗号分隔 | dest数组 |
| 选择器 | 选择隧道 | 选择入口节点→匹配隧道 |
### 核心设计
1. **格式选择器**:手动选择"flvx格式"或"ny格式"
2. **ny格式流程**:选择入口节点 → 匹配端口转发隧道 → 匹配0个报错、1个直接用、多个弹窗选
3. **不自动创建隧道**:无匹配时提示用户先创建
### 任务清单
1. 新增`importFormat`、`selectedEntryNode`、`matchedTunnels`等状态
2. 重构导入模态框UI,添加格式选择器
3. 实现ny格式紧凑JSON解析函数
4. 实现入口节点选择与隧道匹配逻辑
5. 多隧道匹配时的选择器弹窗
6. 整合ny格式到`executeImport`函数
7. 更新提示文案
### 改动范围
- `vite-frontend/src/pages/forward.tsx` - 主要改动文件
是否需要我调整计划内容?
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
提交全部变更并且push,创建pr合并,发布新tag,alpha版本
@@ -0,0 +1,6 @@
✅ 完成:
- **提交**: `fix: use configured connectIp for tunnel chain diagnosis` (1c10347)
- **PR**: #248 已合并 → https://github.com/Sagit-chu/flvx/pull/248
- **Tag**: `2.1.7-alpha8` 已创建并推送
变更内容:修复了隧道链诊断时使用配置的 connectIp、forward 绑定 IP 支持带端口的地址、添加了全面的测试覆盖。
@@ -0,0 +1,24 @@
# Session Context
Session ID: ses_34dfc44d5ffedfgo4G9wPONyXC
Commit Message: 在agent.md里规定,每次计划都必须写一个计划文档,md格式,按序号增加和以计划的总结命名,每次完成一个任务做好标记
## Prompts
### Prompt 1
在agent.md里规定,每次计划都必须写一个计划文档,md格式,按序号增加和以计划的总结命名,每次完成一个任务做好标记
## Summary
已按你的要求更新完成。
我在 `AGENTS.md` 里新增了 `## PLAN DOCUMENT RULE` 章节,内容包括:
- 每次新实现计划都必须有独立 Markdown 计划文档
- 计划文档统一放在 `plans/` 目录
- 文件名采用递增序号 + 计划摘要:`NNN-<plan-summary>.md`
- 序号必须每次 +1
- 文档内使用任务清单,并在每个任务完成后立即打勾标记
修改位置:`AGENTS.md`
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
在agent.md里规定,每次计划都必须写一个计划文档,md格式,按序号增加和以计划的总结命名,每次完成一个任务做好标记
@@ -0,0 +1,11 @@
已按你的要求更新完成。
我在 `AGENTS.md` 里新增了 `## PLAN DOCUMENT RULE` 章节,内容包括:
- 每次新实现计划都必须有独立 Markdown 计划文档
- 计划文档统一放在 `plans/` 目录
- 文件名采用递增序号 + 计划摘要:`NNN-<plan-summary>.md`
- 序号必须每次 +1
- 文档内使用任务清单,并在每个任务完成后立即打勾标记
修改位置:`AGENTS.md`
@@ -0,0 +1,71 @@
# Session Context
Session ID: ses_34dfda207ffeiBV2rCgJW708ip
Commit Message: 配置下发也没兼容,请全量检查一下,哪些功能需要一起改造
## Prompts
### Prompt 1
211 任务的没有完全完成1. 选择IP后诊断还会诊断默认IP
2. 选择隧道出口IP后,入口还是会链接默认IP,没有链接选择的IP
请分析后制定修复计划
### Prompt 2
配置下发也没兼容,请全量检查一下,哪些功能需要一起改造
## Summary
你提得很对,我按“配置下发全链路”重新过了一遍(只读分析)。结论是:**需要一起改造的不是一个点,而是“诊断链路 + 重部署链路 + 回归测试链路”**。
目前状态可以分成三类:
- **已兼容(创建/更新时下发)**
- 隧道创建/更新时,`connectIp` 已进入运行时下发选择逻辑(`selectTunnelDialHost`)。
- 本地/联邦 runtime apply 都会吃 `target.ConnectIP`(前提是 state 里有值)。
- 参考:`go-backend/internal/http/handler/mutations.go:2588`, `go-backend/internal/http/handler/mutations.go:2348`
- **未兼容(你反馈的核心问题)**
- 诊断链路未传 `connectIp`,导致总走默认IP。
- 参考:`go-backend/internal/http/handler/control_plane.go:75`, `go-backend/internal/http/handler/control_plane.go:1102`
- **半兼容(配置重建时丢字段)**
- 重部署时从 DB 重建 runtime state,**没把 `ConnectIP` 带回去**,所以 redeploy 后会回退默认IP。
- 参考:`go-backend/internal/http/handler/mutations.go:883`, `go-backend/internal/http/handler/mutations.go:897`
---
**需要一起改造的功能范围(建议一次性做完)**
- `诊断(非流式 + 流式)`
- 隧道诊断、转发诊断都要改(共用 `prepare*Diagnosis` + `appendChainHopDiagnosis`)。
- 流式 start 预览项也要改,否则 UI 一开始仍显示默认IP。
- 目标文件:`go-backend/internal/http/handler/control_plane.go`, `go-backend/internal/http/handler/diagnosis_stream.go`
- `配置下发(重部署路径)`
- 单条重部署、批量重部署都依赖 `reconstructTunnelState`,必须补 `ConnectIP` 回填。
- 目标文件:`go-backend/internal/http/handler/mutations.go`
- `联邦节点运行时下发一致性`
- 逻辑本身已支持 `ConnectIP`,但受上一步 state 丢字段影响;修复后自动恢复一致。
- 重点验证:remote middle hop `ApplyRole.Targets` 的 Host 选取。
- `回归测试`
- 新增诊断用例:选了 `connectIp` 后,`targetIp` 必须是选中值(tunnel/forward + stream start/item)。
- 新增重部署用例:redeploy 后仍使用 `connectIp`,不回退默认IP。
- 目标文件建议:`go-backend/tests/contract/diagnosis_contract_test.go`,补 handler 级或 contract 级 redeploy 用例。
---
**实施计划(修复包)**
1. 修 `diagnosis` 调用链:所有 `resolveChainProbeTarget` 调用传入 `workItem.toNode.ConnectIP`。
2. 修 `reconstructTunnelState`:出口节点和中继节点都回填 `ConnectIP`。
3. 补测试:覆盖“诊断用选中IP”“重部署不丢IP”“connectIp为空仍走默认”的三组场景。
4. 联调验证:创建/更新、诊断、单重部署、批量重部署、联邦节点场景各跑一遍。
---
我建议按这个范围做成一次完整修复(避免只修诊断后你再次遇到“重部署又回退”的问题)。
如果你同意,我下一步就按这个“全量改造范围”进入实施。
File diff suppressed because one or more lines are too long
@@ -0,0 +1,7 @@
211 任务的没有完全完成1. 选择IP后诊断还会诊断默认IP
2. 选择隧道出口IP后,入口还是会链接默认IP,没有链接选择的IP
请分析后制定修复计划
---
配置下发也没兼容,请全量检查一下,哪些功能需要一起改造
@@ -0,0 +1,52 @@
你提得很对,我按“配置下发全链路”重新过了一遍(只读分析)。结论是:**需要一起改造的不是一个点,而是“诊断链路 + 重部署链路 + 回归测试链路”**。
目前状态可以分成三类:
- **已兼容(创建/更新时下发)**
- 隧道创建/更新时,`connectIp` 已进入运行时下发选择逻辑(`selectTunnelDialHost`)。
- 本地/联邦 runtime apply 都会吃 `target.ConnectIP`(前提是 state 里有值)。
- 参考:`go-backend/internal/http/handler/mutations.go:2588`, `go-backend/internal/http/handler/mutations.go:2348`
- **未兼容(你反馈的核心问题)**
- 诊断链路未传 `connectIp`,导致总走默认IP。
- 参考:`go-backend/internal/http/handler/control_plane.go:75`, `go-backend/internal/http/handler/control_plane.go:1102`
- **半兼容(配置重建时丢字段)**
- 重部署时从 DB 重建 runtime state,**没把 `ConnectIP` 带回去**,所以 redeploy 后会回退默认IP。
- 参考:`go-backend/internal/http/handler/mutations.go:883`, `go-backend/internal/http/handler/mutations.go:897`
---
**需要一起改造的功能范围(建议一次性做完)**
- `诊断(非流式 + 流式)`
- 隧道诊断、转发诊断都要改(共用 `prepare*Diagnosis` + `appendChainHopDiagnosis`)。
- 流式 start 预览项也要改,否则 UI 一开始仍显示默认IP。
- 目标文件:`go-backend/internal/http/handler/control_plane.go`, `go-backend/internal/http/handler/diagnosis_stream.go`
- `配置下发(重部署路径)`
- 单条重部署、批量重部署都依赖 `reconstructTunnelState`,必须补 `ConnectIP` 回填。
- 目标文件:`go-backend/internal/http/handler/mutations.go`
- `联邦节点运行时下发一致性`
- 逻辑本身已支持 `ConnectIP`,但受上一步 state 丢字段影响;修复后自动恢复一致。
- 重点验证:remote middle hop `ApplyRole.Targets` 的 Host 选取。
- `回归测试`
- 新增诊断用例:选了 `connectIp` 后,`targetIp` 必须是选中值(tunnel/forward + stream start/item)。
- 新增重部署用例:redeploy 后仍使用 `connectIp`,不回退默认IP。
- 目标文件建议:`go-backend/tests/contract/diagnosis_contract_test.go`,补 handler 级或 contract 级 redeploy 用例。
---
**实施计划(修复包)**
1. 修 `diagnosis` 调用链:所有 `resolveChainProbeTarget` 调用传入 `workItem.toNode.ConnectIP`。
2. 修 `reconstructTunnelState`:出口节点和中继节点都回填 `ConnectIP`。
3. 补测试:覆盖“诊断用选中IP”“重部署不丢IP”“connectIp为空仍走默认”的三组场景。
4. 联调验证:创建/更新、诊断、单重部署、批量重部署、联邦节点场景各跑一遍。
---
我建议按这个范围做成一次完整修复(避免只修诊断后你再次遇到“重部署又回退”的问题)。
如果你同意,我下一步就按这个“全量改造范围”进入实施。
File diff suppressed because it is too large Load Diff
@@ -0,0 +1 @@
提交全部变更并且push,创建pr合并,发布新tag,alpha版本
@@ -0,0 +1,10 @@
已完成:
1. **提交**: `fix: apply custom IP binding to forward and tunnel chain services` (e383359)
2. **PR**: [#247](https://github.com/Sagit-chu/flvx/pull/247) - 已合并
3. **Tag**: `2.1.7-alpha7` 已创建并推送
新功能:
- 自定义 IP 绑定支持(节点、隧道、转发)
- 转发列表紧凑模式与隧道组折叠/排序
- 迁移测试增强
@@ -0,0 +1,40 @@
# Session Context
Session ID: ses_34e68d081ffeyr3uWQwm5venHp
Commit Message: 实施
## Prompts
### Prompt 1
211任务中,如果选择了指定的入口IP或者出口IP,在节点上应该只监听这个IP地址,而不再是[::],请检查
### Prompt 2
connectIp 同时用于“上游拨号目标 + 本节点监听绑定”
### Prompt 3
实施
## Summary
已实施完成,并且按你确认的语义实现为:`connectIp` 同时用于“上游拨号目标 + 本节点监听绑定”。
- 转发服务下发现在会优先使用 `forward_port.in_ip` 作为监听地址,不再固定用节点默认 `[::]`。
- 隧道服务下发现在会优先使用 `connectIp` 作为监听地址;为空时才回退到节点默认监听地址。
- IPv6 监听地址统一通过 `processServerAddress(...)` 处理,确保带方括号格式正确。
改动位置:
- `go-backend/internal/http/handler/control_plane.go:284`
- `go-backend/internal/http/handler/control_plane.go:1306`
- `go-backend/internal/http/handler/mutations.go:2646`
新增测试:
- `go-backend/internal/http/handler/control_plane_test.go:69`
- `go-backend/internal/http/handler/control_plane_test.go:86`
- `go-backend/internal/http/handler/dual_stack_test.go:33`
- `go-backend/internal/http/handler/dual_stack_test.go:49`
验证结果:
- 已运行 `go test ./internal/http/handler/...`,全部通过。
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
211任务中,如果选择了指定的入口IP或者出口IP,在节点上应该只监听这个IP地址,而不再是[::],请检查
---
connectIp 同时用于“上游拨号目标 + 本节点监听绑定”
---
实施
@@ -0,0 +1,19 @@
已实施完成,并且按你确认的语义实现为:`connectIp` 同时用于“上游拨号目标 + 本节点监听绑定”。
- 转发服务下发现在会优先使用 `forward_port.in_ip` 作为监听地址,不再固定用节点默认 `[::]`。
- 隧道服务下发现在会优先使用 `connectIp` 作为监听地址;为空时才回退到节点默认监听地址。
- IPv6 监听地址统一通过 `processServerAddress(...)` 处理,确保带方括号格式正确。
改动位置:
- `go-backend/internal/http/handler/control_plane.go:284`
- `go-backend/internal/http/handler/control_plane.go:1306`
- `go-backend/internal/http/handler/mutations.go:2646`
新增测试:
- `go-backend/internal/http/handler/control_plane_test.go:69`
- `go-backend/internal/http/handler/control_plane_test.go:86`
- `go-backend/internal/http/handler/dual_stack_test.go:33`
- `go-backend/internal/http/handler/dual_stack_test.go:49`
验证结果:
- 已运行 `go test ./internal/http/handler/...`,全部通过。
File diff suppressed because it is too large Load Diff
@@ -0,0 +1 @@
提交全部变更并且push,创建pr合并,发布新tag,alpha版本
@@ -0,0 +1,5 @@
✅ 完成!
- 提交: `9cf9f4f` (feat: add comprehensive migration test for legacy columns)
- PR: [#245](https://github.com/Sagit-chu/flvx/pull/245) 已合并
- 新 tag: `2.1.7-alpha6` 已发布
@@ -0,0 +1,20 @@
# Session Context
Session ID: ses_34ebc12c1ffePWN7yC0z9iz5Lw
Commit Message: 合并pr,然后发布新tag,alpha版本
## Prompts
### Prompt 1
提交全部变更并且push
### Prompt 2
合并pr,然后发布新tag,alpha版本
## Summary
已完成:
- PR #244 已合并到 main
- 新 tag `2.1.7-alpha5` 已创建并推送
File diff suppressed because one or more lines are too long
@@ -0,0 +1,5 @@
提交全部变更并且push
---
合并pr,然后发布新tag,alpha版本
@@ -0,0 +1,3 @@
已完成:
- PR #244 已合并到 main
- 新 tag `2.1.7-alpha5` 已创建并推送
@@ -0,0 +1,44 @@
# Session Context
Session ID: ses_34ec18cadffeoVVSjfPXGJaxBu
Commit Message: 再做一轮“跨表全量列对比(model vs 旧库补列逻辑)
## Prompts
### Prompt 1
211任务全量再逐一确认一下是否全部完成,并且功能完成
### Prompt 2
添加额外ip的时候报错:SQL logic error: no such column: extra_ips (1)
### Prompt 3
全量排查一下还有没有类似的bug
### Prompt 4
再做一轮“跨表全量列对比(model vs 旧库补列逻辑)
## Summary
已完成这一轮“跨表全量列对比(model vs 旧库补列逻辑)”,并做了可执行验证。
我做了什么:
- 对比了 `model.Node` / `model.Tunnel` 字段与 `prepareSQLiteLegacyColumns` 的补列清单。
- 结论:
- `Node` 目前应补的历史增量列:`server_ip_v4`, `server_ip_v6`, `extra_ips`, `tcp_listen_addr`, `udp_listen_addr`, `inx`, `is_remote`, `remote_url`, `remote_token`, `remote_config`
- `Tunnel` 应补:`inx`, `ip_preference`
- 我已把这个对齐结果固化为回归测试,新增了一个“更老版本库”场景验证:
- 新测试:`TestOpenMigratesVeryLegacyNodeAndTunnelColumns`
- 文件:`go-backend/tests/contract/migration_contract_test.go`
- 该测试从极简旧表结构启动,验证上述所有列都会被自动补齐。
- 测试结果:通过
- `go test ./tests/contract -run "TestOpenMigratesLegacyNodeDualStackColumns|TestOpenMigratesVeryLegacyNodeAndTunnelColumns"`
最终结论(本轮排查范围内):
- **Node/Tunnel 这条旧库升级链路已对齐且有测试兜底**。
- 你这类 “no such column” 的同类风险,针对这两个核心表已经基本封住。
File diff suppressed because one or more lines are too long
@@ -0,0 +1,13 @@
211任务全量再逐一确认一下是否全部完成,并且功能完成
---
添加额外ip的时候报错:SQL logic error: no such column: extra_ips (1)
---
全量排查一下还有没有类似的bug
---
再做一轮“跨表全量列对比(model vs 旧库补列逻辑)
@@ -0,0 +1,19 @@
已完成这一轮“跨表全量列对比(model vs 旧库补列逻辑)”,并做了可执行验证。
我做了什么:
- 对比了 `model.Node` / `model.Tunnel` 字段与 `prepareSQLiteLegacyColumns` 的补列清单。
- 结论:
- `Node` 目前应补的历史增量列:`server_ip_v4`, `server_ip_v6`, `extra_ips`, `tcp_listen_addr`, `udp_listen_addr`, `inx`, `is_remote`, `remote_url`, `remote_token`, `remote_config`
- `Tunnel` 应补:`inx`, `ip_preference`
- 我已把这个对齐结果固化为回归测试,新增了一个“更老版本库”场景验证:
- 新测试:`TestOpenMigratesVeryLegacyNodeAndTunnelColumns`
- 文件:`go-backend/tests/contract/migration_contract_test.go`
- 该测试从极简旧表结构启动,验证上述所有列都会被自动补齐。
- 测试结果:通过
- `go test ./tests/contract -run "TestOpenMigratesLegacyNodeDualStackColumns|TestOpenMigratesVeryLegacyNodeAndTunnelColumns"`
最终结论(本轮排查范围内):
- **Node/Tunnel 这条旧库升级链路已对齐且有测试兜底**。
- 你这类 “no such column” 的同类风险,针对这两个核心表已经基本封住。
@@ -0,0 +1,14 @@
# Session Context
Session ID: ses_34eec2495ffeJvDq7SlEs8mRoH
Commit Message: 提交全部变更并且push,创建pr
## Prompts
### Prompt 1
提交全部变更并且push,创建pr
## Summary
已提交并推送,PR已创建: https://github.com/Sagit-chu/flvx/pull/new/opencode/mighty-nebula
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
提交全部变更并且push,创建pr
@@ -0,0 +1 @@
已提交并推送,PR已创建: https://github.com/Sagit-chu/flvx/pull/new/opencode/mighty-nebula
@@ -0,0 +1,14 @@
# Session Context
Session ID: ses_34f0fe1d2ffeH3PJRyokYati7T
Commit Message: 把main更新到本分支
## Prompts
### Prompt 1
把main更新到本分支
## Summary
已完成 `origin/main` 合并到当前分支(Fast-forward)。之前的更改已恢复,`forward.tsx` 自动合并成功。
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
把main更新到本分支
@@ -0,0 +1 @@
已完成 `origin/main` 合并到当前分支(Fast-forward)。之前的更改已恢复,`forward.tsx` 自动合并成功。
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
探索节点API和数据访问层的完整实现:
1. 在 `go-backend/internal/store/repo/` 查找节点创建/更新的函数
2. 查找节点数据如何返回给前端(JSON序列化)
3. 查找 `nodeRecord` 结构体的定义和使用
4. 理解 ServerIP/ServerIPV4/ServerIPV6 字段如何被处理
返回:
- 节点CRUD相关的Repository方法
- 节点数据返回给前端的格式
- 扩展节点IP字段需要改动的位置
@@ -0,0 +1,215 @@
Based on my thorough exploration, here's a comprehensive analysis of the node API and data access layer:
---
## 节点API和数据访问层完整分析
### 1. 节点CRUD相关Repository方法
#### 核心方法 (`go-backend/internal/store/repo/`)
| 方法 | 文件位置 | 功能 |
|------|----------|------|
| `CreateNode()` | `repository_mutations.go:199` | 创建节点,处理 serverIP/serverIPV4/serverIPV6 |
| `UpdateNode()` | `repository_mutations.go:241` | 更新节点,包含所有IP字段 |
| `DeleteNodeCascade()` | `repository_mutations.go:299` | 级联删除节点(关联 ForwardPort、ChainTunnel、FederationTunnelBinding) |
| `GetNodeByID()` | `repository.go:555` | 通过ID获取节点 |
| `GetNodeBySecret()` | `repository.go:540` | 通过Secret获取节点 |
| `GetNodeStatusFields()` | `repository_mutations.go:229` | 获取节点状态字段 |
| `GetNodeSecret()` | `repository_mutations.go:263` | 获取节点密钥 |
| `GetNodeRemoteFields()` | `repository_mutations.go:317` | 获取远程节点字段 |
| `GetNodePortRange()` | `repository_mutations.go:336` | 获取节点端口范围 |
| `UpdateNodeOrder()` | `repository_mutations.go:287` | 更新节点排序 |
| `UpdateNodeOnline()` | `repository.go:570` | 更新节点在线状态 |
| `UpdateNodeStatus()` | `repository.go:580` | 更新节点状态 |
| `ListNodes()` | `repository.go:625` | 列出所有节点(返回JSON map格式) |
| `GetNodeRecord()` | `repository_control.go:131` | 获取 NodeRecord 视图对象 |
| `CreateRemoteNode()` | `repository_federation.go:266` | 创建远程节点(联邦场景) |
| `exportNodes()` | `repository.go:1660` | 导出节点数据(用于备份) |
| `importNodes()` | `repository.go:2016` | 导入节点数据(用于恢复) |
---
### 2. 节点数据结构定义
#### GORM模型 (`model.Node` - 数据库存储)
**文件:** `/go-backend/internal/store/model/model.go:59-82`
```go
type Node struct {
ID int64 `gorm:"primaryKey;autoIncrement"`
Name string `gorm:"type:varchar(100);not null"`
Secret string `gorm:"type:varchar(100);not null"`
ServerIP string `gorm:"column:server_ip;type:varchar(100);not null"`
ServerIPV4 sql.NullString `gorm:"column:server_ip_v4;type:varchar(100)"` // 注意:V大写
ServerIPV6 sql.NullString `gorm:"column:server_ip_v6;type:varchar(100)"`
// ... 其他字段
}
```
#### 控制平面视图 (`model.NodeRecord`)
**文件:** `/go-backend/internal/store/model/model.go:515-531`
```go
type NodeRecord struct {
ID int64
Name string
ServerIP string
ServerIPv4 string // 注意:v小写
ServerIPv6 string
Status int
PortRange string
// ... 其他字段
}
```
#### JSON导出格式 (`model.NodeBackup`)
**文件:** `/go-backend/internal/store/model/model.go:333-356`
```go
type NodeBackup struct {
ID int64 `json:"id"`
Name string `json:"name"`
ServerIP string `json:"serverIp"`
ServerIPv4 string `json:"serverIpV4,omitempty"`
ServerIPv6 string `json:"serverIpV6,omitempty"`
// ... 其他字段
}
```
#### Handler层别名
**文件:** `/go-backend/internal/http/handler/control_plane.go:25`
```go
type nodeRecord = model.NodeRecord // 类型别名
```
---
### 3. 节点数据返回给前端的格式
#### ListNodes API (`repository.go:625-652`)
```go
// 返回 map[string]interface{} 格式
items = append(items, map[string]interface{}{
"id": n.ID, "inx": n.Inx, "name": n.Name,
"ip": n.ServerIP, "serverIp": n.ServerIP, // ip和serverIp都返回
"serverIpV4": nullableString(n.ServerIPV4),
"serverIpV6": nullableString(n.ServerIPV6),
"port": n.Port,
"tcpListenAddr": n.TCPListenAddr,
"udpListenAddr": n.UDPListenAddr,
"version": nullableString(n.Version),
"http": n.HTTP, "tls": n.TLS, "socks": n.Socks,
"status": n.Status, "isRemote": n.IsRemote,
// ...
})
```
#### API端点
| 端点 | Handler | 功能 |
|------|---------|------|
| `POST /api/v1/node/list` | `h.nodeList` | 列出节点 |
| `POST /api/v1/node/create` | `h.nodeCreate` | 创建节点 |
| `POST /api/v1/node/update` | `h.nodeUpdate` | 更新节点 |
| `POST /api/v1/node/delete` | `h.nodeDelete` | 删除节点 |
---
### 4. ServerIP/ServerIPV4/ServerIPV6 字段处理逻辑
#### 字段命名约定
| 层级 | 字段名 | 数据库列名 |
|------|--------|-----------|
| `model.Node` | `ServerIPV4`, `ServerIPV6` | `server_ip_v4`, `server_ip_v6` |
| `model.NodeRecord` | `ServerIPv4`, `ServerIPv6` | - (内存结构) |
| `model.NodeBackup` | `ServerIPv4`, `ServerIPv6` | - (JSON) |
| 前端JSON | `serverIpV4`, `serverIpV6` | - |
#### 模型转换函数 (`repository_control.go:161-201`)
```go
func nodeRecordFromModel(n *model.Node) *model.NodeRecord {
rec := &model.NodeRecord{
ID: n.ID,
Name: n.Name,
ServerIP: n.ServerIP,
// ...
}
if n.ServerIPV4.Valid {
rec.ServerIPv4 = strings.TrimSpace(n.ServerIPV4.String)
}
if n.ServerIPV6.Valid {
rec.ServerIPv6 = strings.TrimSpace(n.ServerIPV6.String)
}
// ...
}
```
#### Dual-Stack辅助函数 (`mutations.go:2715-2772`)
```go
// 判断节点是否支持IPv4
func nodeSupportsV4(node *nodeRecord) bool {
if strings.TrimSpace(node.ServerIPv4) != "" { return true }
if strings.TrimSpace(node.ServerIPv6) != "" { return false }
// 回退到 ServerIP 判断
legacy := strings.Trim(strings.TrimSpace(node.ServerIP), "[]")
if ip := net.ParseIP(legacy); ip != nil {
return ip.To4() != nil
}
return true
}
// 选择IPv4地址(优先显式字段,回退ServerIP)
func pickNodeAddressV4(node *nodeRecord) string {
if v := strings.TrimSpace(node.ServerIPv4); v != "" { return v }
return strings.TrimSpace(node.ServerIP)
}
```
---
### 5. 扩展节点IP字段需要改动的位置
如果要添加新的IP字段(如 `ServerIPV4Alt`),需要修改以下位置:
#### A. 模型层 (`go-backend/internal/store/model/model.go`)
1. **`model.Node`** - 添加 GORM 字段定义(约第64行)
2. **`model.NodeRecord`** - 添加视图字段(约第520行)
3. **`model.NodeBackup`** - 添加JSON字段(约第338行)
#### B. Repository层 (`go-backend/internal/store/repo/`)
1. **`repository_mutations.go`**
- `CreateNode()` 参数和赋值(约第199-227行)
- `UpdateNode()` 参数和Updates map(约第241-261行)
2. **`repository_control.go`**
- `nodeRecordFromModel()` 转换逻辑(约第161-201行)
3. **`repository_federation.go`**
- `CreateRemoteNode()` 参数和赋值(约第266-294行)
4. **`repository.go`**
- `ListNodes()` JSON返回格式(约第625-652行)
- `exportNodes()` 导出逻辑(约第1660-1700行)
- `importNodes()` 导入逻辑(约第2016-2057行)
- `prepareSQLiteLegacyColumns()` 迁移逻辑(约第263行)
#### C. Handler层 (`go-backend/internal/http/handler/`)
1. **`mutations.go`**
- `nodeCreate()` 请求参数解析(约第234-279行)
- `nodeUpdate()` 请求参数解析(约第281-336行)
- `nodeSupportsV4/V6()` 函数逻辑(约第2715-2772行)
- `pickNodeAddressV4/V6()` 函数逻辑
#### D. 测试层 (`go-backend/tests/contract/`)
所有 contract test 中的 `INSERT INTO node` 语句需要更新字段列表
---
### 关键文件汇总
| 文件 | 用途 |
|------|------|
| `/go-backend/internal/store/model/model.go` | 数据模型定义 |
| `/go-backend/internal/store/repo/repository_mutations.go` | CRUD操作实现 |
| `/go-backend/internal/store/repo/repository_control.go` | 控制平面查询+模型转换 |
| `/go-backend/internal/store/repo/repository_federation.go` | 联邦节点操作 |
| `/go-backend/internal/store/repo/repository.go` | 核心查询+导出导入 |
| `/go-backend/internal/http/handler/mutations.go` | HTTP API处理器 |
| `/go-backend/internal/http/handler/control_plane.go` | 控制平面API |
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
探索隧道链路构建时下一跳连接地址的选择流程:
1. 在 `control_plane.go` 中查找隧道链路构建逻辑
2. 查找 `applyTunnelRuntime` 或类似函数如何向节点发送命令
3. 理解 hop 节点如何连接到下一个节点(连接地址从哪里来)
4. 查找 `ChainTunnel` 表的 `Port` 字段如何被使用
返回:
- 隧道链路配置发送到节点的代码位置
- 下一跳连接地址是如何确定的
- 修改连接地址需要改动的关键位置
@@ -0,0 +1,173 @@
根据我的分析,以下是隧道链路构建时下一跳连接地址选择流程的完整报告:
---
## 隧道链路构建流程分析报告
### 1. 隧道链路配置发送到节点的代码位置
**主函数**: `applyTunnelRuntime()`
- 文件: `go-backend/internal/http/handler/mutations.go`
- 行号: 2454-2521
**核心流程**:
```
applyTunnelRuntime (L2454)
├── 入口节点: 发送 AddChains 命令 (L2474)
├── 跳转节点: 发送 AddChains (L2496) + AddService (L2502) 命令
└── 出口节点: 发送 AddService 命令 (L2514)
```
**配置构建函数**:
| 函数 | 位置 | 作用 |
|------|------|------|
| `buildTunnelChainConfig()` | L2567-2624 | 构建转发链配置 |
| `buildTunnelChainServiceConfig()` | L2626-2652 | 构建服务配置 |
| `selectTunnelDialHost()` | L2654-2699 | **选择下一跳连接地址** |
---
### 2. 下一跳连接地址是如何确定的
**地址选择核心函数**: `selectTunnelDialHost()` (L2654-2699)
```go
// 关键逻辑 (简化版)
func selectTunnelDialHost(fromNode, toNode *nodeRecord, ipPreference string) (string, error) {
// 1. 检测源节点和目标节点的 IPv4/IPv6 支持
fromV4 := nodeSupportsV4(fromNode)
fromV6 := nodeSupportsV6(fromNode)
toV4 := nodeSupportsV4(toNode)
toV6 := nodeSupportsV6(toNode)
// 2. 根据偏好选择地址
switch ipPreference {
case "v6": // 优先 IPv6
if fromV6 && toV6 { return pickNodeAddressV6(toNode) }
if fromV4 && toV4 { return pickNodeAddressV4(toNode) }
case "v4": // 优先 IPv4
if fromV4 && toV4 { return pickNodeAddressV4(toNode) }
if fromV6 && toV6 { return pickNodeAddressV6(toNode) }
default: // 默认优先 IPv4
if fromV4 && toV4 { return pickNodeAddressV4(toNode) }
if fromV6 && toV6 { return pickNodeAddressV6(toNode) }
}
// 3. 不兼容时报错
return "", fmt.Errorf("节点链路不兼容")
}
```
**地址选择优先级** (在 `pickNodeAddressV4/V6` 中, L2755-2773):
- **IPv4**: `ServerIPv4` > `ServerIP` (旧字段)
- **IPv6**: `ServerIPv6` > `ServerIP` (旧字段)
**端口来源** (在 `buildTunnelChainConfig` 中, L2585-2588):
```go
port := target.Port // 来自 ChainTunnel.Port 字段
if port <= 0 {
return nil, errors.New("节点端口不能为空")
}
```
---
### 3. ChainTunnel.Port 字段的使用流程
**数据模型** (`model.go` L127-138):
```go
type ChainTunnel struct {
ID int64
TunnelID int64
ChainType string // "1"=入口, "2"=跳转, "3"=出口
NodeID int64
Port sql.NullInt64 // ★ 连接端口
Strategy sql.NullString
Inx sql.NullInt64 // 跳转序号
Protocol sql.NullString
}
```
**Port 字段流转**:
```
创建隧道时
│
▼
prepareTunnelCreateState (L1970)
├── 出口节点: 从请求读取 port,若为空则调用 PickNodePortTx 自动分配
├── 跳转节点: 从请求读取 port,若为空则调用 PickNodePortTx 自动分配
│
▼
replaceTunnelChainsTx (L2775)
└── CreateChainTunnelTx 写入数据库 (L2809, L2837)
│
▼
读取/重建状态时
│
▼
ListChainNodesForTunnel (repository_control.go L280)
└── 从 chain_tunnel 表读取 Port 字段 (L295)
│
▼
reconstructTunnelState (L845)
└── 将 Port 复制到 tunnelRuntimeNode.Port (L887, L901)
│
▼
buildTunnelChainConfig (L2567)
└── 使用 target.Port 构建连接地址 (L2585)
```
---
### 4. 修改连接地址需要改动的关键位置
如果要修改下一跳连接地址的选择逻辑,需要关注以下位置:
| 修改目标 | 文件 | 行号 | 函数 |
|---------|------|------|------|
| **IP地址选择策略** | `mutations.go` | L2654-2699 | `selectTunnelDialHost()` |
| **IPv4地址提取** | `mutations.go` | L2755-2763 | `pickNodeAddressV4()` |
| **IPv6地址提取** | `mutations.go` | L2765-2773 | `pickNodeAddressV6()` |
| **端口获取** | `mutations.go` | L2585-2588 | `buildTunnelChainConfig()` |
| **端口分配逻辑** | `repository_mutations.go` | ~L459 | `PickNodePortTx()` |
| **端口写入数据库** | `repository_mutations.go` | L398-406 | `CreateChainTunnelTx()` |
| **端口从数据库读取** | `repository_control.go` | L280-343 | `ListChainNodesForTunnel()` |
**关键配置结构**:
```go
// mutations.go L1950-1957
type tunnelRuntimeNode struct {
NodeID int64
Protocol string // 连接协议
Strategy string // 选择策略
Inx int // 跳转序号
ChainType int // 1=入口, 2=跳转, 3=出口
Port int // ★ 连接端口
}
```
---
### 5. 调用链总结
```
用户创建隧道请求
│
▼
tunnelAdd (mutations.go L450)
│
├── prepareTunnelCreateState() ──► 分配端口,构建 state
│
├── replaceTunnelChainsTx() ──► 写入 chain_tunnel 表
│
└── applyTunnelRuntime()
│
├── buildTunnelChainConfig()
│ │
│ ├── selectTunnelDialHost() ──► 选择 IP 地址
│ │
│ └── 使用 target.Port ──► 端口
│
└── sendNodeCommand("AddChains/AddService") ──► 发送到节点
```
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
探索转发创建时入口IP的生成流程:
1. 查找 `buildTunnelInIP` 函数的完整实现
2. 查找 `resolveForwardIngress` 函数的完整实现
3. 理解 `forward_port` 表如何与节点IP关联
4. 查找转发创建API(createForward)如何处理入口端口分配
返回:
- 关键代码片段和行号
- 入口IP是如何从节点信息中提取的
- 修改入口IP需要改动的关键位置
@@ -0,0 +1,185 @@
现在我已经找到了完整的入口IP生成流程。让我整理并返回关键信息:
---
## 入口IP生成流程分析
### 1. `buildTunnelInIP` 函数 (创建/更新隧道时)
**位置**: `go-backend/internal/http/handler/mutations.go:2112-2152`
```go
func buildTunnelInIP(inNodes []tunnelRuntimeNode, nodes map[int64]*nodeRecord, ipPreference string) string {
set := make(map[string]struct{})
ordered := make([]string, 0)
preferV6 := strings.TrimSpace(ipPreference) == "v6"
for _, inNode := range inNodes {
node := nodes[inNode.NodeID]
if node == nil {
continue
}
v4 := strings.TrimSpace(node.ServerIPv4) // 从节点获取 IPv4
v6 := strings.TrimSpace(node.ServerIPv6) // 从节点获取 IPv6
var addrs []string
if preferV6 {
if v6 != "" { addrs = append(addrs, v6) }
if v4 != "" { addrs = append(addrs, v4) }
} else {
if v4 != "" { addrs = append(addrs, v4) }
if v6 != "" { addrs = append(addrs, v6) }
}
if len(addrs) == 0 {
if v := strings.TrimSpace(node.ServerIP); v != "" { // fallback 到 ServerIP
addrs = append(addrs, v)
}
}
// ... 去重后拼接
}
return strings.Join(ordered, ",")
}
```
**调用位置**:
- 隧道创建: `mutations.go:496`
- 隧道更新: `mutations.go:693`
---
### 2. `resolveForwardIngress` 函数 (查询转发时)
**位置**: `go-backend/internal/store/repo/repository.go:2727-2796`
```go
func resolveForwardIngress(db *gorm.DB, forwardID int64, tunnelID int64) (string, sql.NullInt64, error) {
// 1. 首先从 tunnel 表获取 in_ip (由 buildTunnelInIP 生成)
var tunnelInIP sql.NullString
db.Model(&model.Tunnel{}).Select("in_ip").Where("id = ?", tunnelID).Limit(1).Scan(&tunnelInIP)
// 2. 从 forward_port + node 表获取端口和节点IP
type fpRow struct {
Port sql.NullInt64
ServerIP sql.NullString
}
var fpRows []fpRow
err := db.Model(&model.ForwardPort{}).
Select("forward_port.port, node.server_ip").
Joins("LEFT JOIN node ON node.id = forward_port.node_id").
Where("forward_port.forward_id = ?", forwardID).
Order("forward_port.id ASC").
Find(&fpRows).Error
// 3. 组装入口地址
// - 如果 tunnel.in_ip 存在: "ip1:port,ip2:port..."
// - 否则使用 forward_port 关联的 node.server_ip: "ip:port"
// ...
}
```
**调用位置**:
- `repository.go:495` - 用户转发列表
- `repository.go:730` - 管理员转发列表
---
### 3. `forward_port` 表与节点IP关联
**模型定义**: `go-backend/internal/store/model/model.go:50-57`
```go
type ForwardPort struct {
ID int64 `gorm:"primaryKey;autoIncrement"`
ForwardID int64 `gorm:"column:forward_id;not null"`
NodeID int64 `gorm:"column:node_id;not null"` // 关联到 node.id
Port int `gorm:"not null"`
}
```
**关联查询** (在 `resolveForwardIngress` 中):
```sql
SELECT forward_port.port, node.server_ip
FROM forward_port
LEFT JOIN node ON node.id = forward_port.node_id
WHERE forward_port.forward_id = ?
ORDER BY forward_port.id ASC
```
---
### 4. 转发创建API入口分配流程
**入口函数**: `go-backend/internal/http/handler/mutations.go:1108-1194`
```go
func (h *Handler) forwardCreate(w http.ResponseWriter, r *http.Request) {
// 1. 获取隧道入口节点IDs
entryNodes, _ := h.tunnelEntryNodeIDs(tunnelID) // line 1162
// 2. 获取或选择入口端口
port := asInt(req["inPort"], 0)
if port <= 0 {
port = h.pickTunnelPort(tunnelID) // 自动分配端口 (line 1157)
}
// 3. 创建转发记录 + forward_port 记录
forwardID, err := h.repo.CreateForwardTx(..., entryNodes, port, ...) // line 1179
}
```
**`CreateForwardTx`**: `go-backend/internal/store/repo/repository_mutations.go:1171-1209`
```go
func (r *Repository) CreateForwardTx(..., entryNodeIDs []int64, port int, ...) (int64, error) {
// 创建 forward 记录
// 为每个入口节点创建 forward_port 记录
for _, nodeID := range entryNodeIDs {
fp := model.ForwardPort{
ForwardID: forwardID,
NodeID: nodeID, // 入口节点ID
Port: port, // 入口端口
}
tx.Create(&fp)
}
}
```
**入口节点获取**: `repository_mutations.go:535-548`
```go
func (r *Repository) TunnelEntryNodeIDs(tunnelID int64) ([]int64, error) {
// 从 chain_tunnel 表查询 chain_type = 1 (入口) 的节点
r.db.Model(&model.ChainTunnel{}).
Where("tunnel_id = ? AND chain_type = ?", tunnelID, "1").
Order("inx ASC, id ASC").
Pluck("node_id", &ids)
}
```
---
## 关键修改位置
| 需求 | 修改文件 | 行号 | 说明 |
|------|----------|------|------|
| **修改隧道入口IP生成逻辑** | `mutations.go` | 2112-2152 | `buildTunnelInIP` 函数,控制IPv4/IPv6优先级和组合 |
| **修改转发入口IP解析** | `repository.go` | 2727-2796 | `resolveForwardIngress`,控制入口地址格式 |
| **修改端口自动分配** | `mutations.go` | 2901-2964 | `pickTunnelPort`,控制端口范围选择 |
| **修改入口节点关联** | `repository_mutations.go` | 1196-1205 | `CreateForwardTx` 中的 forward_port 创建 |
| **节点IP来源** | `model.go` | 516-531 | `NodeRecord` 结构体 |
| **节点IP存储** | `model.go` | 59-65 | `Node` 模型: `ServerIP`, `ServerIPV4`, `ServerIPV6` |
---
## 入口IP数据流
```
1. 节点注册 → Node表存储 server_ip, server_ip_v4, server_ip_v6
2. 创建隧道:
chain_tunnel (入口节点) → buildTunnelInIP() → tunnel.in_ip 字段
3. 创建转发:
隧道入口节点IDs → forward_port(forward_id, node_id, port)
4. 查询转发入口:
forward_port JOIN node → resolveForwardIngress()
├─ 优先使用 tunnel.in_ip (多IP组合)
└─ 否则用 forward_port 关联的 node.server_ip
```
File diff suppressed because one or more lines are too long
@@ -0,0 +1,16 @@
Explore the codebase to understand how forwarding/tunnel configuration works. I need to find:
1. Frontend: The forwarding edit/create dialog component (likely in vite-frontend/src/)
2. Backend: The forwarding data model and API handlers (likely in go-backend/)
3. How the current "入口端口" (entry port) is handled
Look for:
- Files related to "forward" or "转发" or "tunnel" or "隧道"
- Data models for forwarding rules
- API handlers for creating/editing forwards
Return:
- Key file paths and their purposes
- Current data model structure for forwards
- How the entry listener is currently configured
- Any existing IP-related fields in the model
@@ -0,0 +1,316 @@
// List in frontend display isPort.)?
if (in_ip !== in.re.selected) {
tunnel ip !== node in_tunnel.port_range value
select(v4 or IPv6, and
.chainType = chainType === 1 ( then chain_node !== node to check if `in_ip` is still used:
"chain_node_id" for `chainTunnels.node_id = nodeId, && `chainType != "hop" fields
//
}
}
}
<Select
<div className="flex flex-col gap-4 mt-6">
<Select
isFilterModalOpen={false}
setFilterUserId, filterTunnelId(tunnelId)}
}}
<form.in_port}
:form.in_port !== null,
}}
} else {
setFilterTunnelId}
}
}}
// handleEntryNodeIDs
hop - entry port assignment
const { entryNodeID, entryPort, entry_ip, resolvedFor forwardIn_ip based on
forward data view:
In entity links the node,entry, remote_addr and`]
tdCompose groups
remote nodes by hostname.
`target_addr` is multiple ones, the `targetAddr`/ `name` || `strategy: data in the form, uses the latest text.
`line text: `grid gap-3 group` leading to border. from UI styles
`.sort order`actions`: data
? `no-frontend for/not directly modify forward model
so it doesn't have `inPort` in model.For forward creation.```
const forwardPort = entryNodeIDs with port = 0
are - but tunnels and tunnels have
after:. Based on.
to reach the entry from. specified port-based" entry_ip, `addr_text` field or tunnel IP-based tunnel values with data not used this rules
step pattern is`node-based:`peer` or a`IP_preference` + `ip_preference` header.
"IP_preference from}
`grep<include="*.tsx"" path="/Users/sagit/.local/share/opencode/worktree/13650be91caa3a9e08a2e63127fef62757658384/mighty-nebula/vite-frontend/src/pages/forward.tsx" />
"peer_share" and "federation" share" APIs.
data models
/>
< Frontend> `in_ip` comes from the tunnel, and not the node model.In Go-gost.
. I will specifically look at `port` and `forward_port` data stored in `forward_port` table (` // When editing, forward, the UI keeps the current port value in the `inPort` state is checked for duplicates (`
forwards list ( addresses with multiple addresses.
</div
}
</div>
}
}
}
}
className="flex flex-col gap-4">
{/* form fields - in edit mode */}
</4-form.inPort in field and handleClick save
validation and numbers? `handleEdit` adds the `inPort` to the and `inPort` state.
// handleDragEnd ref={handleDragEnd} to scroll into view}
if (prev.forwardPorts.length === 0) {
// Create new forward
entry with not auto expanded
const inPort records = || const{index` === 0` ? record and `forward_ports` table
const inPort = records = or can be rendered when the to pickTunnelPort: the empty { inPort = null ?} => to persistent if port === 0 ( automatic assignment).
} else {
toast.error("请选择关联隧道")
}
const minPort =
const ports = oldPorts.map((p) => p)) // values from request
// value === 0 means "端口不能为空, else if (!port) {
const inPort = tunnelPorts.map((t) => {
const inIP = tunnel = in_ip
|| t.IP === the default) 'auto' (available, tunnel.ip_preference` || `:` if` in_ip` and `in_port` values ( listenAddr] which`tcp`/udp` addresses are the respectively
`forward` now supports select/un/selected tunnel. when not found ( a single ` address can be shown, and simplified overview.= `tunnel` but has `in_ip` display name="人口入口IP` and "端口转发" when tunnel is port-forward, the model oftrafficRatio` floats with `type` and `protocol` fields.
// `protocol`: 'tls' | 'wss' | 'mtls' | 'mtcp'
for `type` === 1: 繀 端口转发, 2: 隧道转发, and `type` determines the listeners on which forward ( protocol, and exit node ( configuration. Let `traffic_ratio` be on in/out, and the name` tunnelName, in the `UserTunnel` table
var chainType = chainType === "entry" ? # chainType === 2, value for represents entry node id for chain_type === "hop", fields indicate which hop number (1-based, `strategy` on the current value)
? newErrors.inPort = "端口必须在1-65535之间";
form.inPort = optional
required validation in if filled, values to 0 or null, then the port is is auto-assigned
} ValidateForm()
if (validateForm()) {
setErrors(newErrors);
}
}
};
const handleTunnelChange = (tunnelId: string) => {
setForm((prev) => ({ ...prev, tunnelId}));
: if (prev.inPort !== null && prev.inPort !== old, in port assignment will not assign the new port auto
});
}
);
} else {
inPort = null
: options.speedId = speedLimit }
onChange={(selectedKey) => {
setFilter((prev) => ({ ...prev, speedId, speedName }));
}
});
});
setBatchChangeTunnelModalOpen(false);
setBatchChangeTunnelModalOpen(false);
}
</div>
</div>
);
<input
inport}
*/
.tsx
<Input
description="指定入口端口,留空则从节点可用端口中自动分配"
placeholder="留空则自动分配可用端口"
type="number"
variant="bordered"
onChange={(e) => {
const value = e.target.value ? ""
: parseInt(value) || null)
setForm((prev) => ({ ...prev, inPort: null}));
</div>
</div>
<ModalContent>
<ModalHeader className="flex flex-col gap-1">
<h2 className="text-xl font-bold">
{isEdit ? "编辑转发" : "新增转发"}
</h2>
<p className="text-small text-default-500 mt-4">
{isEdit ? "修改现有转发配置的信息" : "创建新的转发配置"}
</p>
<ModalBody>
<div className="space-y-4 pb-4">
<Input
errorMessage={errors.name}
isInvalid={!!errors.name}
label="转发名称"
placeholder="请输入转发名称"
value={form.name}
variant="bordered"
onChange={(e) =>
setForm((prev) => ({ ...prev, name: e.target.value }))
}
/>
{/* Limit速规则选择 */}
<Select
description="限速规则"
placeholder="不限速"
selectedKeys={
selectedSpeedId !== null ? ?[selectedSpeedId.toString()] : []
}
variant="bordered"
onSelectionChange={(keys) => {
const selectedKey = Array.from(keys)[0] as string | undefined;
setForm((prev) => ({
...prev,
speedId: selectedKey ? Number(selectedKey) : null,
});
}}
/>
{/*隧道选择 */}
<Select
description={
isEdit
? "更改隧道将释放原端口并在新隧道分配端口"
: "更改隧道后重新分配端口并同步到节点"
}
}
errorMessage={errors.tunnelId}
isInvalid={!!errors.tunnelId}
label="选择隧道"
placeholder="请选择关联的隧道"
selectedKeys={
form.tunnelId ? [form.tunnelId.toString()] : []
}
variant="bordered"
onSelectionChange={(keys) => {
const selectedKey = Array.from(keys)[0] as string;
if (selectedKey) {
handleTunnelChange(selectedKey);
}
}
/>
{/*入口端口 */}
<Input
description="指定入口端口,留空则从节点可用端口中自动分配"
errorMessage={errors.inPort}
isInvalid={!!errors.inPort}
label="入口端口"
placeholder="留空则自动分配可用端口"
type="number"
value={form.inPort !== null ? form.inPort.toString() : ""}
variant="bordered"
onChange={(e) => {
const value = e.target.value;
setForm((prev) => ({ ...prev, inPort: value ? parseInt(value) : null }));
}
/>
</div>
</ModalBody>
</ModalContent>
</Modal>
</Modal>
);
};
// ===================== Summary of findings ===================
## Key File Paths and their purposes:
### Frontend: Forward Edit/create dialog component
- **Main file:** `/Users/sagit/.local/share/opencode/worktree/13650be91caa3a9e08a2e63127fef62757658384/mighty-nebula/vite-frontend/src/pages/forward.tsx`
- Displays the forwarding list and handles all create/edit/delete/forwards
- Has `inIp` and `inPort` fields
- Shows entry port and dialog/form with validation
- Uses React-hook-form with state management
- Calls `createForward`, `updateForward`, `deleteForward`, `pauseForwardService`, `resumeForwardService`, APIs
- Imports API functions from `@/api`
### Backend: Forwarding data model and API handlers
- **Main model file:** `/Users/sagit/.local/share/opencode/worktree/13650be91caa3a9e08a2e63127fef62757658384/mighty-nebula/go-backend/internal/store/model/model.go`
- GORM model definition for `Forward` struct does basic forwarding configuration
- Related models: `ForwardPort`, `Tunnel`, `UserForwardDetail` (view struct)
- **API handlers:** `/Users/sagit/.local/share/opencode/worktree/13650be91caa3a9e08a2e63127fef62757658384/mighty-nebula/go-backend/internal/http/handler/mutations.go`
- Create/update/delete operations
- Entry port handling via `inPort` field
- **Repository layer:** `/Users/sagit/.local/share/opencode/worktree/13650be91caa3a9e08a2e63127fef62757658384/mighty-nebula/go-backend/internal/store/repo/repository_mutations.go`
- CRUD operations for - `resolveForwardIngress` function in `/Users/sagit/.local/share/opencode/worktree/13650be91caa3a9e08a2e63127fef62757658384/mighty-nebula/go-backend/internal/store/repo/repository.go`
- Computes `inIp` and `inPort` from joins
### Current data model structure for forwards
From `go-backend/internal/store/model/model.go`:
```go
// Forward maps to the "forward" table.
type Forward struct {
ID int64 `gorm:"primaryKey;autoIncrement"`
UserID int64 `gorm:"column:user_id;not null"`
UserName string `gorm:"column:user_name;type:varchar(100);not null"`
Name string `gorm:"type:varchar(100);not null"`
TunnelID int64 `gorm:"column:tunnel_id;not null"`
RemoteAddr string `gorm:"column:remote_addr;type:text;not null"`
Strategy string `gorm:"type:varchar(100);not null;default:'fifo'"`
InFlow int64 `gorm:"not null;default:0"`
OutFlow int64 `gorm:"column:out_flow;not null;default:0"`
CreatedTime int64 `gorm:"column:created_time;not null"`
UpdatedTime int64 `gorm:"column:updated_time;not null"`
Status int `gorm:"not null"`
Inx int `gorm:"not null;default:0"`
SpeedID sql.NullInt64 `gorm:"column:speed_id"`
}
```
```go
// ForwardPort maps to the "forward_port" table - stores port assignments per entry node
type ForwardPort struct {
ID int64 `gorm:"primaryKey;autoIncrement"`
ForwardID int64 `gorm:"column:forward_id;not null"`
NodeID int64 `gorm:"column:node_id;not null"`
Port int `gorm:"not null"`
}
```
```go
// Tunnel maps to the "tunnel" table - has entry IP configuration
type Tunnel struct {
ID int64 `gorm:"primaryKey;autoIncrement"`
Name string `gorm:"type:varchar(100);not null"`
TrafficRatio float64 `gorm:"column:traffic_ratio;not null;default:1.0"`
Type int `gorm:"not null"`
Protocol string `gorm:"type:varchar(10);not null;default:'tls'"`
Flow int64 `gorm:"not null"`
CreatedTime int64 `gorm:"column:created_time;not null"`
UpdatedTime int64 `gorm:"column:updated_time;not null"`
Status int `gorm:"not null"`
InIP sql.NullString `gorm:"column:in_ip;type:text"` // Optional entry IP hint
Inx int `gorm:"not null;default:0"`
IPPreference string `gorm:"column:ip_preference;type:varchar(10);not null;default:''"`
}
```
### How entry listener is currently configured:
1. **Port Storage**: `ForwardPort` table stores the mapping from `forward_id` -> `node_id` -> `port`
- Port is assigned by the handler or passed via `inPort` parameter ( or auto-picked)
- Entry nodes are determined by `tunnelEntryNodeIDs()` in handler
3. **Entry IP Resolution**: The `resolveForwardIngress()` function resolves `inIp` and `inPort` by:
- Joining `forward_port` with `node` table
- `inIp` comes from `tunnel.in_ip` if set (takes precedence over node.server_ip)
- For multi-entry-node forwards, comma-separated IPs and ports are returned
4. **Current IP-related fields**:
- `Forward` model: No `inIp` field (port is stored in `forward_port` table)
- `Tunnel` model: Has `InIP` field (nullable, - allows specifying of a preferred entry IP hint
- `UserForwardDetail` view struct ( joins tunnel table and includes `InIP` and `InPort`
5. **No explicit entry IP selection UI in current dialog** - The port field is a text input, and form validates range but but UI doesn't allow setting specific IP addresses
File diff suppressed because one or more lines are too long
@@ -0,0 +1,10 @@
总结一下这个issue,结合当前代码,尽量设计简约实现issue的目标
https://github.com/Sagit-chu/flvx/issues/211
---
应该在节点上的高级里面允许添加多个IP
---
继续,允许在节点管理里填写多个地址,然后在组成隧道或者转发的时候选择节点的时候允许选择具体的ip,请开始设计,允许使用并行subagent
@@ -0,0 +1,76 @@
明白了!更新设计:
---
## 最终设计方案
### 核心需求
| 场景 | 配置位置 | 选择内容 |
|------|----------|----------|
| 转发 | 转发创建/编辑 | 入口监听IP(从入口节点IP列表选择) |
| 隧道 | 隧道配置 | 出口节点连接IP(从出口节点IP列表选择) |
---
### 数据模型变更(3处)
```
Node.ExtraIPs sql.NullString `gorm:"column:extra_ips;type:text"` // 逗号分隔
ForwardPort.InIP sql.NullString `gorm:"column:in_ip;type:text"` // 指定监听IP
ChainTunnel.ConnectIP sql.NullString `gorm:"column:connect_ip;type:text"` // 出口连接IP
```
---
### 改动清单
#### 后端 (约200行)
| 文件 | 改动 |
|------|------|
| `model/model.go` | Node/ForwardPort/ChainTunnel 增加3个字段 |
| `repository_mutations.go` | CreateNode/UpdateNode 处理 extraIPs 参数 |
| `repository_control.go` | GetNodeRecord/ListNodeAllIPs 辅助函数 |
| `repository.go` | resolveForwardIngress 使用 forward_port.in_ip |
| `handler/mutations.go` | selectTunnelDialHost 优先使用 connectIP |
#### 前端 (约150行)
| 页面 | 改动 |
|------|------|
| 节点编辑 | 高级配置增加"额外IP" Input(逗号分隔) |
| 转发编辑 | 入口端口旁增加"监听IP" Select(从入口节点IP选择) |
| 隧道配置 | 出口节点行增加"连接IP" Select(从出口节点IP选择) |
---
### UI 示意
**节点编辑 - 高级配置**
```
额外IP地址
┌──────────────────────────────────────────┐
│ 192.168.1.100, 10.0.0.5 │
└──────────────────────────────────────────┘
用于多IP服务器,逗号分隔
```
**转发创建**
```
入口端口: [ 8080 ] 监听IP: [ 192.168.1.100 ▼ ]
├─ 203.0.113.10 (默认)
├─ 192.168.1.100
└─ 10.0.0.5
```
**隧道配置 - 出口节点**
```
出口节点: [ node-1 ▼ ] 端口: [ 8443 ] 连接IP: [ 10.0.0.5 ▼ ]
├─ 203.0.113.10 (默认)
└─ 10.0.0.5
```
---
这个方案简约清晰,是否可以开始实现?
+4
View File
@@ -0,0 +1,4 @@
{
"enabled": true,
"telemetry": false
}
+37
View File
@@ -48,6 +48,43 @@ jobs:
- name: Build
run: go build -v ./...
backend-postgres-contract:
name: Go Backend PostgreSQL Contract
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: flux_test
POSTGRES_PASSWORD: flux_test_pass
POSTGRES_DB: flux_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U flux_test -d flux_test"
--health-interval 10s
--health-timeout 5s
--health-retries 10
defaults:
run:
working-directory: go-backend
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
cache-dependency-path: go-backend/go.sum
- name: Download dependencies
run: go mod download
- name: Run PostgreSQL contract test
env:
FLVX_POSTGRES_TEST_DSN: 'postgres://flux_test:flux_test_pass@127.0.0.1:5432/flux_test?sslmode=disable'
run: go test ./tests/contract -run TestPostgresNodeCreateRepairsMissingIDDefaultContract -count=1
agent:
name: Build Agent
runs-on: ubuntu-latest
+66 -2
View File
@@ -112,6 +112,12 @@ jobs:
upx --best --lzma gost-amd64
upx --best --lzma gost-arm64
- name: Generate SHA256 checksums
working-directory: ./go-gost
run: |
sha256sum gost-amd64 > gost-amd64.sha256
sha256sum gost-arm64 > gost-arm64.sha256
- name: Upload GOST AMD64 artifact
uses: actions/upload-artifact@v4
with:
@@ -124,6 +130,18 @@ jobs:
name: gost-binary-arm64
path: ./go-gost/gost-arm64
- name: Upload GOST AMD64 checksum artifact
uses: actions/upload-artifact@v4
with:
name: gost-checksum-amd64
path: ./go-gost/gost-amd64.sha256
- name: Upload GOST ARM64 checksum artifact
uses: actions/upload-artifact@v4
with:
name: gost-checksum-arm64
path: ./go-gost/gost-arm64.sha256
build-vite:
name: Build & Push Vite Frontend
needs: check-version
@@ -238,7 +256,20 @@ jobs:
name: gost-binary-arm64
path: ./artifacts/arm64
- name: Download GOST AMD64 checksum
uses: actions/download-artifact@v4
with:
name: gost-checksum-amd64
path: ./artifacts/
- name: Download GOST ARM64 checksum
uses: actions/download-artifact@v4
with:
name: gost-checksum-arm64
path: ./artifacts/
- name: Prepare release files
run: |
VERSION="${{ needs.check-version.outputs.version }}"
OWNER="${{ needs.check-version.outputs.image_owner }}"
@@ -268,6 +299,10 @@ jobs:
sed -i "s|2.0.7-beta|${VERSION}|g" ./artifacts/install.sh
sed -i "s|2.0.7-beta|${VERSION}|g" ./artifacts/panel_install.sh
# 注入固定版本号,使从 Release 页下载的脚本只安装该版本
sed -i "s|^PINNED_VERSION=\"\"|PINNED_VERSION=\"${VERSION}\"|" ./artifacts/install.sh
sed -i "s|^PINNED_VERSION=\"\"|PINNED_VERSION=\"${VERSION}\"|" ./artifacts/panel_install.sh
- name: Create Release
env:
GH_TOKEN: ${{ github.token }}
@@ -303,14 +338,22 @@ jobs:
## 🚀 Quick Install
**Panel:**
**Panel (安装此版本 ${VERSION}):**
\`\`\`bash
curl -L https://github.com/${{ github.repository }}/releases/download/${VERSION}/panel_install.sh -o panel_install.sh && chmod +x panel_install.sh && ./panel_install.sh
\`\`\`
**Node:**
**Node (安装此版本 ${VERSION}):**
\`\`\`bash
curl -L https://github.com/${{ github.repository }}/releases/download/${VERSION}/install.sh -o install.sh && chmod +x install.sh && ./install.sh
\`\`\`
**安装最新版:**
\`\`\`bash
# 面板端
curl -L https://raw.githubusercontent.com/${{ github.repository }}/main/panel_install.sh -o panel_install.sh && chmod +x panel_install.sh && ./panel_install.sh
# 节点端
curl -L https://raw.githubusercontent.com/${{ github.repository }}/main/install.sh -o install.sh && chmod +x install.sh && ./install.sh
\`\`\`" \
--repo ${{ github.repository }}
@@ -319,6 +362,10 @@ jobs:
gh release upload "${VERSION}" ./artifacts/gost-amd64 --clobber
gh release upload "${VERSION}" ./artifacts/gost-arm64 --clobber
echo "📤 上传 GOST 校验文件..."
gh release upload "${VERSION}" ./artifacts/gost-amd64.sha256 --clobber
gh release upload "${VERSION}" ./artifacts/gost-arm64.sha256 --clobber
echo "📤 上传安装脚本..."
gh release upload "${VERSION}" ./artifacts/install.sh --clobber
gh release upload "${VERSION}" ./artifacts/panel_install.sh --clobber
@@ -351,6 +398,18 @@ jobs:
name: gost-binary-arm64
path: ./artifacts/arm64
- name: Download GOST AMD64 checksum
uses: actions/download-artifact@v4
with:
name: gost-checksum-amd64
path: ./artifacts/
- name: Download GOST ARM64 checksum
uses: actions/download-artifact@v4
with:
name: gost-checksum-arm64
path: ./artifacts/
- name: Rename binaries
run: |
mv ./artifacts/amd64/gost-amd64 ./artifacts/gost-amd64
@@ -367,4 +426,9 @@ jobs:
gh release upload "${VERSION}" ./artifacts/gost-amd64 --clobber
gh release upload "${VERSION}" ./artifacts/gost-arm64 --clobber
echo "📤 上传 GOST 校验文件..."
gh release upload "${VERSION}" ./artifacts/gost-amd64.sha256 --clobber
gh release upload "${VERSION}" ./artifacts/gost-arm64.sha256 --clobber
echo "✅ GOST 二进制文件更新完成"
+48
View File
@@ -0,0 +1,48 @@
name: Publish Skill to npm
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Get version from tag
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION=$(node -p "require('./skills/flvx-api/package.json').version")
else
VERSION="${GITHUB_REF#refs/tags/v}"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Publishing skill version: $VERSION"
- name: Publish to npm
working-directory: skills/flvx-api
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create GitHub Release
if: github.event_name == 'push'
uses: softprops/action-gh-release@v1
with:
name: Skill v${{ steps.version.outputs.version }}
generate_release_notes: true
files: skills/flvx-api/package.json
+10
View File
@@ -176,6 +176,8 @@ build/
*.so
*.dylib
your_app.exe
go-backend/paneld
go-gost/gost
# Go 测试二进制文件
*.test
@@ -257,7 +259,15 @@ gitee/
doraemon.jks
device.id
commit.sh
.opencode/
analysis/
sql/
!go-backend/internal/store/sqlite/sql/
!go-backend/internal/store/sqlite/sql/schema.sql
!go-backend/internal/store/sqlite/sql/data.sql
!go-backend/internal/store/postgres/sql/
!go-backend/internal/store/postgres/sql/schema.sql
!go-backend/internal/store/postgres/sql/data.sql
go-backend/gost.db-shm
.gitignore
go-backend/gost.db-wal

Some files were not shown because too many files have changed in this diff Show More