mirror of
https://git.hackfreedom.org/mesh.cat/meshname.git
synced 2026-05-22 06:22:32 +00:00
add port argument
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user