Commit Graph

85 Commits

Author SHA1 Message Date
sagit e94aa01213 fix(gost): append 'B' suffix to speed limit values for correct unit parsing 2026-02-09 06:22:47 +00:00
sagit 67d8f7a381 fix(backend): correct speed limit unit conversion from Mbps to Bytes/s 2026-02-09 06:13:56 +00:00
sagit 3a14b22ebc fix: prevent nil pointer dereference in listener config parsing 2026-02-09 04:39:27 +00:00
sagit 634562e56d fix(config): support raw number string for limiter configuration 2026-02-09 03:17:02 +00:00
sagit d06e02998b fix(limiter): fix traffic limiter ScopeClient behavior to allow per-user limits 2026-02-09 03:12:33 +00:00
sagit a1454a3549 fix(agent): handle config save errors and propagate to reporter 2026-02-08 08:23:58 +00:00
sagit 7ab6545594 fix: make chain and limiter updates idempotent
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-08 07:04:06 +00:00
sagit 2e2c182a0d fix: make service update idempotent (upsert)
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-08 07:04:05 +00:00
root 2a4e7777ab fix(gost): run TcpPing commands concurrently without config save race
When multiple TcpPing requests are sent in parallel for diagnosing
multiple remote addresses, the Go agent was processing them serially.
This caused later requests to timeout (10s) while waiting for earlier
requests to complete.

Changes:
- Only TcpPing commands run in goroutines for parallel execution
- TcpPing (read-only diagnostic) no longer triggers saveConfig()
- Other state-mutating commands remain synchronous with config save
- Add mutex to saveConfig() to protect concurrent file writes
2026-02-05 06:18:56 +00:00
root 1130a55ef5 fix(gost): mark node failed when transport detects relay error
When using relay connector with noDelay=false (default), connection
errors to the final target are deferred until first read/write during
Transport(). Previously the Transport() return value was ignored,
causing the marker to never be called for unreachable targets.

Now we capture the Transport() error and mark the node as failed,
enabling failover for subsequent connections.
2026-02-05 04:09:57 +00:00
root 7c898154b3 fix(gost): remove single-node optimization to enable forwarder failover
The single-node bypass in hop.Select() was preventing FailFilter from
being applied when retry excludes reduced available nodes to one.
This caused failed forwarder nodes to keep being selected instead of
failing over to healthy alternatives.

FailFilter's built-in safety guard (len <= 1 returns as-is) ensures
the last remaining node is never permanently blocked.
2026-02-05 02:14:37 +00:00
root 09c58e2298 feat(gost): add debug logging for failover mechanism analysis
Add debug logs to trace failover behavior:
- FailFilter.Filter(): log node name, fail count, maxFails, timeSince, failTimeout
- hop.Select(): log excludeNodes list, node selection results
- handler retry loop: log maxRetries, selected nodes, dial failures

This helps diagnose issues where failover between multiple target nodes
is not working as expected.
2026-02-05 01:06:56 +00:00
root ec41202b3c fix(gost): use chain.NewNode() to properly initialize marker for failover
When creating temporary Node instances with struct literals like
&chain.Node{Addr: host}, the marker field was not initialized.
Only chain.NewNode() properly initializes marker = selector.NewFailMarker().

Without a valid marker:
- Failed nodes cannot be marked (marker.Mark() is no-op on nil)
- Subsequent selections cannot filter out failed nodes
- Failover mechanism completely fails

Fixed locations:
- sniffer.go dial(): &chain.Node{Addr: host} -> chain.NewNode("", host)
- sniffer.go dialTLS(): &chain.Node{Addr: host} -> chain.NewNode("", host)
- local/handler.go: target := &chain.Node{} -> var target *chain.Node
- remote/handler.go: &chain.Node{Addr: host} -> chain.NewNode("", host)
2026-02-04 23:10:56 +00:00
root 0443cd9ceb fix(gost): sync agent version with release tag
- Change version.go default to 'dev' for local development
- Use version variable in WebSocket reporter instead of hardcoded '2.0.2'
- Inject version via -ldflags in CI build from tag name
2026-02-04 08:22:37 +00:00
root 3e046fc80e fix(gost): restore single-node bypass and preserve FailFilter backoff
Address reviewer feedback from PR #14 fix:

1. Single-node case: Bypass selector/FailFilter to ensure availability.
   This matches upstream go-gost/x behavior - single nodes should always
   be attempted regardless of recent failures.

2. Multi-node case: Preserve FailFilter's backoff contract. When all nodes
   are marked as failed, return nil to signal 'no healthy nodes' rather
   than falling back to a known-bad node. This prevents hammering unhealthy
   nodes and respects the failTimeout window.

The handler's retry loop with ExcludeNodes context handles the multi-node
failover properly - this change ensures hop.Select() provides correct
information about node health status.

