Commit Graph

1737 Commits

Author SHA1 Message Date
yusing
7c65a13788 feat(handler): set Content-Type header to application/json in agent response 2026-01-09 00:37:07 +08:00
yusing
bf227f280c refactor(udp_server): simplify connection handling in UDP server's Start method 2026-01-09 00:36:42 +08:00
yusing
b1af82ee21 fix(agent): set minimum TLS version to 1.2 in agent configuration 2026-01-09 00:32:50 +08:00
yusing
f809f0e865 Merge branch 'main' into feat/agent-stream-rebased 2026-01-09 00:31:28 +08:00
yusing
45eb3eefab docs(stream): update README to correct header size and enhance API documentation
- Corrected the total header size from 273 to 274 bytes.
- Improved documentation for `StreamRequestHeader` and `ConnectionManager` types, including method descriptions.
- Added details on TCP and UDP functions, as well as connection management and ALPN protocol usage.
2026-01-09 00:15:24 +08:00
yusing
c7d4703622 docs: update README for autocert package to reflect changes in renewal scheduling and primary consumers 2026-01-09 00:06:27 +08:00
yusing
7e99f3465f docs: update goutils docs 2026-01-08 23:48:24 +08:00
yusing
e9d7edef12 docs: add per package README for implementation details (AI generated with human review) 2026-01-08 23:39:19 +08:00
yusing
b7cd4b51cb docs(stream): enhance documentation 2026-01-08 20:53:38 +08:00
yusing
e1dd84ed16 docs(agent): rename PROTOCOL.md to README.md 2026-01-08 20:35:15 +08:00
yusing
caa71b1bb6 docs(idlewatcher): update README to include loading page and SSE endpoint details
- Added information about the loading page (HTML + JS + CSS) and the SSE endpoint for wake events.
- Clarified the health monitor implementation and readiness tracking in the architecture overview.
- Correct state machine syntax.
2026-01-08 20:32:16 +08:00
yusing
0775ac0b92 feat(docs): add health check and monitor packages README; mermaid styling fix 2026-01-08 20:32:16 +08:00
yusing
b1e3aa382c feat(scriptsi): add script to sync implementation docs with wiki
- Introduced a new `update-wiki` script to automate the synchronization of implementation documentation from the repository to the wiki.
- Added necessary configuration files including `package.json`, `tsconfig.json`, and `.gitignore` for the new script.
- Updated the Makefile to include a target for running the `update-wiki` script.
2026-01-08 20:32:15 +08:00
yusing
13441286d1 docs(idlewatcher): update README to include loading page and SSE endpoint details
- Added information about the loading page (HTML + JS + CSS) and the SSE endpoint for wake events.
- Clarified the health monitor implementation and readiness tracking in the architecture overview.
- Correct state machine syntax.
2026-01-08 20:31:44 +08:00
yusing
86f35878fb feat(docs): add health check and monitor packages README; mermaid styling fix 2026-01-08 18:18:17 +08:00
yusing
7556a06716 feat(scriptsi): add script to sync implementation docs with wiki
- Introduced a new `update-wiki` script to automate the synchronization of implementation documentation from the repository to the wiki.
- Added necessary configuration files including `package.json`, `tsconfig.json`, and `.gitignore` for the new script.
- Updated the Makefile to include a target for running the `update-wiki` script.
2026-01-08 18:17:06 +08:00
yusing
7385761bdf fix(health): correct context handling, move NewMonitor, and improve docker health check errors
- Correct BaseContext nil check in Context() method
- Move NewMonitor from monitor.go to new.go
- Export ErrDockerHealthCheckFailedTooManyTimes and add ErrDockerHealthCheckNotAvailable
- Return ErrDockerHealthCheckNotAvailable when container has no health check configured
- Only log first docker health check failure and skip logging for ErrDockerHealthCheckNotAvailable
- Use mon.Context() instead of mon.task.Context() to avoid nil panic
2026-01-08 18:15:02 +08:00
yusing
1c1e50a35b fix(health): correct context handling, move NewMonitor, and improve docker health check errors
- Correct BaseContext nil check in Context() method
- Move NewMonitor from monitor.go to new.go
- Export ErrDockerHealthCheckFailedTooManyTimes and add ErrDockerHealthCheckNotAvailable
- Return ErrDockerHealthCheckNotAvailable when container has no health check configured
- Only log first docker health check failure and skip logging for ErrDockerHealthCheckNotAvailable
- Use mon.Context() instead of mon.task.Context() to avoid nil panic
2026-01-08 18:14:14 +08:00
yusing
1c78e19a4a refactor: move internal/watcher/health to internal/health 2026-01-08 15:11:04 +08:00
yusing
581503e160 refactor: move internal/watcher/health to internal/health 2026-01-08 15:08:02 +08:00
yusing
7c7fabb7a1 refactor(health): restructure health check implementations into dedicated check package
- Move health check implementations from monitor/ to new check/ package
- Add h2c, tcp4/6, udp4/6 scheme support to agent health check API
- Add timeout URL parameter to agent health check endpoint
- Remove unused agent dependencies (dnsproviders, lego, various cloud SDKs)
- Use net.JoinHostPort instead of fmt.Sprintf for port joining
2026-01-08 15:03:00 +08:00
yusing
db2eda49f1 refactor(agent): extract agent pool and HTTP utilities to dedicated package
Moved non-agent-specific logic from agent/pkg/agent/ to internal/agentpool/:
- pool.go: Agent pool management (Get, Add, Remove, List, Iter, etc.)
- http_requests.go: HTTP utilities (health checks, forwarding, websockets, reverse proxy)
- agent.go: Agent struct with HTTP client management

