X-Git-Url: https://git.r.bdr.sh/rbdr/mobius/blobdiff_plain/4434fc431bef6b49b25ba5c5a0fd76b950c78ae1..2d0f2abe62a5cc7272f7aeabc761bc7cf2147592:/cmd/mobius-hotline-server/main.go diff --git a/cmd/mobius-hotline-server/main.go b/cmd/mobius-hotline-server/main.go index 11e3baf..7d3bf27 100644 --- a/cmd/mobius-hotline-server/main.go +++ b/cmd/mobius-hotline-server/main.go @@ -12,12 +12,10 @@ import ( "gopkg.in/natefinch/lumberjack.v2" "io" "log" - "math/rand" "net/http" "os" "path/filepath" "runtime" - "time" ) //go:embed mobius/config @@ -28,8 +26,6 @@ const ( ) func main() { - rand.Seed(time.Now().UnixNano()) - ctx, cancel := context.WithCancel(context.Background()) // TODO: implement graceful shutdown by closing context @@ -47,7 +43,8 @@ func main() { // } // }() - basePort := flag.Int("bind", defaultPort, "Bind address and port") + netInterface := flag.String("interface", "", "IP addr of interface to listen on. Defaults to all interfaces.") + basePort := flag.Int("bind", defaultPort, "Base Hotline server port. File transfer port is base port + 1.") statsPort := flag.String("stats-port", "", "Enable stats HTTP endpoint on address and port") configDir := flag.String("config", defaultConfigPath(), "Path to config root") version := flag.Bool("version", false, "print version and exit") @@ -91,7 +88,6 @@ func main() { logger.Fatal(err) } logger.Infow("Config dir initialized at " + *configDir) - } else { logger.Infow("Existing config dir found. Skipping initialization.") } @@ -101,7 +97,7 @@ func main() { logger.Fatalw("Configuration directory not found. Correct the path or re-run with -init to generate initial config.", "path", configDir) } - srv, err := hotline.NewServer(*configDir, *basePort, logger, &hotline.OSFileStore{}) + srv, err := hotline.NewServer(*configDir, *netInterface, *basePort, logger, &hotline.OSFileStore{}) if err != nil { logger.Fatal(err) } @@ -236,7 +232,6 @@ func copyDir(src, dst string) error { } f.Close() } - } return nil