Commit Graph

130 Commits

Author SHA1 Message Date
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
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
04dd963535 chore: go mod tidy 2026-01-07 17:04:44 +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
2e2b7246d5 fix(agent): set ServerName in NewTCPClient and NewUDPClient; move CertDNSName to agent/pkg/common 2026-01-07 02:01:59 +08:00
yusing
fc3af0b874 chore(agent): update submodule and add logging for TCP/UDP stream server startup 2026-01-07 01:21:29 +08:00
yusing
68c15536bc fix(agent): add omitempty to stream_port in AgentInfo 2026-01-07 01:06:40 +08:00
yusing
fe619f1dd9 feat(agent): agent stream tunneling with TLS and dTLS (UDP); combined agent APIs
- Add `StreamPort` configuration to agent configuration and environment variables
- Implement TCP and UDP stream client support in agent package
- Update agent verification to test stream connectivity (TCP/UDP)
- Add `/info` endpoint to agent HTTP handler for version, name, runtime, and stream port
- Remove /version, /name, /runtime APIs, replaced by /info
- Update agent compose template to expose stream port for TCP and UDP
- Update agent creation API to optionally specify stream port (defaults to port + 1)
- Modify `StreamRoute` to pass agent configuration to stream implementations
- Update `TCPTCPStream` and `UDPUDPStream` to use agent stream tunneling when agent is configured
- Add support for both direct connections and agent-tunneled connections in stream routes

This enables agents to handle TCP and UDP route tunneling, expanding the proxy capabilities beyond HTTP-only connections.
2026-01-07 00:44:12 +08:00
yusing
cc27942c4d chore(deps): update dependencies 2026-01-05 20:47:56 +08:00
yusing
11d0c61b9c refactor(state): replace Entrypoint method with ShortLinkMatcher interface
- Cleaned up agent go.mod by removing unused indirect dependencies.
2026-01-04 12:43:05 +08:00
yusing
8009da9e4d chore: go mod tidy 2026-01-02 15:49:03 +08:00
yusing
fd74bfedf0 fix(agent): improve url handling to not break urls with encoded characters 2026-01-01 18:25:27 +08:00
yusing
e25ccdbd24 chore: upgrade dependencies 2025-12-30 21:56:54 +08:00
yusing
4d08efbd4f chore(deps): upgrade dependencies 2025-12-22 11:54:13 +08:00
yusing
27512b4d04 chore: upgrade dependencies 2025-12-17 17:43:53 +08:00
yusing
8d4618cedf chore(deps): go mod tidy 2025-12-10 17:37:46 +08:00
yusing
82df824490 chore: go mod tidy 2025-12-05 16:20:29 +08:00
yusing
f721395ff0 refactor(healthcheck): agent health check 2025-12-05 00:45:24 +08:00
yusing
0dc7c59af1 refactor(deps): upgrade go to 1.25.5; isolate dependencies for reverseproxy, websocket and server modules 2025-12-05 00:36:16 +08:00
yusing
09b514393d chore(deps): upgrade go version and dependencies 2025-12-04 12:18:12 +08:00
yusing
9285977495 chore(deps): upgrade dependencies 2025-11-17 15:15:06 +08:00
yusing
c156173757 refactor(docker): migrate from github.com/docker/docker to github.com/moby/moby 2025-11-13 23:03:27 +08:00
yusing
efe1350ffd chore: upgrade dependencies 2025-11-13 15:30:15 +08:00
yusing
4d6541c851 chore(deps): update Go version in Dockerfile and go mod tidy 2025-11-07 16:35:35 +08:00
yusing
3cbd70f73a fix(health_check): correct agent routes health check logic 2025-11-07 10:21:15 +08:00
yusing
36e9b0d416 chore: upgrade go to 1.25.4 and dependencies 2025-11-06 20:13:01 +08:00
yusing
61be88c1d3 chore: upgrade dependencies 2025-10-28 21:40:23 +08:00
yusing
6f75bb7593 refactor(api): replace apitypes module and fix swagger generation 2025-10-26 01:05:18 +08:00
yusing
fc7a81faf5 chore: upgrade dependencies 2025-10-25 23:27:35 +08:00
yusing
9c3346dd9d fix(agent): correct usage of task in StartAgentServer and updated test expectations 2025-10-22 00:02:13 +08:00
yusing
5a91db8d10 perf: use fasthttp for health checks; upgrade go to 1.25.3 2025-10-17 22:50:13 +08:00
yusing
cc8858332d fix(agent): remove leftover pointer in tls.Config 2025-10-12 22:23:14 +08:00
yusing
c66de99fcb perf: further optimize http and body buffer handling 2025-10-12 20:57:51 +08:00
yusing
66043e4a26 refactor!: simplify lego generate script; add and drop some dns provider 2025-10-11 12:44:16 +08:00
yusing
a8aa82f687 chore: upgrade dependencies 2025-10-10 09:11:29 +08:00
yusing
3aed41e078 refactor: move version.go to goutils 2025-10-09 01:14:43 +08:00
yusing
bb5f0cdf09 chore(go): upgrade to go1.25.2 2025-10-08 23:38:33 +08:00
yusing
b46b464e65 refactor: add goutils as submodule, remove go.mod from internal/utils 2025-10-07 20:43:41 +08:00
yusing
52ec309f6b chore: go mod tidy 2025-10-05 20:41:37 +08:00
yusing
6051f75145 refactor(favicon): improve cache and error handling 2025-10-05 20:37:27 +08:00
yusing
f4f104d206 refactor: add go-oidc as submodule 2025-10-05 12:38:40 +08:00