This separates general-purpose pool management from agent-specific configuration,
improving code organization and making the agent package focused on agent config only.
2026-01-08 15:02:27 +08:00
yusing
243e7e9e95 refactor(health): restructure health check implementations into dedicated check package
- Move health check implementations from monitor/ to new check/ package
- Add h2c, tcp4/6, udp4/6 scheme support to agent health check API
- Add timeout URL parameter to agent health check endpoint
- Remove unused agent dependencies (dnsproviders, lego, various cloud SDKs)
- Use net.JoinHostPort instead of fmt.Sprintf for port joining
2026-01-08 14:54:33 +08:00
yusing
8b5cb947c8 refactor(agent): extract agent pool and HTTP utilities to dedicated package
Moved non-agent-specific logic from agent/pkg/agent/ to internal/agentpool/:
- pool.go: Agent pool management (Get, Add, Remove, List, Iter, etc.)
- http_requests.go: HTTP utilities (health checks, forwarding, websockets, reverse proxy)
- agent.go: Agent struct with HTTP client management

This separates general-purpose pool management from agent-specific configuration,
improving code organization and making the agent package focused on agent config only.
2026-01-08 12:02:21 +08:00
yusing
751d73da7c refactor(agent/stream): remove connQueueListener and simplify the handshaking flow 2026-01-08 00:15:47 +08:00
yusing
d3a8b3c0e6 fix(agent/stream): improve error handling in UDP server connection
- Enhanced error handling in the UDP server to properly manage EOF and closed connection scenarios.
- Ensured that bytes read from the client are forwarded before handling errors.
- Added checks to avoid logging noise for expected shutdown conditions.
2026-01-07 23:42:21 +08:00
yusing
63f96b8d76 refactor(agent/stream): update header size calculation and field types
- Adjusted headerSize calculation to reflect the correct size based on field definitions.
- Changed HostLength and PortLength types from uint8 to byte.
- Updated PROTOCOL.md to reflect the new header size and structure.
2026-01-07 22:33:24 +08:00
yusing
5048326c20 fix(agent/stream): handle EOF error in UDP server connection
- Updated error handling in the UDP server to ignore io.EOF errors when reading from client connections.
- Added a check to return early if no bytes are read from the client connection.
- Ensured proper closure of tcpListener in the main.go file during cancellation.
2026-01-07 21:10:47 +08:00
yusing
d7361c6f52 refactor(agent/config): simplify stream server address handling
- Removed the streamServerAddr field from AgentConfig to streamline configuration.
- Updated StartWithCerts, NewTCPClient, and NewUDPClient methods to use Addr directly for establishing connections.
- Eliminated the getStreamServerAddr method as it is no longer needed.
2026-01-07 21:09:07 +08:00
yusing
c8f617108e refactor(agent/stream): rename payload.go to header.go and update protocol header format
- Rename payload.go to header.go for clarity
- Add HostLength and PortLength fields to avoid NUL-terminated string scanning
- Add padding bytes to make struct size match headerSize
- Remove unused StreamRequestPayload struct and WriteTo method
- Add runtime size validation in init()
- Update PROTOCOL.md documentation
2026-01-07 21:08:04 +08:00
yusing
039ae26696 chore(stream): remove unused StreamRequestPayload test 2026-01-07 21:05:52 +08:00
yusing
a605d56a4c feat(agent/stream): remove STREAM_PORT and use tcp multiplexing on the same port 2026-01-07 18:30:31 +08:00
yusing
cc406921cb refactor: remove NoCopy struct; move RefCounter struct to goutils and update usage; remove internal/utils entirely 2026-01-07 17:19:34 +08:00
yusing
9ea9e62ee8 refactor: remove NoCopy struct; move RefCounter struct to goutils and update usage; remove internal/utils entirely 2026-01-07 17:17:12 +08:00
yusing
04dd963535 chore: go mod tidy 2026-01-07 17:04:44 +08:00
yusing
5ff6928b13 Cherry-Pick 1ebba20216 2026-01-07 15:29:39 +08:00
yusing
1ebba20216 fix(docker): add TLS check; correct dial handling and reconnection for custom docker provider; modernize pointer arithemetic with unsafe.Add 2026-01-07 15:28:53 +08:00
yusing
7bfb57ea30 fix(stream): nil panic for excluded routes 2026-01-07 15:24:28 +08:00
yusing
63e69e71c3 fix(stream): nil panic for excluded routes 2026-01-07 15:24:09 +08:00
yusing
0b9553e4af Cherry-Pick 25ceb512b4 2026-01-07 15:09:51 +08:00
yusing
25ceb512b4 feat(route): add bind address support for TCP/UDP routes
- Introduced a new `Bind` field in the route configuration to specify the address to listen on for TCP and UDP routes.
- Defaulted the bind address to "0.0.0.0" if not provided.
- Enhanced validation to ensure the bind address is a valid IP.
- Updated stream initialization to use the correct network type (tcp4/tcp6 or udp4/udp6) based on the bind address.
- Refactored stream creation functions to accept the network type as a parameter.
2026-01-07 15:05:55 +08:00
yusing
682b4330fc feat(agent/stream): log UDP server errors 2026-01-07 14:34:14 +08:00
yusing
56f7841eda test(agent/stream): refactor server flow tests to use testify and real certificate generation
- Use agent.NewAgent() for properly configured certificates matching real usage
- Migrate to testify/require for assertions
- Add tests for UDP server rejecting clients with invalid certificates
- Use t.Context() for lifecycle management
2026-01-07 14:19:58 +08:00
yusing
0a28d026c5 Merge branch 'main' into feat/agent-stream-rebased 2026-01-07 10:54:56 +08:00
yusing
9205af3a4f feat(api/cert): enhance certificate info retrieval
- Introduced a new method `GetCertInfos` to fetch details of all available certificates.
- Updated the `Info` handler to return an array of `CertInfo` instead of a single certificate.
- Improved error handling for cases with no available certificates.
- Refactored related error messages for clarity.
2026-01-07 10:54:33 +08:00
yusing
08f4d9e95f chore: update goutils 2026-01-07 10:24:08 +08:00
yusing
559fea3ab1 chore(swagger): update swagger 2026-01-07 10:21:50 +08:00
yusing
2e2b7246d5 fix(agent): set ServerName in NewTCPClient and NewUDPClient; move CertDNSName to agent/pkg/common 2026-01-07 02:01:59 +08:00
yusing
c039f9f4b5 fix(route): update logging to use Stringer for scheme in StreamRoute 2026-01-07 01:37:20 +08:00
yusing
55a0b722b9 chore(goutils): update submodule 2026-01-07 01:21:44 +08:00