docs(reference): import Dune: Awakening server-manager references
Phase 2 references for the host-agent Dune adapter, moved out of volatile /tmp
into docs/reference-repos/ (per Commander). Three upstream projects, .git +
node_modules + compiled binaries stripped (16MB source). Nested AI-instruction
files (.claude/, CLAUDE.md) removed so they don't pollute Corrosion sessions.
- icehunter/ dune-admin (Go+React) — 4 control planes; SETUP_DOCKER.md is the
closest analog to our agent's Dune docker control plane (compose
lifecycle, docker logs, RabbitMQ-via-exec, dune Postgres schema)
- adainrivers/ Rust/Tauri desktop — SSH+k8s BattleGroup control, maintenance
daemon, in-game admin console (Rust idiom reference)
- the4rchangel/ Node web UI replacing battlegroup.bat — matches the Commander's
Hyper-V self-host path + game-config schema
See docs/reference-repos/README.md for the full index + how we use each.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
48
docs/reference-repos/icehunter/cmd/dune-admin/broker.go
Normal file
48
docs/reference-repos/icehunter/cmd/dune-admin/broker.go
Normal file
@@ -0,0 +1,48 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
amqp "github.com/rabbitmq/amqp091-go"
|
||||
)
|
||||
|
||||
// brokerCredentials returns the configured AMQP username and password.
|
||||
// Both BROKER_USER and BROKER_PASS (or config equivalents) are required.
|
||||
func brokerCredentials() (user, pass string, err error) {
|
||||
user = brokerUser
|
||||
pass = brokerPass
|
||||
if user == "" || pass == "" {
|
||||
return "", "", fmt.Errorf("broker credentials are required: set BROKER_USER and BROKER_PASS")
|
||||
}
|
||||
return user, pass, nil
|
||||
}
|
||||
|
||||
// dialAMQP connects to an AMQP broker at addr. TCP is routed through the
|
||||
// global executor so it works for both direct and SSH-tunnelled connections.
|
||||
func dialAMQP(addr, user, pass string, useTLS bool) (*amqp.Connection, error) {
|
||||
cfg := amqp.Config{
|
||||
SASL: []amqp.Authentication{
|
||||
&amqp.PlainAuth{Username: user, Password: pass},
|
||||
},
|
||||
Vhost: "/",
|
||||
Locale: "en_US",
|
||||
Heartbeat: 10 * time.Second,
|
||||
Dial: func(_, _ string) (net.Conn, error) {
|
||||
if globalExecutor != nil {
|
||||
return globalExecutor.Dial("tcp", addr)
|
||||
}
|
||||
if globalSSH != nil {
|
||||
return globalSSH.Dial("tcp", addr)
|
||||
}
|
||||
return net.Dial("tcp", addr)
|
||||
},
|
||||
}
|
||||
if useTLS {
|
||||
cfg.TLSClientConfig = &tls.Config{MinVersion: tls.VersionTLS12}
|
||||
return amqp.DialConfig("amqps://"+addr+"/", cfg)
|
||||
}
|
||||
return amqp.DialConfig("amqp://"+addr+"/", cfg)
|
||||
}
|
||||
Reference in New Issue
Block a user