The repository is organized into several key directories:
- MacTsharkServer/: C++ backend server
- mactsharkweb/: React/TypeScript frontend application
- lessons/: Educational content and examples organized by lesson number
- build/: Build artifacts (generated)
MacTsharkServer/
├── CMakeLists.txt # CMake build configuration
├── main.cpp # Application entry point
├── tshark_manager.h/cpp # Core packet capture and analysis logic
├── *_controller.h # HTTP API controllers (packet, adaptor, session, stats)
├── tshark_database.hpp # Database interface
├── tshark_datatype.h # Data structures and types
├── ip2region_util.h/cpp # IP geolocation utilities
├── translator.h/cpp # Internationalization support
├── third_library/ # Third-party dependencies
│ ├── httplib/ # HTTP server library
│ ├── rapidjson/ # JSON parsing library
│ ├── rapidxml/ # XML parsing library
│ ├── loguru/ # Logging framework
│ ├── ip2region/ # IP geolocation database
│ └── sqlite3/ # SQLite database
mactsharkweb/
├── package.json # NPM package configuration
├── electron.js # Electron main process
├── preload.js # Electron preload script
├── public/ # Static assets
├── src/ # Source code
│ ├── App.tsx # Main application component
│ ├── index.tsx # Application entry point
│ ├── components/ # Reusable UI components
│ │ ├── Navbar.tsx # Navigation component
│ │ ├── PageLayout.tsx # Layout component
│ │ ├── Capture.tsx # Packet capture component
│ │ └── HexDataViewer.tsx # Hex data visualization
│ ├── pages/ # Page components
│ │ ├── DataPacketPage.tsx # Packet analysis page
│ │ ├── SessionPage.tsx # Session analysis page
│ │ └── StatisticsPage.tsx # Statistics visualization page
│ └── utils/ # Utility functions
│ └── Api.ts # API client
├── resources/ # Resources for Electron packaging
│ ├── tshark_mac/ # macOS specific resources
│ │ └── tshark_server # Compiled backend binary
│ └── tshark_win/ # Windows specific resources
The lessons/ directory contains educational content organized by lesson number, with each lesson focusing on specific aspects of network packet analysis and the MacTshark application development.
- Controller Pattern: Backend API endpoints are organized into controller classes that handle specific resource types
- Component-Based Architecture: Frontend UI is built with reusable React components
- Separation of Concerns: Clear separation between data capture, processing, storage, and presentation
- Resource Encapsulation: Network adapters, packets, and sessions are represented as encapsulated objects
- C++ files use snake_case for filenames and CamelCase for class names
- React components use PascalCase for both filenames and component names
- API endpoints follow RESTful conventions with resource-based paths