Commit Graph

74 Commits

Author SHA1 Message Date
e59fea6604 test(server): add unit test for handleConnection
SonarQube Scan / SonarQube Trigger (push) Successful in 2m18s
2026-01-24 23:47:51 +07:00
42c428c83d test(bootstrap): add unit tests for initial bootstrap behavior
SonarQube Scan / SonarQube Trigger (push) Successful in 2m30s
2026-01-24 16:15:30 +07:00
1171b18340 refactor: decouple application startup logic from main
SonarQube Scan / SonarQube Trigger (push) Successful in 2m18s
2026-01-24 00:21:40 +07:00
169bc2358c refactor(session): reduce function parameters
SonarQube Scan / SonarQube Trigger (push) Successful in 1m55s
2026-01-23 15:58:50 +07:00
5bed32bda3 test(server): add unit tests for server startup behavior
SonarQube Scan / SonarQube Trigger (push) Successful in 1m49s
2026-01-22 21:58:25 +07:00
7159300fa2 test(stream): add unit tests for stream behavior
SonarQube Scan / SonarQube Trigger (push) Successful in 1m39s
- Fix duplicating EOF error when closing SSH connection
- Add new SessionStatusCLOSED type
2026-01-22 21:04:05 +07:00
9d03f5507f test(random): add unit tests for random behavior
SonarQube Scan / SonarQube Trigger (push) Successful in 1m37s
- 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-22 13:28:10 +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
e3ead4d52f refactor: optimize header parsing and remove factory naming
Docker Build and Push / build-and-push-tags (push) Has been skipped
Docker Build and Push / build-and-push-branches (push) Successful in 11m20s
- Remove factory naming
- Use direct byte indexing instead of bytes.TrimRight
- Extract parseStartLine and setRemainingHeaders helpers
2026-01-20 20:56:08 +07:00
27f49879af refactor(server): enhance HTTP handler modularity and fix resource leak
Docker Build and Push / build-and-push-tags (push) Has been skipped
Docker Build and Push / build-and-push-branches (push) Successful in 11m43s
- Rename customWriter struct to httpWriter for clarity
- Add closeWriter field to properly close write side of connections
- Update all cw variable references to hw
- Merge handlerTLS into handler function to reduce code duplication
- Extract handler into smaller, focused methods
- Split Read/Write/forwardRequest into composable functions

Fixes resource leak where connections weren't properly closed on the
write side, matching the forwarder's CloseWrite() pattern.
2026-01-19 22:41:04 +07:00
8fb19af5a6 fix: resolve copy goroutine deadlock on early connection close
- Add proper CloseWrite handling to signal EOF to other goroutine
- Ensure both copy goroutines terminate when either side closes
- Prevent goroutine leaks for SSH forwarded-tcpip channels:
    - Use select with default when sending result to resultChan
    - Close unused SSH channels and discard requests if main goroutine has already timed out
2026-01-19 00:20:28 +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
da29df85b7 feat: add headless mode support for SSH -N connections
- use s.lifecycle.GetConnection().Wait() to block until SSH connection closes
- Prevent premature session closure in headless mode

