aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--run.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/run.go b/run.go
index 83fdf36..3dce801 100644
--- a/run.go
+++ b/run.go
@@ -10,9 +10,15 @@ import (
"syscall"
)
-// Run initializes the proxy andstarts the main listener loop.
+var runOnce sync.Once
+
+// Run initializes the proxy and starts the main listener loop.
// It blocks forever.
func Run() {
+ runOnce.Do(runFunc)
+}
+
+func runFunc() {
if err := LoadConfig(); err != nil {
log.Fatal(err)
}