aboutsummaryrefslogtreecommitdiff
path: root/hotline
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-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-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-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 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 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-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-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-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-19Ensure temporary upload files are closed before renameJeff Halter
This seems to be important on Windows! See #161
2025-05-22Update server.goTheo Knez
2025-02-06Account for 16 vs 32 bit integers in folder uploadRuben Beltran del Rio
2025-02-05Account for 16 vs 32 bit integers in folder uploadRuben Beltran del Rio
2025-02-04Allow to delete home files / replace filesRuben Beltran del Rio
2025-02-03Allow home uploadsRuben Beltran del Rio
2024-10-06Fix tracker resultsJeff Halter
2024-07-30Fix commentsJeff Halter
2024-07-28Fix tracker registration loggingJeff Halter
2024-07-28Improve human readability of account config filesJeff Halter
2024-07-27Add logging of tracker registrationJeff Halter
2024-07-26Make Bonjour optional and disabled by defaultJeff Halter
Bonjour doesn't seem happy inside Docker, so I'm making it optional and off by default.
2024-07-25Wrap file transfer errors with more contextJeff Halter
2024-07-23Add client connection rate limitJeff Halter
2024-07-21Clean up loggingJeff Halter
2024-07-19Add option for account-specific file rootJeff Halter
2024-07-19Appease linterJeff Halter
2024-07-19Fix failing test, replace use of reflect package with assertJeff Halter
2024-07-18Add support for trackers that require a passwordJeff Halter
2024-07-18Add initial HTTP API endpointsJeff Halter
2024-07-17Extensive refactor, quality of life enhancementsJeff Halter
* Added ability to reload config, agreement, news, and user accounts without restarting the server by sending SIGHUP to the running process * Added ability to use modern unix or windows line breaks in Agreement.txt and MessageBoard.txt instead of classic MacOS `\r` breaks. * Extensive refactor towards swappable backends for the active server state * Extensive refactored towards making the hotline package generic and re-usable for alternate server implemenations * Fix bug where users whose accounts have been deleted would not be disconnected
2024-07-13Re-add UserList field to clientJeff Halter
2024-07-09Extensive refactor and clean upJeff Halter
2024-06-27Limit chat message size to 8192 bytesJeff Halter
2024-06-24Refactoring, cleanup, test backfillingJeff Halter
2024-06-18Adopt more fixed size array types for struct fieldsJeff Halter
2024-06-17Use fixed size array types in Transaction fieldsJeff Halter
2024-06-17Clean up various linter warningsJeff Halter
2024-06-17Fix io.Reader implementations and wrap more errorsJeff Halter