In headless mode (ssh -N), there's no channel interaction to block on,
so the session would immediately return and close. Now blocking on
conn.Wait() keeps the session alive until the client disconnects.
2026-01-14 16:51:50 +07:00
09e526cd1e feat: add authenticated user info and restructure handleConnection
- Display authenticated username in welcome page information box
- Refactor handleConnection function for better structure and clarity
2026-01-14 16:51:50 +07:00
8782b77b74 feat(session): use session key for registry 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
2e8767f17a chore: upgrade TLS configuration to TLS 1.3
renovate / renovate (push) Successful in 1m34s
Docker Build and Push / build-and-push-tags (push) Has been skipped
Docker Build and Push / build-and-push-branches (push) Successful in 2m49s
2026-01-01 00:57:48 +07:00
7716eb7f29 perf: optimize header parsing with zero-copy ReadSlice
renovate / renovate (push) Successful in 35s
Docker Build and Push / build-and-push-branches (push) Successful in 4m39s
Docker Build and Push / build-and-push-tags (push) Successful in 4m52s
- Replace ReadString with ReadSlice to eliminate allocations
- Use bytes operations instead of strings
- Add FromBytes variant for in-memory parsing
2025-12-31 23:18:53 +07:00
f8a6f0bafe refactor(session): add registry to manage SSH sessions
renovate / renovate (push) Successful in 39s
Docker Build and Push / build-and-push-branches (push) Successful in 4m27s
Docker Build and Push / build-and-push-tags (push) Successful in 4m22s
- Implement thread-safe session registry with sync.RWMutex
- Add Registry interface for session management operations
- Support Get, Register, Update, and Remove session operations
- Enable dynamic slug updates for existing sessions
2025-12-31 17:47: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
85f21e7698 feat(tui): update interaction layer to Bubble Tea TUI
renovate / renovate (push) Successful in 27s
Docker Build and Push / build-and-push (push) Successful in 3m49s
2025-12-29 21:55:39 +07:00
2644b4521c refactor: improve encapsulation
renovate / renovate (push) Successful in 20s
Docker Build and Push / build-and-push (push) Successful in 3m25s
2025-12-29 12:37:03 +07:00
b5862bd7a0 feat: add configurable HTTP port
renovate / renovate (push) Successful in 20s
Docker Build and Push / build-and-push (push) Successful in 1m45s
2025-12-28 20:09:31 +07:00
bf7f7bd8da feat: add configurable HTTPS port
renovate / renovate (push) Successful in 19s
Docker Build and Push / build-and-push (push) Successful in 1m24s
2025-12-28 20:03:49 +07:00
c3a469be64 refactor: use relative paths for certificates instead of absolute paths
renovate / renovate (push) Successful in 19s
Docker Build and Push / build-and-push (push) Successful in 1m32s
2025-12-28 19:53:03 +07:00
c69cd68820 feat: add certmagic for automatic TLS certificate management
Docker Build and Push / build-and-push (push) Successful in 3m28s
2025-12-26 23:44:50 +07:00
76d1202b8e fix: correct logic when checking tcpip-forward request
Docker Build and Push / build-and-push (push) Successful in 5m34s
2025-12-26 23:17:13 +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
6451304ed7 fix: potential resource leak
Docker Build and Push / build-and-push (push) Successful in 4m17s
2025-12-17 21:38:00 +07:00
ad034ef681 fix: resolve random SSH disconnections caused by 'unexpected bytes remain' errors 2025-12-09 23:39:22 +07:00
8c8fdf251d refactor: remove error shadowing
Docker Build and Push / build-and-push (push) Successful in 6m13s
2025-12-06 23:47:02 +07:00
69c3e78728 fix: correct read/write handling in CustomWriter
Docker Build and Push / build-and-push (push) Successful in 5m7s
2025-12-06 22:18:43 +07:00
368cc0b3e3 fix: resolve nil pointer dereference in interaction on TLS request 2025-12-06 00:01:25 +07:00
af951b8fa7 fix: discard unused buffers in the ssh channel before disconnecting 2025-12-05 22:26:38 +07:00
659f6c3ee7 refactor: move CreateForwardedTCPIPPayload to forwarder interface 2025-12-05 13:49:33 +07:00
7a31047bb9 refactor: restructure session initialization to avoid circular references 2025-12-04 22:48:15 +07:00
039e979142 refactor: restructure session initialization to avoid circular references 2025-12-04 19:32:00 +07:00
515bc30559 fix: conn reader stuck when header have body
Docker Build and Push / build-and-push (push) Has been cancelled
2025-12-03 21:14:42 +07:00
a3eb08e7ae fix: try writing to a close network
Docker Build and Push / build-and-push (push) Has been cancelled
2025-12-02 22:17:14 +07:00
f59de03a50 fix: panic due to nil pointer when disconnecting a session
Docker Build and Push / build-and-push (push) Has been cancelled
2025-12-02 21:52:23 +07:00
626b6b5feb fix: unexpected byte size
Docker Build and Push / build-and-push (push) Has been cancelled
2025-12-02 20:15:51 +07:00
b967619a3a fix: chunk request not sent properly
Docker Build and Push / build-and-push (push) Has been cancelled
2025-12-02 19:17:20 +07:00