Fixes intermittent forwarding failures introduced by #14.
2026-02-04 07:46:40 +00:00
root 0273bc6921 docs: add AGENTS.md for go-gost/x/registry 2026-02-04 06:36:03 +00:00
root a98057d06a fix(gost): implement failover for multi-node forwarding rules (#12)
When a forwarding rule has multiple backend nodes configured, the first
node failure would cause the entire forward to fail instead of trying
the next available node.

Root causes fixed:
- FailFilter skipped filtering when only 1 node remained
- hop.Select() bypassed selector for single-node hops
- Handlers only attempted one node before giving up

Changes:
- selector/filter.go: Remove len<=1 early return, always filter failed nodes
- hop/hop.go: Remove single-node bypass, add ExcludeNodes context support
- ctx/value.go: Add ContextWithExcludeNodes/ExcludeNodesFromContext helpers
- handler/forward/local: Add maxRetries config, implement retry loop
- handler/forward/remote: Add maxRetries config, implement retry loop
- forwarder/sniffer.go: Add retry logic to dial() and dialTLS()

Closes #12
2026-02-04 04:12:38 +00:00
root 2c2262b55d 完善分层 AGENTS.md,便于快速定位代码 2026-02-02 07:41:27 +00:00
sagit 84e01c7851 docs: add AGENTS.md knowledge base files 2026-01-24 03:52:58 +00:00
qaq 31290137fe 优化gost执行诊断时计入DNS解析时间的问题 2025-11-21 16:27:58 +08:00
qaq 4a23f3b45a 优化gost执行诊断时计入DNS解析时间的问题 2025-11-21 16:24:45 +08:00
qaq 43aebdf8f4 修复agent时携带错误的屏蔽协议数据,编辑转发时无法使用原分配端口 2025-11-20 13:51:48 +08:00
qaq 65ca18d649 2.0版本测试 2025-11-19 14:28:45 +08:00
qaq d6feb17b86 添加屏蔽协议到面板,免去手动操作 2025-10-31 15:58:49 +08:00
qaq b587193e74 修复屏蔽协议引发的udp不通问题 2025-10-30 16:15:04 +08:00
qaq 2fa9f53e7c 随机构造自签证书信息,修复屏蔽协议引发的udp问题 2025-10-09 15:14:47 +08:00
qaq 50e7ff0f36 随机构造自签证书信息,修复屏蔽协议引发的udp问题 2025-10-09 14:55:05 +08:00
qaq 2f4f1c9a1d 修复协议屏蔽 2025-08-18 11:30:03 +08:00
qaq d6cac71ada 增加协议屏蔽支持 2025-08-17 22:49:22 +08:00
qaq 035672fa1a 增加协议屏蔽支持 2025-08-17 22:47:32 +08:00
qaq 2943d8de76 增加协议屏蔽支持 2025-08-17 22:21:28 +08:00
qaq 04a0ffdc50 增加协议屏蔽支持 2025-08-17 22:19:35 +08:00
qaq 86988b48f9 增加协议屏蔽支持 2025-08-17 22:14:56 +08:00
qaq 74f7eaeac1 增加协议屏蔽支持 2025-08-17 22:10:34 +08:00
qaq 2a037cc72e 增加协议屏蔽支持 2025-08-17 22:08:40 +08:00
qaq 018ed3538b 增加协议屏蔽支持 2025-08-17 22:06:04 +08:00
qaq 3e7e13cc63 增加协议屏蔽支持 2025-08-17 22:02:04 +08:00
qaq 1ddf996b88 增加协议屏蔽支持 2025-08-17 21:56:14 +08:00
qaq 51e4f590f5 增加协议屏蔽支持 2025-08-17 21:45:48 +08:00
qaq cdfad3f224 增加协议屏蔽支持 2025-08-17 21:10:56 +08:00
qaq a046365763 增加协议屏蔽支持 2025-08-17 21:05:29 +08:00
qaq 6dfe55a9f0 增加日志输出 2025-08-15 20:26:31 +08:00
qaq 3d20d633fe 增加日志输出 2025-08-15 20:18:56 +08:00
qaq 31728cf704 移除anytls 2025-08-13 17:57:25 +08:00
qaq d6685447b3 修复无法及时暂停的bug 2025-08-09 21:27:00 +08:00
qaq d675effd58 修复bug 2025-08-08 19:52:53 +08:00
qaq 791cde3eb2 新增支持隧道和转发选择出口ip 2025-08-07 13:50:17 +08:00
qaq b567628700 修复bug 2025-08-06 15:00:39 +08:00
qaq 62f9da97f4 增加拖拽排序 2025-08-05 22:16:21 +08:00
qaq 8e4b69e335 新增转发导入,导出,批量添加功能 2025-08-05 17:28:42 +08:00