# goshs-labs/goshs architecture

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

- Interactive diagram: https://gitdiagram.com/goshs-labs/goshs
- Repository: https://github.com/goshs-labs/goshs

## Overview

goshs is a single-binary engagement file server and collaboration toolkit. The main workflow parses options, validates configuration, starts selected listeners, and serves files or captures protocol callbacks; operators can observe events in the web UI or TUI. The graph preserves the README’s major protocol, security, sharing, templating, and collaboration capabilities. Some implementation details—especially unsampled protocol handlers and integrations—are represented only where documented, or left unverified rather than inferred as direct calls.

Main entry points: [`server/server.go`](https://github.com/goshs-labs/goshs/blob/main/server/server.go) (Service orchestration), [`httpserver/server.go`](https://github.com/goshs-labs/goshs/blob/main/httpserver/server.go) (HTTP / WebDAV), [`ws/hub.go`](https://github.com/goshs-labs/goshs/blob/main/ws/hub.go) (Event hub), [`chat/chat.go`](https://github.com/goshs-labs/goshs/blob/main/chat/chat.go) (Team chat)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Startup and configuration"]
  node_options["CLI options<br/>[options.go]"]
  node_config["Config loading<br/>[config.go]"]
  node_sanity["Option validation<br/>[checks.go]"]
  node_runtime["Service orchestration<br/>[server.go]"]
end

subgraph group_serving["File serving"]
  node_http["HTTP / WebDAV<br/>[server.go]"]
  node_fileops["File operations<br/>[handler.go]"]
  node_sharing["Share links<br/>[handler.go]"]
  node_templating["Payload templating<br/>[template.go]"]
end

subgraph group_protocols["Protocol services"]
  node_ftp["FTP<br/>[ftpserver.go]"]
  node_sftp["SFTP<br/>[sftpserver.go]"]
  node_smb["SMB and NTLM<br/>[server.go]"]
  node_ldap["LDAP capture<br/>[session.go]"]
  node_dns["DNS callbacks<br/>[server.go]"]
  node_smtp["SMTP capture<br/>[session.go]"]
end

subgraph group_collaboration["Collaboration and events"]
  node_chat["Team chat<br/>[chat.go]"]
  node_hub["Event hub<br/>[hub.go]"]
  node_websocket["WebSocket clients<br/>[client.go]"]
  node_tui["Terminal dashboard<br/>[tui.go]"]
  node_catcher["Reverse-shell catcher<br/>[catcher.go]"]
end

subgraph group_security["Security and integrations"]
  node_webhook["Webhook delivery<br/>[webhook.go]"]
  node_tls["TLS certificates<br/>[ca.go]"]
  node_tunnel["Public tunnel<br/>[tunnel.go]"]
end

node_operator(("Operator"))

node_operator -->|"sets flags"| node_options
node_operator -.->|"uses server"| node_http
node_options -->|"loads settings"| node_config
node_options -->|"validates options"| node_sanity
node_sanity -->|"starts runtime"| node_runtime
node_runtime -->|"starts listener"| node_http
node_runtime -->|"starts when enabled"| node_ftp
node_runtime -->|"starts when enabled"| node_sftp
node_runtime -->|"starts when enabled"| node_smb
node_runtime -->|"starts when enabled"| node_ldap
node_runtime -->|"starts when enabled"| node_dns
node_runtime -->|"starts when enabled"| node_smtp
node_http -.->|"routes requests"| node_fileops
node_http -->|"routes share requests"| node_sharing
node_http -.->|"serves rendered files"| node_templating
node_http -->|"configures TLS"| node_tls
node_runtime -->|"creates shared chat"| node_chat
node_runtime -->|"creates event hub"| node_hub
node_http -->|"receives shared chat"| node_chat
node_http -->|"uses event hub"| node_hub
node_hub -->|"stores chat reference"| node_chat
node_websocket -->|"updates messages"| node_chat
node_websocket -->|"broadcasts events"| node_hub
node_runtime -->|"launches dashboard"| node_tui
node_tui -->|"observes events"| node_hub
node_tui -->|"shares chat state"| node_chat
node_runtime -->|"exposes catcher"| node_catcher
node_smb -.->|"broadcasts captures"| node_hub
node_ldap -.->|"broadcasts captures"| node_hub
node_dns -->|"broadcasts queries"| node_hub
node_smtp -.->|"reports mail events"| node_hub
node_dns -->|"sends callbacks"| node_webhook
node_runtime -.->|"starts optional tunnel"| node_tunnel

click node_options "https://github.com/goshs-labs/goshs/blob/main/options/options.go"
click node_config "https://github.com/goshs-labs/goshs/blob/main/config/config.go"
click node_sanity "https://github.com/goshs-labs/goshs/blob/main/sanity/checks.go"
click node_runtime "https://github.com/goshs-labs/goshs/blob/main/server/server.go"
click node_http "https://github.com/goshs-labs/goshs/blob/main/httpserver/server.go"
click node_fileops "https://github.com/goshs-labs/goshs/blob/main/httpserver/handler.go"
click node_sharing "https://github.com/goshs-labs/goshs/blob/main/httpserver/handler.go"
click node_templating "https://github.com/goshs-labs/goshs/blob/main/httpserver/template.go"
click node_ftp "https://github.com/goshs-labs/goshs/blob/main/ftpserver/ftpserver.go"
click node_sftp "https://github.com/goshs-labs/goshs/blob/main/sftpserver/sftpserver.go"
click node_smb "https://github.com/goshs-labs/goshs/blob/main/smbserver/server.go"
click node_ldap "https://github.com/goshs-labs/goshs/blob/main/ldapserver/session.go"
click node_dns "https://github.com/goshs-labs/goshs/blob/main/dnsserver/server.go"
click node_smtp "https://github.com/goshs-labs/goshs/blob/main/smtpserver/session.go"
click node_chat "https://github.com/goshs-labs/goshs/blob/main/chat/chat.go"
click node_hub "https://github.com/goshs-labs/goshs/blob/main/ws/hub.go"
click node_websocket "https://github.com/goshs-labs/goshs/blob/main/ws/client.go"
click node_tui "https://github.com/goshs-labs/goshs/blob/main/tui/tui.go"
click node_catcher "https://github.com/goshs-labs/goshs/blob/main/catcher/catcher.go"
click node_webhook "https://github.com/goshs-labs/goshs/blob/main/webhook/webhook.go"
click node_tls "https://github.com/goshs-labs/goshs/blob/main/ca/ca.go"
click node_tunnel "https://github.com/goshs-labs/goshs/blob/main/tunnel/tunnel.go"

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_options,node_config,node_sanity,node_runtime toneBlue
class node_http,node_fileops,node_sharing,node_templating toneAmber
class node_ftp,node_sftp,node_smb,node_ldap,node_dns,node_smtp toneMint
class node_chat,node_hub,node_websocket,node_tui,node_catcher toneRose
class node_webhook,node_tls,node_tunnel,node_operator toneIndigo
```

## Components

### Startup and configuration

- [CLI options](https://github.com/goshs-labs/goshs/blob/main/options/options.go): `options/options.go`
- [Config loading](https://github.com/goshs-labs/goshs/blob/main/config/config.go): `config/config.go`
- [Option validation](https://github.com/goshs-labs/goshs/blob/main/sanity/checks.go): `sanity/checks.go`
- [Service orchestration](https://github.com/goshs-labs/goshs/blob/main/server/server.go): `server/server.go`

### File serving

- [HTTP / WebDAV](https://github.com/goshs-labs/goshs/blob/main/httpserver/server.go): `httpserver/server.go`
- [File operations](https://github.com/goshs-labs/goshs/blob/main/httpserver/handler.go): `httpserver/handler.go`
- [Share links](https://github.com/goshs-labs/goshs/blob/main/httpserver/handler.go): `httpserver/handler.go`
- [Payload templating](https://github.com/goshs-labs/goshs/blob/main/httpserver/template.go): `httpserver/template.go`

### Protocol services

- [FTP](https://github.com/goshs-labs/goshs/blob/main/ftpserver/ftpserver.go): `ftpserver/ftpserver.go`
- [SFTP](https://github.com/goshs-labs/goshs/blob/main/sftpserver/sftpserver.go): `sftpserver/sftpserver.go`
- [SMB and NTLM](https://github.com/goshs-labs/goshs/blob/main/smbserver/server.go): `smbserver/server.go`
- [LDAP capture](https://github.com/goshs-labs/goshs/blob/main/ldapserver/session.go): `ldapserver/session.go`
- [DNS callbacks](https://github.com/goshs-labs/goshs/blob/main/dnsserver/server.go): `dnsserver/server.go`
- [SMTP capture](https://github.com/goshs-labs/goshs/blob/main/smtpserver/session.go): `smtpserver/session.go`

### Collaboration and events

- [Team chat](https://github.com/goshs-labs/goshs/blob/main/chat/chat.go): `chat/chat.go`
- [Event hub](https://github.com/goshs-labs/goshs/blob/main/ws/hub.go): `ws/hub.go`
- [WebSocket clients](https://github.com/goshs-labs/goshs/blob/main/ws/client.go): `ws/client.go`
- [Terminal dashboard](https://github.com/goshs-labs/goshs/blob/main/tui/tui.go): `tui/tui.go`
- [Reverse-shell catcher](https://github.com/goshs-labs/goshs/blob/main/catcher/catcher.go): `catcher/catcher.go`

### Security and integrations

- [Webhook delivery](https://github.com/goshs-labs/goshs/blob/main/webhook/webhook.go): `webhook/webhook.go`
- [TLS certificates](https://github.com/goshs-labs/goshs/blob/main/ca/ca.go): `ca/ca.go`
- [Public tunnel](https://github.com/goshs-labs/goshs/blob/main/tunnel/tunnel.go): `tunnel/tunnel.go`

### Other components

- **Operator**

## Connections

- Operator → CLI options: sets flags (evidence: `options/options.go`)
- Operator → HTTP / WebDAV: uses server
- CLI options → Config loading: loads settings
- CLI options → Option validation: validates options
- Option validation → Service orchestration: starts runtime
- Service orchestration → HTTP / WebDAV: starts listener (evidence: `server/server.go`)
- Service orchestration → FTP: starts when enabled (evidence: `server/server.go`)
- Service orchestration → SFTP: starts when enabled (evidence: `server/server.go`)
- Service orchestration → SMB and NTLM: starts when enabled (evidence: `server/server.go`)
- Service orchestration → LDAP capture: starts when enabled (evidence: `server/server.go`)
- Service orchestration → DNS callbacks: starts when enabled (evidence: `server/server.go`)
- Service orchestration → SMTP capture: starts when enabled (evidence: `server/server.go`)
- HTTP / WebDAV → File operations: routes requests
- HTTP / WebDAV → Share links: routes share requests (evidence: `httpserver/server.go`)
- HTTP / WebDAV → Payload templating: serves rendered files
- HTTP / WebDAV → TLS certificates: configures TLS (evidence: `httpserver/server.go`)
- Service orchestration → Team chat: creates shared chat (evidence: `server/server.go`)
- Service orchestration → Event hub: creates event hub (evidence: `server/server.go`)
- HTTP / WebDAV → Team chat: receives shared chat (evidence: `httpserver/server.go`)
- HTTP / WebDAV → Event hub: uses event hub (evidence: `httpserver/server.go`)
- Event hub → Team chat: stores chat reference (evidence: `ws/hub.go`)
- WebSocket clients → Team chat: updates messages (evidence: `ws/client.go`)
- WebSocket clients → Event hub: broadcasts events (evidence: `ws/client.go`)
- Service orchestration → Terminal dashboard: launches dashboard
- Terminal dashboard → Event hub: observes events (evidence: `tui/tui.go`)
- Terminal dashboard → Team chat: shares chat state (evidence: `tui/tui.go`)
- Service orchestration → Reverse-shell catcher: exposes catcher (evidence: `server/server.go`)
- SMB and NTLM → Event hub: broadcasts captures
- LDAP capture → Event hub: broadcasts captures
- DNS callbacks → Event hub: broadcasts queries (evidence: `dnsserver/server.go`)
- SMTP capture → Event hub: reports mail events
- DNS callbacks → Webhook delivery: sends callbacks (evidence: `dnsserver/server.go`)
- Service orchestration → Public tunnel: starts optional tunnel
