# xuzhen/dukto architecture

> Architecture diagram of the GitHub repository xuzhen/dukto, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xuzhen/dukto
- Repository: https://github.com/xuzhen/dukto

## Overview

Dukto is a cross-platform LAN tool for sending files and text between nearby devices. The principal workflow is to discover or choose a peer, initiate a transfer, and report its progress or completion; receiving peers save incoming items locally. The graph also includes settings, recent transfers, and platform notifications as supporting capabilities. The excerpts show the UI-to-transfer calls and sender/receiver mechanics, but not all protocol wiring or UI bindings, so uncertain connections are omitted.

Main entry points: [`guibehind.cpp`](https://github.com/xuzhen/dukto/blob/master/guibehind.cpp) (UI controller), [`network/messenger.cpp`](https://github.com/xuzhen/dukto/blob/master/network/messenger.cpp) (LAN messenger), [`network/sender.cpp`](https://github.com/xuzhen/dukto/blob/master/network/sender.cpp) (Transfer sender), [`duktoprotocol.cpp`](https://github.com/xuzhen/dukto/blob/master/duktoprotocol.cpp) (Transfer protocol)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application and UI"]
  node_window["Dukto window"]
  node_gui["UI controller<br/>[guibehind.cpp]"]
  node_buddylist["Peer list model"]
  node_recent["Recent list model"]
  node_ipmodel["IP address model"]
end

subgraph group_discovery["Peer discovery"]
  node_messenger["LAN messenger<br/>[messenger.cpp]"]
  node_buddymsg["Peer messages<br/>[buddymessage.cpp]"]
end

subgraph group_transfer["Transfer runtime"]
  node_protocol["Transfer protocol<br/>[duktoprotocol.cpp]"]
  node_sender["Transfer sender<br/>[sender.cpp]"]
  node_receiver["Transfer receiver<br/>[receiver.cpp]"]
  node_filedata["File data<br/>[filedata.cpp]"]
end

subgraph group_support["Preferences and platform"]
  node_settings["Preferences<br/>[settings.cpp]"]
  node_notification["Transfer notifications"]
  node_platform["Platform services<br/>[platform.cpp]"]
  node_theme["Theme handling<br/>[theme.cpp]"]
  node_tray["System tray<br/>[systemtray.cpp]"]
end

node_user(("User"))
node_peer(("LAN peer"))
node_filesystem["Local files"]

node_user -->|"uses"| node_window
node_window -->|"delegates UI actions"| node_gui
node_gui -->|"updates peers"| node_buddylist
node_gui -->|"starts transfers"| node_protocol
node_gui -->|"discovers peers"| node_messenger
node_messenger -->|"parses and serializes"| node_buddymsg
node_messenger -->|"exchanges UDP messages"| node_peer
node_messenger -->|"reports peers"| node_gui
node_protocol -->|"dispatches sends"| node_sender
node_protocol -->|"dispatches receives"| node_receiver
node_sender -->|"builds file list"| node_filedata
node_sender -->|"sends items"| node_peer
node_peer -->|"sends items"| node_receiver
node_sender -->|"reads files"| node_filesystem
node_receiver -->|"writes received items"| node_filesystem
node_gui -->|"reads preferences"| node_settings
node_gui -->|"updates history"| node_recent
node_gui -->|"reports transfer status"| node_notification
node_gui -->|"requests platform behavior"| node_platform
node_gui -->|"changes theme"| node_theme
node_window -.->|"integrates tray controls"| node_tray

click node_gui "https://github.com/xuzhen/dukto/blob/master/guibehind.cpp"
click node_buddylist "https://github.com/xuzhen/dukto/blob/master/buddylistitemmodel.cpp"
click node_recent "https://github.com/xuzhen/dukto/blob/master/recentlistitemmodel.cpp"
click node_ipmodel "https://github.com/xuzhen/dukto/blob/master/ipaddressitemmodel.cpp"
click node_protocol "https://github.com/xuzhen/dukto/blob/master/duktoprotocol.cpp"
click node_messenger "https://github.com/xuzhen/dukto/blob/master/network/messenger.cpp"
click node_buddymsg "https://github.com/xuzhen/dukto/blob/master/network/buddymessage.cpp"
click node_sender "https://github.com/xuzhen/dukto/blob/master/network/sender.cpp"
click node_receiver "https://github.com/xuzhen/dukto/blob/master/network/receiver.cpp"
click node_filedata "https://github.com/xuzhen/dukto/blob/master/network/filedata.cpp"
click node_settings "https://github.com/xuzhen/dukto/blob/master/settings.cpp"
click node_notification "https://github.com/xuzhen/dukto/blob/master/systemnotification.cpp"
click node_platform "https://github.com/xuzhen/dukto/blob/master/platform.cpp"
click node_theme "https://github.com/xuzhen/dukto/blob/master/theme.cpp"
click node_tray "https://github.com/xuzhen/dukto/blob/master/systemtray.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_window,node_gui,node_buddylist,node_recent,node_ipmodel,node_user toneBlue
class node_messenger,node_buddymsg toneAmber
class node_protocol,node_sender,node_receiver,node_filedata toneMint
class node_settings,node_notification,node_platform,node_theme,node_tray toneRose
class node_peer,node_filesystem toneIndigo
```

## Components

### Application and UI

- **Dukto window**
- [UI controller](https://github.com/xuzhen/dukto/blob/master/guibehind.cpp): `guibehind.cpp`
- [Peer list model](https://github.com/xuzhen/dukto/blob/master/buddylistitemmodel.cpp): `buddylistitemmodel.cpp`
- [Recent list model](https://github.com/xuzhen/dukto/blob/master/recentlistitemmodel.cpp): `recentlistitemmodel.cpp`
- [IP address model](https://github.com/xuzhen/dukto/blob/master/ipaddressitemmodel.cpp): `ipaddressitemmodel.cpp`

### Peer discovery

- [LAN messenger](https://github.com/xuzhen/dukto/blob/master/network/messenger.cpp): `network/messenger.cpp`
- [Peer messages](https://github.com/xuzhen/dukto/blob/master/network/buddymessage.cpp): `network/buddymessage.cpp`

### Transfer runtime

- [Transfer protocol](https://github.com/xuzhen/dukto/blob/master/duktoprotocol.cpp): `duktoprotocol.cpp`
- [Transfer sender](https://github.com/xuzhen/dukto/blob/master/network/sender.cpp): `network/sender.cpp`
- [Transfer receiver](https://github.com/xuzhen/dukto/blob/master/network/receiver.cpp): `network/receiver.cpp`
- [File data](https://github.com/xuzhen/dukto/blob/master/network/filedata.cpp): `network/filedata.cpp`

### Preferences and platform

- [Preferences](https://github.com/xuzhen/dukto/blob/master/settings.cpp): `settings.cpp`
- [Transfer notifications](https://github.com/xuzhen/dukto/blob/master/systemnotification.cpp): `systemnotification.cpp`
- [Platform services](https://github.com/xuzhen/dukto/blob/master/platform.cpp): `platform.cpp`
- [Theme handling](https://github.com/xuzhen/dukto/blob/master/theme.cpp): `theme.cpp`
- [System tray](https://github.com/xuzhen/dukto/blob/master/systemtray.cpp): `systemtray.cpp`

### Other components

- **User**
- **LAN peer**
- **Local files**

## Connections

- User → Dukto window: uses
- Dukto window → UI controller: delegates UI actions
- UI controller → Peer list model: updates peers
- UI controller → Transfer protocol: starts transfers
- UI controller → LAN messenger: discovers peers
- LAN messenger → Peer messages: parses and serializes
- LAN messenger → LAN peer: exchanges UDP messages
- LAN messenger → UI controller: reports peers
- Transfer protocol → Transfer sender: dispatches sends
- Transfer protocol → Transfer receiver: dispatches receives
- Transfer sender → File data: builds file list
- Transfer sender → LAN peer: sends items
- LAN peer → Transfer receiver: sends items
- Transfer sender → Local files: reads files
- Transfer receiver → Local files: writes received items
- UI controller → Preferences: reads preferences
- UI controller → Recent list model: updates history
- UI controller → Transfer notifications: reports transfer status
- UI controller → Platform services: requests platform behavior
- UI controller → Theme handling: changes theme
- Dukto window → System tray: integrates tray controls
