From ffafcb08a5e4c044197c8751b4b03ebdaa83c324 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 27 Feb 2016 16:45:20 -0600 Subject: [PATCH] Renamed VirtualServer to LogicalServer. Filled out some comments. --- dospin.json | 4 ++-- droplethandler.go | 2 +- servermanager.go | 5 +++++ settings.go | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/dospin.json b/dospin.json index f38463b..e9d14e5 100644 --- a/dospin.json +++ b/dospin.json @@ -3,10 +3,10 @@ "Services": { "Minecraft": { "Port": 25565, - "VirtualDroplet": "minecraft" + "LogicalDroplet": "minecraft" } }, - "VirtualDroplets": { + "LogicalServers": { "minecraft": { "Size": "4gb", "Region": "nyc3" diff --git a/droplethandler.go b/droplethandler.go index c203d7e..caeb80c 100644 --- a/droplethandler.go +++ b/droplethandler.go @@ -57,7 +57,7 @@ func (me *DropletHandler) Spinup(name string) (string, error) { if err != nil { return "", err } - vd := me.settings.VirtualServers[name] + vd := me.settings.LogicalServers[name] createRequest := &godo.DropletCreateRequest{ Name: DROPLET_NS + name, Region: vd.Region, diff --git a/servermanager.go b/servermanager.go index 096d985..a0f7fc8 100644 --- a/servermanager.go +++ b/servermanager.go @@ -47,12 +47,17 @@ func NewServerManager(name string, server ServerHandler, settings Settings) *Ser Serves channel requests. */ func (me *ServerManager) Serve() { + // TODO: see if server is currently up, and setup port forwarding if so + + // event loop for running := true; running; { select { case action := <-me.in: running = me.serveAction(action) } } + + // notify done me.done <- 42 } diff --git a/settings.go b/settings.go index 1daa18b..7fc2f32 100644 --- a/settings.go +++ b/settings.go @@ -15,7 +15,7 @@ import ( type Settings struct { ApiToken string Services map[string]Service - VirtualServers map[string]VirtualServer + LogicalServers map[string]LogicalServer } type Service struct { @@ -23,7 +23,7 @@ type Service struct { LogicalServer string } -type VirtualServer struct { +type LogicalServer struct { Size string Region string }