diff --git a/whoami.go b/whoami.go index b3a00ad..189d1c6 100644 --- a/whoami.go +++ b/whoami.go @@ -5,6 +5,7 @@ import ( "net" "strings" "encoding/base32" + "os" ) // DomainFromIP derives a meshname subdomain for the authoritative DNS server address @@ -27,6 +28,13 @@ func handler(w http.ResponseWriter, r *http.Request) { func main() { http.HandleFunc("/", handler) - http.ListenAndServe(":3000", nil) + listenPort := "3000" + // Get the first command-line argument + if len(os.Args) > 1 { + listenPort = os.Args[1] + } + print("Listening on port:", listenPort, "\n") + listenPort = strings.Join([]string{":", listenPort}, "") + http.ListenAndServe(listenPort, nil) }