Commit Graph

50 Commits

Author SHA1 Message Date
9785a97973 refactor: remove duplicate channel management helpers from HTTP handler 2026-01-27 16:28:20 +07:00
b8c6359820 refactor: remove custom parsing functions and use ssh.Marshal/ssh.Unmarshal for serialization 2026-01-27 16:28:20 +07:00
04c9ddbc13 test(lifecycle): add unit tests for lifecycle behavior 2026-01-27 16:28:20 +07:00
09aa92a0ae fix: properly initialize tlsStoragePath in config load 2026-01-27 16:28:20 +07:00
bd826d6d06 refactor(transport): reduce cognitive complexity and clean up public API 2026-01-27 16:28:20 +07:00
2f5c44ff01 test(bootstrap): add unit tests for initial bootstrap behavior 2026-01-27 16:28:20 +07:00
d0e052524c refactor: decouple application startup logic from main 2026-01-27 16:28:20 +07:00
e796ab5328 fix: handle error return values for privateKeyFile.Close and pubKeyFile.Close 2026-01-27 16:28:20 +07:00
efdfc4ce95 chore: remove unused headerBuf variable 2026-01-27 16:28:20 +07:00
32f8be2891 test(version): add unit tests for version behavior 2026-01-27 16:28:20 +07:00
5af7af3139 test(client): add unit tests for grpc client behavior 2026-01-27 16:28:20 +07:00
f4848e9754 fix(client): reduce cognitive complexity and fix typo (go:S3776) 2026-01-27 16:28:20 +07:00
d2e508c8ef test(key): add unit tests for key behavior 2026-01-27 16:28:20 +07:00
c1fb588cf4 test(config): add unit tests for config behavior 2026-01-27 16:28:20 +07:00
3029996773 test(stream): add unit tests for stream behavior
- Fix duplicating EOF error when closing SSH connection
- Add new SessionStatusCLOSED type
2026-01-27 16:28:20 +07:00
3fd179d32b test(header): add unit tests for header behavior 2026-01-27 16:28:20 +07:00
29cabe42d3 test(transport): add unit tests for transport behavior using Testify 2026-01-27 16:28:20 +07:00
e534972abc test(random): add unit tests for random behavior
- Added unit tests to cover random string generation and error handling.
- Introduced Random interface and random struct for better abstraction.
- Updated server, session, and interaction packages to require Random interface for dependency injection.
2026-01-27 16:28:20 +07:00
a55ff5f6ab test(port): add unit tests for port behavior 2026-01-27 16:28:20 +07:00
50b4127cb3 test(middleware): add unit tests for middleware behavior
- remove redundant check on registry.Update and check if slug exist before locking the mutex
- Update SonarQube action to not use Go cache when setting up Go
2026-01-27 16:28:20 +07:00
016df9caee test(registry): add unit tests for registry behavior 2026-01-27 16:28:20 +07:00
634c8321ef refactor(registry): define reusable constant errors
SonarQube Scan / SonarQube Trigger (push) Successful in 52s
SonarQube Scan / SonarQube Trigger (pull_request) Successful in 46s
- Introduced package-level error variables in registry to replace repeated fmt.Errorf calls
- Added errors like ErrSessionNotFound, ErrSlugInUse, ErrInvalidSlug, ErrForbiddenSlug, ErrSlugChangeNotAllowed, and ErrSlugUnchanged
2026-01-22 00:39:28 +07:00
2bc20dd991 refactor(config): centralize env loading and enforce typed access
- Centralize environment variable loading in config.MustLoad
- Parse and validate all env vars once at initialization
- Make config fields private and read-only
- Remove public Getenv usage in favor of typed accessors
- Improve validation and initialization order
- Normalize enum naming to be idiomatic and avoid constant collisions
2026-01-21 19:43:19 +07:00
1e12373359 chore(restructure): reorganize project layout
Docker Build and Push / build-and-push-branches (push) Has been skipped
Docker Build and Push / build-and-push-tags (push) Successful in 13m1s
- Reorganize internal packages and overall project structure
- Update imports and wiring to match the new layout
- Separate HTTP parsing and streaming from the server package
- Separate middleware from the server package
- Separate session registry from the session package
- Move HTTP, HTTPS, and TCP servers to the transport package
- Session package no longer starts the TCP server directly
- Server package no longer starts HTTP/HTTPS servers on initialization
- Forwarder no longer handles accepting TCP requests
- Move session details to the types package
- HTTP/HTTPS initialization is now the responsibility of main
2026-01-21 14:06:46 +07:00
9a4539cc02 refactor(httpheader): extract header parsing into dedicated package
Docker Build and Push / build-and-push-tags (push) Has been skipped
Docker Build and Push / build-and-push-branches (push) Successful in 11m19s
Moved HTTP header parsing and building logic from server package to internal/httpheader
2026-01-20 21:15:34 +07:00
44d224f491 refactor: explicit initialization and dependency injection
Docker Build and Push / build-and-push-branches (push) Has been skipped
Docker Build and Push / build-and-push-tags (push) Successful in 10m10s
- Replace init() with config.Load() function when loading env variables
- Inject portRegistry into session, server, and lifecycle structs
- Inject sessionRegistry directly into interaction and lifecycle
- Remove SetSessionRegistry function and global port variables
- Pass ssh.Conn directly to forwarder constructor instead of lifecycle interface
- Pass user and closeFunc callback to interaction constructor instead of lifecycle interface
- Eliminate circular dependencies between lifecycle, forwarder, and interaction
- Remove setter methods (SetLifecycle) from forwarder and interaction interfaces
2026-01-18 21:20:05 +07:00
6587dc0f39 refactor(interaction): separate view and update logic into modular files
- Extract slug editing logic to slug.go (slugView/slugUpdate)
- Extract commands menu logic to commands.go (commandsView/commandsUpdate)
- Extract coming soon modal to coming_soon.go (comingSoonView/comingSoonUpdate)
- Extract main dashboard logic to dashboard.go (dashboardView/dashboardUpdate)
- Create model.go for shared model struct and helper functions
- Replace math/rand with crypto/rand for random subdomain generation
- Remove legacy TLS cipher suite configuration
2026-01-17 17:30:21 +07:00
19135ceb42 refactor: convert structs to interfaces and rename accessors
Docker Build and Push / build-and-push-branches (push) Has been skipped
Docker Build and Push / build-and-push-tags (push) Has been cancelled
- Convert struct types to interfaces
- Rename getter and setter methods
- Add Close method to server interface
- Merge handler functionality into session file
- Handle lifecycle.Connection().Wait()
- fix panic on nil connection in SSH server
2026-01-16 15:25:31 +07:00
dbdf8094fa refactor: replace Get/Set patterns with idiomatic Go interfaces
Docker Build and Push / build-and-push-branches (push) Has been skipped
Docker Build and Push / build-and-push-tags (push) Successful in 13m4s
- rename constructors to New
- remove Get/Set-style accessors
- replace string-based enums with iota-backed types
2026-01-14 16:54:10 +07:00
ae3ed52d16 fix(port): add atomic ClaimPort() to prevent race condition
- Replace GetPortStatus/SetPortStatus calls with atomic ClaimPort() operation.
- Fixed a logic error when handling headless tunneling.
2026-01-14 16:51:50 +07:00
fb638636bf refactor: consolidate error handling with fail() function in session handlers
- Replace repetitive error handling code with fail() function in HandleGlobalRequest
- Standardize error response pattern across all handler methods
- Improve code maintainability and reduce duplication
2026-01-14 16:51:50 +07:00
887ebf78b1 refactor(grpc/client): simplify processEventStream with per-event handlers
- Extract eventHandlers dispatch table
- Add per-event handlers: handleSlugChange, handleGetSessions, handleTerminateSession
- Introduce sendNode helper to centralize send/error handling and preserve connection-error propagation
- Add protoToTunnelType for tunnel-type validation
- Map unknown proto.TunnelType to types.UNKNOWN in protoToTunnelType and return a descriptive error
- Reduce boilerplate and improve readability of processEventStream
2026-01-14 16:51:50 +07:00
bef7a49f88 feat: implement forwarder session termination 2026-01-14 16:51:50 +07:00
17633b4e3c refactor: inject SessionRegistry interface instead of individual functions 2026-01-14 16:51:50 +07:00
f25d61d1d1 update: proto file to v1.3.0 2026-01-14 16:51:50 +07:00
8782b77b74 feat(session): use session key for registry 2026-01-14 16:51:50 +07:00
fc3cd886db fix: use correct environment variable key 2026-01-14 16:51:50 +07:00
b0da57db0d fix: startup order 2026-01-14 16:51:50 +07:00
449f546e04 feat: implement sessions request from grpc server 2026-01-14 16:51:50 +07:00
4644420eee feat: implement get sessions by user 2026-01-14 16:51:50 +07:00
c9bf9e62bd feat(grpc): integrate slug edit handling 2026-01-14 16:51:50 +07:00
57d2136377 WIP: gRPC integration, initial implementation 2026-01-14 16:51:47 +07:00
8a34aaba80 WIP: gRPC integration, initial implementation 2026-01-14 16:51:35 +07:00
acd02aadd3 refactor: restructure project architecture
renovate / renovate (push) Successful in 45s
Docker Build and Push / build-and-push-branches (push) Successful in 5m54s
Docker Build and Push / build-and-push-tags (push) Successful in 6m21s
2025-12-31 15:49:37 +07:00
1d918ef2aa feat(port): disable TCP forwarding by default and refactor port manager
renovate / renovate (push) Successful in 28s
Docker Build and Push / build-and-push (push) Successful in 5m27s
2025-12-28 19:03:26 +07:00
7bc5a01ba7 feat: add pprof for debuging
Docker Build and Push / build-and-push (push) Successful in 3m51s
2025-12-18 18:30:49 +07:00
342f58ddb9 fix: logic error in port checking
Docker Build and Push / build-and-push (push) Has been cancelled
2025-11-28 17:34:23 +07:00
d3a5007d68 refactor: separate session responsibilities and inject dependencies
Docker Build and Push / build-and-push (push) Has been cancelled
2025-11-28 13:29:43 +07:00
f85a05647e fix: add thread safety to PortManager with mutex synchronization
Docker Build and Push / build-and-push (push) Successful in 3m40s
2025-07-22 13:11:03 +07:00
8c15da6131 feat: Support dynamic port allocation for SSH forwarding
Docker Build and Push / build-and-push (push) Failing after 42s
2025-07-21 13:07:42 +07:00