From da26894f0b3bce1dfd2b7df33c7c638f8083fed8 Mon Sep 17 00:00:00 2001 From: Ambrose Chua Date: Thu, 19 Dec 2019 20:52:27 +0800 Subject: [PATCH] Update README and initial routes --- README.md | 4 ++++ cmd/server.go | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/README.md b/README.md index e5608b4..d50846d 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,13 @@ In summary: * Manage "client" keys * Exchange keys over HTTP(S) +* Exchange IP addressing (DHCP-like) * Manually gate new peers +* Sets up network interface on the "client" * Generate Ansible INI inventory +The primary scenario this tool is going to be used for is to manage machines using Ansible within an unknown LAN behind NAT. I am planning to use it for FOSSASIA Summit 2020. + ## Limitations * Linux-only diff --git a/cmd/server.go b/cmd/server.go index 83dd117..69bcd12 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -41,6 +41,19 @@ func runServer(ctx *cli.Context) error { } listen := ctx.String("listen") + // TODO: Rate limiting + + http.HandleFunc("/pub", func(w http.ResponseWriter, r *http.Request) { + // Produce the public key + }) + + http.HandleFunc("/request", func(w http.ResponseWriter, r *http.Request) { + // Ensure public key is new + // Assign an IP address + // Enqueue request into the gate + // Wait for flush of configuration + }) + log.Println(inter) log.Println(config) log.Println(listen)