| Age | Commit message (Collapse) | Author |
|
|
|
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.
|
|
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.
|
|
- 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
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
- 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
|
|
|
|
- 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
|
|
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.
|
|
- 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.
|
|
- 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
|
|
|
|
- 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
|
|
- 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
|
|
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.
|
|
- 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
|
|
Updated all file close operations to use anonymous functions that ignore
return values to satisfy golangci-lint errcheck warnings.
|
|
- 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
|
|
- 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
|
|
- Fix incorrect error message for banner loading
- Convert all error logging to structured format
- Remove server shutdown during config reload failures
|
|
- 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
|
|
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.
|
|
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".
|
|
|
|
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.
|
|
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.
|
|
|
|
|
|
- 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
|
|
- 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
|
|
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.
|
|
Move delete operation before modifying account.Login to prevent deleting wrong key from accounts map.
|
|
- 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
|
|
|
|
This seems to be important on Windows! See #161
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|