diff --git a/.gitignore b/.gitignore index e3fea5bc..e2d07310 100644 --- a/.gitignore +++ b/.gitignore @@ -36,9 +36,6 @@ coverage.html # Sed backup files *.bak -# JetBrains/GoLand/IntelliJ project file -.idea - # Project specific prog/weaver/weaver prog/weavedns/weavedns diff --git a/router/http.go b/router/http.go index ff6bb2de..0f014956 100644 --- a/router/http.go +++ b/router/http.go @@ -30,18 +30,17 @@ func (router *NetworkRouter) HandleHTTP(muxRouter *mux.Router) { router.ForgetConnections(r.Form["peer"]) }) - muxRouter.Methods("POST").Path("/expose/{ip}/{prefixlen}/{skipNAT}").HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + muxRouter.Methods("POST").Path("/expose/{ip}/{prefixlen}").HandlerFunc(func(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) - var skipNAT bool cidr, err := address.ParseCIDR(vars["ip"] + "/" + vars["prefixlen"]) if err != nil { http.Error(w, fmt.Sprint("unable to parse ip addr: ", err.Error()), http.StatusBadRequest) return } - if vars["skipNAT"] != "" { - skipNAT, err = strconv.ParseBool(vars["skipNAT"]) - if err != nil { + var skipNAT bool + if r.FormValue("skipNAT") != "" { + if skipNAT, err = strconv.ParseBool(r.FormValue("skipNAT")); err != nil { http.Error(w, fmt.Sprint("unable to parse skipNAT option: ", err.Error()), http.StatusBadRequest) } } diff --git a/weave b/weave index 08a37607..a8463ffc 100755 --- a/weave +++ b/weave @@ -430,7 +430,7 @@ EOF } expose_ip() { - [ -z $WITHOUT_MASQUERADE ] || skipNAT="/true" + [ -z $WITHOUT_MASQUERADE ] || skipNAT="?skipNAT=true" ipam_cidrs allocate_no_check_alive weave:expose $CIDR_ARGS for CIDR in $ALL_CIDRS ; do call_weave "POST" "/expose/$CIDR$skipNAT"