aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-11-28Merge branch 'master' of https://github.com/jhalter/mobiusHEADmainRuben Beltran del Rio
2025-11-25Add TLS port field to tracker registration protocolJeff Halter
Repurpose the previously unused 2-byte field in the tracker protocol to advertise the server's TLS port. This allows clients to discover which servers support TLS connections. Note: currently only the official, original, 1990's Tracker software sends this server provided 2-byte field to tracker clients. I'm adding this to Mobius in the hope that the modern day trackers might update their behavior to match the original software, which would put these unused 2 bytes to a useful purpose.
2025-11-24Fix tracker server list parsing for batched responsesJeff Halter
The tracker protocol splits large server lists into batches, with each batch preceded by a ServerInfoHeader. Previously, GetListing only read the initial header and failed when encountering subsequent headers mid-stream, causing the scanner to misinterpret header bytes as server record data. Changes: - Refactored GetListing to use bufio.Reader instead of bufio.Scanner to handle heterogeneous data (headers and server records) - Added readServerRecord helper function for sequential reading - Renamed ServerInfoHeader.SrvCountDup to BatchSize for clarity - Added comprehensive documentation explaining the batching protocol - Removed unused serverScanner function and tests - Added table tests covering multiple batch scenarios The BatchSize field indicates the number of servers in the current batch, while SrvCount indicates the total across all batches.
2025-11-22Add optional TLS support for encrypted client connectionsJeff Halter
- Add TLSConfig and TLSPort fields to Server struct - Add WithTLS option function for configuration - Add ServeWithTLS and ServeFileTransfersWithTLS methods - Update ListenAndServe to start TLS listeners when configured - Add -tls-cert, -tls-key, -tls-port command-line flags - Fix data race in rateLimiters map access with mutex - Add TLS documentation with certificate generation instructions
2025-11-20Update dependenciesJeff Halter
2025-11-20Bump go version to 1.25.4Jeff Halter
2025-11-19Fix error when downloading incomplete filesJeff Halter
2025-11-18Rename hotline.fileWrapper struct to hotline.FileJeff Halter
2025-11-18Replace hardcoded magic values with named constants and improve type safetyJeff Halter
Adds new constants for file format identifiers (FormatFILP), fork types (ForkTypeINFO), and platform identifiers (PlatformAMAC, PlatformMWIN) to improve code maintainability and readability. Changes FlatFileForkHeader.ForkType field from [4]byte to ForkType type alias for better compile-time type checking, matching the pattern used in ForkInfoList.Fork.
2025-11-18Update BannerFile doc comment in default config.yamlJeff Halter
2025-11-18Add support for GIF banners with validation and improved error messagesJeff Halter
- Add custom validator for banner file extensions (.jpg, .jpeg, .gif) - Update HandleTranAgreed to dynamically detect banner type from file extension - Export FileTypeFromFilename function for use across packages - Add comprehensive test coverage for banner validation and type detection - Improve error messages to clearly communicate allowed file extensions
2025-11-14Update Docker image reference in READMEJeff Halter
2025-07-06Add ForkType type alias for improved type safetyJeff Halter
- Replace [4]byte with ForkType in ForkInfoList struct - Update constants ForkTypeDATA and ForkTypeMACR to use ForkType - Add String() method to ForkType for better debugging - Improve consistency with existing type patterns (FieldType, TranType) - Clean up unused code and improve documentation
2025-07-05Fix TestHandleSetClientUserInfo test expectationsJeff Halter
Fix two failing test cases in TestHandleSetClientUserInfo: - Corrected auto-reply test to use UserOptAutoResponse (bit 2) instead of UserOptRefusePM (bit 0) - Updated refuse private messages test to expect correct flag value when UserOptRefuseChat sets UserFlagRefusePChat The HandleSetClientUserInfo function was working correctly - the test expectations were wrong about how user options map to user flags.
2025-07-05Fix string splitting bug and add comprehensive tracker registration testsJeff Halter
- Fix critical bug in tracker address parsing: strings.Split(t, ":") instead of strings.Split(":", t) - Add dependency injection for TrackerRegistrar to improve testability - Extract registerWithAllTrackers() helper function to eliminate code duplication - Add comprehensive test suite covering: * Unit tests for parseTrackerPassword with edge cases and special characters * Integration tests for registerWithTrackers with mocking * Context cancellation and graceful shutdown testing * Error handling for network failures and malformed addresses * Edge cases like zero ports, long names, and empty configurations - Improve password parsing to handle colons in passwords correctly - Add MockTrackerRegistrar for isolated testing without network dependencies The string splitting bug would have prevented tracker registration from working with password-protected trackers. All tests pass and verify the fix works correctly.
2025-07-05Add comprehensive test coverage for news.go functionsJeff Halter
- Add table-driven tests for GetNewsArtListData, DataSize, NewsArtListData.Read, NewsArtList.Read, and newsPathScanner - Improve test coverage from 0% to 87.5%-100% for these functions - Add test for Field.DecodeNewsPath function - Fix NewsArtList.Read to return nil instead of io.EOF for proper io.Reader behavior - Add constants for NewsFlavorCount and improve code documentation
2025-07-04Add comprehensive test coverage for News and improve error handlingJeff Halter
2025-07-04Add comprehensive test coverage for AccessBitmap YAML marshalingJeff Halter
- Add tests for UnmarshalYAML covering array and map formats - Add tests for MarshalYAML with various permission combinations - Cover edge cases including empty bitmaps and full permissions - Ensure backward compatibility with legacy array format
2025-07-04Add comprehensive test coverage for Stats and fix decrement edge caseJeff Halter
- Add complete test suite for Stats with 100% coverage - Fix Decrement method to prevent negative values - Test all methods: Increment, Decrement, Set, Get, Values - Cover edge cases including zero decrements and mixed operations
2025-07-04Standardize IP extraction using net.SplitHostPortJeff Halter
Replace custom extractIP function and inconsistent string.Split usage with Go's standard net.SplitHostPort to ensure proper IPv6 compatibility and consistent IP address handling across Redis operations.
2025-07-04Add comprehensive API documentation and improve code documentationJeff Halter
- Add OpenAPI specification (api.yaml) with complete endpoint documentation - Update README with comprehensive API section including authentication and examples - Add godoc comments to all API handlers and types for better code documentation
2025-07-04Fix file handle close warnings by ignoring return valuesJeff Halter
Updated all file close operations to use anonymous functions that ignore return values to satisfy golangci-lint errcheck warnings.
2025-07-01Add documentation and comprehensive test coverage for AccountManagerJeff Halter
- Add GoDoc comments to AccountManager interface and all YAMLAccountManager methods - Add complete table-driven test coverage for Create, Update, Get, and List methods - Tests follow project conventions with proper error handling and temporary directories - All tests pass with comprehensive verification of both memory state and file operations
2025-06-30Replace inappropriate panic calls with proper error handlingJeff Halter
- Convert panic in news article processing to return error instead - Replace panic in API stats endpoint with HTTP error response - Update ThreadedNewsMgr interface to return errors from ListArticles - Ensure server stability by handling errors gracefully
2025-06-30Improve error handling consistency in main.goJeff Halter
- Fix incorrect error message for banner loading - Convert all error logging to structured format - Remove server shutdown during config reload failures
2025-06-30Add type safety to field system with FieldType aliasJeff Halter
- Define FieldType as typed alias for [2]byte to improve type safety - Update all 47 field constants to use FieldType instead of raw [2]byte - Update Field struct to use FieldType for Type field - Update function signatures: NewField, GetField, Transaction.GetField - Fix field_test.go to use new FieldType in test cases - Maintains backward compatibility with zero runtime overhead - Enhances API clarity and prevents accidental field type misuse
2025-06-30Refactor access bitmap unmarshal logic to use map-driven approachJeff Halter
Replace 120+ lines of repetitive if statements with a compact map lookup. This improves maintainability by reducing code duplication and making it easier to add new access permissions.
2025-06-29Fix IPv6 address parsing in IP extractionJeff Halter
Replace string splitting with net.SplitHostPort to properly handle both IPv4 and IPv6 addresses. Fixes issue where IPv6 addresses like [::1]:8080 were incorrectly parsed as "[" instead of "::1".
2025-06-29Merge branch 'feature/extract-error-constants'Jeff Halter
2025-06-29Fix tests modifying test fixture files by using temporary directoriesJeff Halter
Previously, running tests would modify test/config/Users/guest.yaml and create test/config/Users/test-user.yaml due to the automatic migration logic in YAMLAccountManager. This caused git diff to show changes after running tests. Solution: - Modified TestNewYAMLAccountManager to use t.TempDir() for test isolation - Added copyTestFiles helper to copy test fixtures to temporary directory - Tests now run against copies, leaving original fixtures untouched This ensures tests are properly isolated and don't have side effects on the repository's test fixture files.
2025-06-29Extract hardcoded error strings into comprehensive public constantsJeff Halter
Replace 60+ hardcoded error strings throughout transaction handlers with public constants and templates for consistent error handling across the Hotline protocol implementation. Features: - 33 authorization error constants (ErrMsgNotAllowed*) - Account operation error constants (ErrMsgAccount*) - File operation error templates with filename parameters (ErrMsgCannot*) - Upload/download restriction templates (ErrMsgUpload*) - Ban message constants (ErrMsgTemporaryBan, ErrMsgPermanentBan) - General error constants (ErrMsgUserNotFound, ErrMsgCreateAlias) - Chat/messaging templates (ErrMsgDoesNotAcceptTemplate) Benefits: - Single source of truth for all error messages - Public API for other packages to import standard error constants - Sprintf-style templates for dynamic content (filenames, usernames) - Clear distinction between protocol errors (ErrMsg*) and golang errors - Improved maintainability and consistency across transaction handlers All error messages are now centralized, making future modifications easier and ensuring consistent user experience across all operations.
2025-06-28Update Homebrew workflow to also update URL fieldJeff Halter
2025-06-28Add automated Homebrew formula updates on releaseJeff Halter
2025-06-28Add comprehensive documentation to transaction handler functionsJeff Halter
- Document all transaction handler functions with detailed field specifications - Include request and reply field descriptions with required/optional indicators - Add field numbers and descriptions for easy protocol reference - Remove duplicate comments while preserving important context - Standardize documentation format across all handler functions
2025-06-26Refactor FormattedPath to use scanner interface and add comprehensive testsJeff Halter
- Replace manual byte slicing with bufio.Scanner for safer parsing - Add pathSegmentScanner implementing bufio.SplitFunc pattern - Add comprehensive table tests covering edge cases and special characters - Improve code safety with proper bounds checking - Follow established codebase patterns for binary data parsing
2025-06-26Replace filepath.Join with path.Join for Windows compatibilityJeff Halter
Replace all instances of filepath.Join with path.Join across the codebase to improve Windows compatibility following the guidance from https://github.com/golang/go/issues/44305. Key changes: - Replaced filepath.Join with path.Join in 14 files - Updated import statements appropriately - Resolved variable shadowing issues where function parameters named 'path' were conflicting with the path package - Maintained filepath imports where needed for OS-specific functions like filepath.Walk, filepath.IsAbs, filepath.Dir, and filepath.Base All tests pass, confirming the changes maintain functionality while improving cross-platform compatibility.
2025-06-25Fix critical bug in YAMLAccountManager Update methodJeff Halter
Move delete operation before modifying account.Login to prevent deleting wrong key from accounts map.
2025-06-25Refactor copyDir and findConfigPath functions in main.goJeff Halter
- Refactor copyDir: Add proper error handling, resource cleanup with defer, true recursion, better permissions (0755), and separation of concerns - Refactor configSearchPaths -> findConfigPath: Add directory validation, better naming, and clearer documentation - Add comprehensive test suite for all functions with 100% test coverage - Remove panic in copyDir, replace with proper error propagation - Fix resource leaks by using defer for file cleanup
2025-06-25Ignore .claudeJeff Halter
2025-06-19Ensure temporary upload files are closed before renameJeff Halter
This seems to be important on Windows! See #161
2025-05-22Update transaction_handlers.goTheo Knez
2025-05-22Update api.goTheo Knez
2025-05-22Update server.goTheo Knez
2025-05-22Update go.sumTheo Knez
2025-05-22Update go.modTheo Knez
2025-05-22Update main.goTheo Knez
2025-02-06Bump Golang version in DockerfileJeff Halter
2025-02-06Account for 16 vs 32 bit integers in folder uploadRuben Beltran del Rio
2025-02-06Account for the rootRuben Beltran del Rio
2025-02-05Account for 16 vs 32 bit integers in folder uploadRuben Beltran del Rio