====== Source and building ======

Door Hub is written in Go. The source is in ''doorhub-0.1.0-source.tar.gz'' on the [[https://retro.theiguru.au/doorhub/|downloads page]].

===== Licence =====

Door Hub is Copyright (C) 2026 Michael Slater (Heisenberg). It is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. It comes with no warranty.

It uses the Go standard library and ''golang.org/x/crypto'' (SSH, bcrypt) and ''golang.org/x/sys'' (Windows services), BSD licence, Copyright The Go Authors. Door Hub is not connected with DoorParty.

===== Layout =====

^ Path ^ What it is ^
| ''cmd/doorhub/'' | The hub: ''main.go'' (commands), ''server.go'' (SSH server, sessions, door BBS logins), ''menu.go'', ''store.go'' (hub.json, players.json, locking), ''mkuser.js'' (embedded) |
| ''cmd/doorhub-connector/'' | The connector |
| ''internal/rlogin/'' | RLogin handshake (RFC 1282) |
| ''internal/winsvc/'' | Windows service support |
| ''scripts/doorhub.js'' | Synchronet client script |
| ''dist/'' | Text documents and service files that go in the packages |
| ''docs/wiki/'' | These wiki pages |
| ''tests/e2e.sh'' | End-to-end test |
| ''mkrelease.sh'' | Builds the release packages |

===== Building =====

You need Go 1.26 or later. (An older Go downloads the right version by itself when it has internet access.)

<code bash>
tar xf doorhub-0.1.0-source.tar.gz
cd doorhub-0.1.0
go build -o build/ ./cmd/...                                   # this system
GOOS=windows GOARCH=amd64 go build -o build/win/ ./cmd/...     # Windows
GOOS=linux GOARCH=arm64 go build -o build/arm64/ ./cmd/...     # Raspberry Pi (64-bit)
</code>

Go downloads the two ''golang.org/x'' modules the first time. The programs are single files with no other dependencies.

''./mkrelease.sh 0.1.0'' builds all the packages into ''release/0.1.0/'' with the version number set.

===== Testing =====

''tests/e2e.sh'' starts a hub, a connector and a stand-in door BBS on the local machine (ports 12022, 19998 and 15513) and checks: direct game start, keys reaching the game, the menu, a wrong player password, a second tag in the name, a disabled BBS with a tunnel already open, a closed game, and that a plain SSH login is refused.

<code bash>
go build -o build/ ./cmd/... && tests/e2e.sh
GOOS=windows GOARCH=amd64 go build -o build/win/ ./cmd/... && WINE=1 STARTWAIT=8 tests/e2e.sh   # Windows builds under Wine
</code>

The Wine run needs ''wine64'' and ''Xvfb''.
