How kdudkov/goatak works
Project Type and Purpose
• GoATAK is a hybrid server–client application written in Go. Its main functions are to serve as a TAK server (supporting both XML and protobuf CoT protocols) and as a client that connects via SSL for situational awareness.
• The README gives insight into key features like certificate enrollment, mission package management, video feeds, and user “visibility scopes”, while providing both a traditional ATAK desktop client and a web-based UI.
Analyzing the File Structure
• Top-level Directories:
– “cmd”: Contains multiple subdirectories (like goatak_server, mm, takreplay, userctl, webclient) which indicate several executables that serve different functionalities (server, client, CLI tools).
– “pkg”: Contains core libraries that deal with CoT messaging, protobuf conversions, coordinate conversions, TLS utilities, logging, and models, all of which are essential to the core functionality.
– “internal”: Houses more specialized logic such as client handlers, repository interfaces, and WebSocket handling.
– “protobuf”: Stores the .proto files used for generating the protocol buffers needed for v2 CoT messages.
– “cert”: Contains scripts for generating certificates, highlighting SSL and certificate management aspects.
– “staticfiles” and “doc”: Serve the web assets (CSS, JS, HTML templates) and documentation—which reinforces the web client’s role.
• Configuration & CI:
– Files like Dockerfile, Makefile, GitHub workflows, and goreleaser configuration indicate the build, deployment, and CI/CD integrations.
Key Architectural Components
• Server Component (goatak_server): Handles API endpoints (admin, authentication, certificate APIs, mission and metrics endpoints), establishes TCP/UDP servers, and processes CoT messages.
• Database Layer: Implemented via the “database” subpackage under goatak_server for managing queries related to missions, invites, and subscriptions.
• Web Client Component: Found under cmd/webclient has its own server code and templates. This part uses static assets (possibly also mentioning third-party libraries like Leaflet and Milsymbol) to provide mapping UI.
• Messaging / CoT Handling: Managed mostly via “pkg/cot”, “pkg/cotproto”, and “protobuf” with both XML and protobuf functionalities.
• Auxiliary Tools: Other executables (mm, takreplay, userctl) support mission management, data replay or export, and command-line user operations.
• Certificate Management: The “cert” scripts and APIs in the goatak_server allow handling of secure connections and client enrollment.
Relationships and Data Flow
• The server processes incoming CoT messages (using either XML or protobuf) via its API modules, interacting with the database layer for persistent operations.
• The server also utilizes helper libraries (from pkg, internal) for tasks like logging, TLS management, message conversion, etc.
• Web clients obtain static files and templates from the “staticfiles” directory, with the server rendering pages that incorporate mapping libraries (Leaflet, Milsymbol).
• Certificate management flows should be depicted, showing the enrollment API interacting with the certificate scripts and TLS utilities.
• CI/CD pipelines (GitHub workflows, Dockerfile, Makefile) can be drawn as a side component indicating the build and deployment processes.
Architectural Patterns and Design Principles
• Modular Design: Separation of concerns is clear with distinct directories handling API logic, client handling, message processing, and auxiliary functionalities.
• Layered Architecture: Logical layering exists between the presentation (web client), business logic (server API and processing), and data access (database queries, repository interfaces).
• Protocol Support: Dual CoT protocol support is achieved via well-isolated components handling XML vs. protobuf messaging.
• Security: Emphasis on SSL and certificate management plays into design decisions for secure communication.